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

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):

1 2 3 4 5 6 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.

Environment

None

Status

Assignee

Misagh Moayyed

Reporter

Odilo Oehmichen

Labels

None

Estimated End Date

None

Audience

None

Components

Fix versions

Affects versions

3.4.11

Priority

Minor