docs: @Override
      public final Throwable setUncheckedException(EJSDeployedSupport s, Throwable ex)
      {
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
              Tr.entry(tc, "setUncheckedException:" + ex);
  
          // d395666 start
          // Entering this method for a second time?
          if (s.ivException != null)
          {
              // Yep, this is the second time, so we will just keep the original exception.
              if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
              {
                  Tr.event(tc, "setting unchecked exception again", ex);
                  Tr.event(tc, "original exception", s.ivException);
              }
              return s.ivException;
          }
  
          // Nope, this is first time this method entered.
          // Did a non-RemoteException occur?
          Boolean applicationExceptionRollback = null;
          if (ex instanceof Exception && // d423621
              !(ex instanceof RemoteException))
          {
              // Yep, check whether it is annotated as an ApplicationException.
              applicationExceptionRollback = s.getApplicationExceptionRollback(ex);
          }
  
          // Did above code result in determing Throwable is a an ApplicationException?
          if (applicationExceptionRollback != null)
          {
              // Yep, it is an AppplicationException, so just store it
              // in ivException so that it gets rethrown.
              if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                  Tr.event(tc, "ApplicationException with rollback set to true, changing to a checked exception", ex);
  
              // Set exceptiion type to checked exception since it is an ApplicationException.
              s.exType = ExceptionType.CHECKED_EXCEPTION;
              s.ivException = ex;
              s.rootEx = ex;
  
              // Is rollback set to true for the ApplicationException?
              if (applicationExceptionRollback == Boolean.TRUE)
              {
                  if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                      Tr.event(tc, "ApplicationException with rollback set to true, setting rollback only", ex);
  
                  s.currentTx.setRollbackOnly();
              }
  
              if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                  Tr.exit(tc, "setUncheckedException returning: " + s.ivException);
  
              return s.ivException;
          }
          // d395666 end
  
          // Not a EJB 3 ApplicationException, so do pre-EJB 3 checking.
  
          // If the bean failed to activate because it was found to not
          // exist (original exception is NoSuchObjectException or
          // NoSuchEJBException for Singleton failures), assume the
          // exception type to be checked exception so that no rollback will
          // be performed during transaction control in post-invoke processing.
          // Otherwise, set the type to unchecked exception and log it
          // as required by the EJB specification.
          // Also, as determined by CTS, when BeanNotReentrantException
          // occurs in preInvoke, it is not considered that the method was
          // ever invoked, and so it should be a checked exception and
          // should not cause a rollback.
          // Also, as determined by CTS, an AccessException from the Security
          // Collaborator should not cause a rollback.
          if ((s.preInvokeException && (ex instanceof NoSuchObjectException ||
                                        ex instanceof NoSuchEJBException || // d632115
                                        ex instanceof EJBStoppedException || // d350987
                                        ex instanceof CSIAccessException || ex instanceof BeanNotReentrantException)))
          {
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                  Tr.debug(tc, "Exception should not cause rollback, "
                               + "changing to checked exception");
  
              // For NoSuchObjectException, the beanO is already null since
              // it occurs during activation, but for BeanNotReentrant, the
              // activation may have succeeded (for Entity beans), but since
              // the method is never invoked, postInvoke processing should
              // not occur on the beanO; so null it out.
              if (ex instanceof BeanNotReentrantException)
              {
                  s.beanO = null;
              }
              s.exType = ExceptionType.CHECKED_EXCEPTION;
          }
          else if (EJSContainer.defaultContainer == null)
          {
              // If the EJBContainer has been stopped, then likely an ugly exception occurred,
              // like NullPointerException. In this case, just discard the original exception
              // and throw a meaningful one indicating the EJB feature has been removed.
              s.exType = ExceptionType.UNCHECKED_EXCEPTION;
              ex = new EJBException("The Enterprise JavaBeans (EJB) features have been deactivated. No further EJB processing is allowed");
  
              // Log the error message at this point
              ExceptionUtil.logException(tc, ex, s.getEJBMethodMetaData(), s.getBeanO());
  
              // Don't bother with FFDC, it will just be clutter at this point.
          }
          else
          {
              s.exType = ExceptionType.UNCHECKED_EXCEPTION;
  
              // Log the error message at this point
              ExceptionUtil.logException(tc, ex, s.getEJBMethodMetaData(), s.getBeanO());
  
              // FFDC log any unchecked / unexpected exceptions.  d331740
              FFDCFilter.processException(ex, CLASS_NAME + ".setUncheckedException", "506", this);
          }
  
          // Find the root cause of the exception.
          s.rootEx = findRootCause(ex);
  
          // map the exception to the appropriate EJBException
          s.ivException = mapException(ex);
  
          // At this point, it is assumed that the exception being returned
          // is an EJBException created by the customer, with the stack
          // as create by the customer, or is an EJBException created by
          // EJB Container, with an empty stack (if there is a cause), or the
          // stack of the exception that was mapped to an EJBException
          // (if there is no cause).  No need to set the stack here.
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
              Tr.exit(tc, "setUncheckedException returning: " + s.ivException);
  
          return s.ivException;
      }