Uploaded image for project: 'Solder'
  1. Solder
  2. SOLDER-290

Rethrown checked exception should not be wrapped within ObserverException

    Details

    • Affects:
      Release Notes

      Description

      The spec says:

      Otherwise, the exception aborts processing of the event. No other observer methods of that event will be called. The
      BeanManager.fireEvent() or Event.fire() method rethrows the exception. If the exception is a checked exception,
      it is wrapped and rethrown as an (unchecked) ObserverException.

      Therefore, everytime an exception handler marks the exception to be rethrown, ExceptionHandlerDispatch.executeHandlers() rethrows the exception. If the exception is checked, the CDI implementation must wrap the exception within ObserverException. As a result, the exception is rethrown within the ObserverException wrapper.

      Everytime we notify the dispatcher using via the ExceptionToCatch event bm.fireEvent(new ExceptionToCatch(e)), we should check if the call raises an exception and if it does raises ObserverException, we should unwrap it.

      This should be also documented for other integrators to do the same thing.

        Gliffy Diagrams

          Activity

          Hide
          jharting Jozef Hartinger added a comment -

          Added test org.jboss.solder.exception.control.test.common.interceptor.ExceptionHandledInterceptorTest.testExceptionRethrownWhenNoExceptionHandlerAvailable()

          Show
          jharting Jozef Hartinger added a comment - Added test org.jboss.solder.exception.control.test.common.interceptor.ExceptionHandledInterceptorTest.testExceptionRethrownWhenNoExceptionHandlerAvailable()

            People

            • Assignee:
              lightguard Jason Porter
              Reporter:
              jharting Jozef Hartinger
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development