Instead of setting a boolean when a dispatch happens, an integer is incremented when the dispatch begins and decremented when it ends, thus keepnig track of nested calls to the dispatch method.
In addition, a minor bug has been fixed that caused errors (for example thrown by a JUnit assertion) to be handled using an exception event instead of being transparently propagated to the caller as intended.
When an error is caused during the dispatch of a system event, a warning
has been logged instead instead of rethrowing the error. This has been
This enables failing a JUnit test when an exception event handler is
The test performs a nested event dispatch then cancels the dispatch. If
Both operations are successful, the test is successful.
Currently, the test fails, but should be successful once the nested
dispatch bug is fixed.