private void lifeCycleExceptionHandler ( Throwable t , EJBModuleMetaDataImpl mmd ) // F743-14982 { if ( t instanceof RuntimeException ) { // Is the RuntimeException an application exception? RuntimeException rtex = ( RuntimeException ) t ; if ( mmd . getApplicationExceptionRollback ( rtex ) != null ) // F743-14982 { // Yes it is, which is not valid for lifecycle callback // methods. So turn this into a system runtime exception. InterceptorProxy w = ivInterceptorProxies [ ivNextIndex - 1 ] ; String lifeCycle = w . getMethodGenericString ( ) ; EJBException ex = ExceptionUtil . EJBException ( lifeCycle + " is not allowed to throw an application exception" , rtex ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "lifeCycleExceptionHandler throwing EJBException" , ex ) ; } throw ex ; } else { // Not an application exception, so let the mapping // strategy handle this system runtime exception. if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "lifeCycleExceptionHandler is rethrowing RuntimeException " + "from lifecycle callback method: " + t , t ) ; } throw rtex ; } } else if ( t instanceof Error ) { // Let the mapping strategy handle this unchecked exception. if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "lifeCycleExceptionHandler is rethrowing Error from " + "lifecycle callback method: " + t , t ) ; } throw ( Error ) t ; } else { // Must be a checked exception, which should never happen since // InterceptorMetaDataFactory throws EJBConfigurationException // and does a Tr.error using message key of INVALID_LIFECYCLE_SIGNATURE_CNTR0231E // if interceptor method throws clause is not empty. But if // it does happen, wrap the exception in a special EJBException // that does not include EJB container in the exception stack. InterceptorProxy w = ivInterceptorProxies [ ivNextIndex - 1 ] ; // d367572.7 String lifeCycle = w . getMethodGenericString ( ) ; // d367572.7 EJBException ex = ExceptionUtil . EJBException ( lifeCycle + " is not allowed to throw a checked exception" , t ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) // d367572.7 { Tr . debug ( tc , "lifeCycleExceptionHandler throwing EJBException" , ex ) ; } throw ex ; } }
d450431 - ensure runtime exception is not an application exception .