Uploaded image for project: 'CAS Server'
  1. CAS-1096

NPE in DefaultTicketRegistryCleaner due to Null-Objects in Ticket-Collection

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.4.11
    • Fix Version/s: 4.0 RC1, 4.0
    • Component/s: Ticket
    • Labels:
      None

      Description

      The Ticket-Collection returned by JBossCacheTicketRegistry.getTickets() method might contain Null-Objects (since they are allowed in an ArrayList). This leads to a NullPointerException in the DefaultTicketRegistryCleaner when iterating over the tickets (see line 81-86):

                  
                 ticketsInCache = this.ticketRegistry.getTickets();
                  for (final Ticket ticket : ticketsInCache) {
                      if (ticket.isExpired()) {
                          ticketsToRemove.add(ticket);
                      }
                  }
      

      Which happened in our system.

      To make the code more robust, consider a) using a Collection-implementation which does not allow Null-values when reading all tickets in JBossCacheTicketRegistry.getTickets() b) add a null-test before adding a Ticket to the Collection in the JBossCacheTicketRegistry.getTickets()-method or c) add a null-test to the DefaultTicketRegistryCleaner code mentioned above.

        Attachments

          Activity

            People

            • Assignee:
              mmoayyed Misagh Moayyed
              Reporter:
              oehmiche Odilo Oehmichen
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: