Failing listener should not prevent others from executing.

Description

Openfire uses event listening in various places: in various places, a collection of 'listeners' is maintained, on which a method is invoked whenever something happens.

A common pattern for dispatching an event is this:

for (RosterEventListener listener : listeners) { listener.contactDeleted(roster, item); }

When an event is dispatched to listeners, an exception thrown by one of the listeners should not prevent the other listeners from being invoked, which is what would happen in the code above.

The pattern above should be replaced by something like this:

for (RosterEventListener listener : listeners) { try { listener.contactDeleted(roster, item); } catch (Exception e) { Log.warn("An exception occurred while dispatching a 'contactDeleted' event!", e); } }

Please find and replace all instances of the above pattern!

Environment

None

Activity

Show:
Fixed

Details

Assignee

Reporter

Fix versions

Priority

Created April 25, 2019 at 12:52 PM
Updated April 29, 2019 at 6:34 PM
Resolved April 29, 2019 at 6:34 PM

Flag notifications