docs: private EJBException mapException(EJSDeployedSupport s, Throwable ex) //117817.1
      {
          EJBException ejbex;
          String message = null;
  
          // If necessary, wrap root with WsEJBException.  This is done if
          // root is not an instance of Exception.
          Exception rootEx = ExceptionUtil.Exception(s.rootEx); // F71894.1
  
          // Now map Throwable to a EJBException to return.
          if (ex instanceof CSIException)
          {
              ejbex = mapCSIException(s, (CSIException) ex, rootEx);
          }
          else if (ex instanceof NoSuchObjectException)
          {
              ejbex = new NoSuchObjectLocalException(message, rootEx);
          }
          else if (ex instanceof EJBStoppedException) // d350987
          {
              ejbex = new NoSuchObjectLocalException(message, rootEx);
          }
          else if (ex instanceof HomeDisabledException) // d350987
          {
              ejbex = new NoSuchObjectLocalException(message, rootEx);
          }
          else if (ex instanceof TransactionRequiredException)
          {
              ejbex = new TransactionRequiredLocalException(message);
          }
          else if (ex instanceof TransactionRolledbackException)
          {
              ejbex = new TransactionRolledbackLocalException(message, rootEx);
          }
          else if (ex instanceof InvalidTransactionException)
          {
              ejbex = new InvalidTransactionLocalException(message, rootEx);
          }
          else if (ex instanceof AccessException)
          {
              ejbex = new AccessLocalException(message, rootEx);
          }
          //        else if (ex instanceof ActivityRequiredException)
  //        {
  //            ejbex = new ActivityRequiredLocalException(message, rootEx);
  //        }
  //        else if (ex instanceof InvalidActivityException) //126946.3
  //        {
  //            ejbex = new InvalidActivityLocalException(message, rootEx); //126946.3
  //        }
  //        else if (ex instanceof ActivityCompletedException)
  //        {
  //            ejbex = new ActivityCompletedLocalException(message, rootEx); //126946.3
  //        }
          else if (ex instanceof EJBException)
          {
              // Even though this is already an EJBException we will nest it inside another EJBException that we create.
              // This is done to ensure that but the getCause() and getCausedByException() methods will work on it.   //253963
              ejbex = ExceptionUtil.EJBException(ex); //253963
          }
          else if (ex instanceof RemoteException)
          {
              // If the RemoteException is already wrapping an EJBException, then
              // use that exception, otherwise create a new EJBException with the root  //253963
              if (((RemoteException) ex).detail instanceof EJBException)
              {
                  ejbex = ExceptionUtil.EJBException(ex); //253963
              }
              else
                  ejbex = ExceptionUtil.EJBException(rootEx); //253963
          }
          else if (ex instanceof IllegalArgumentException) // d184523
          {
              ejbex = ExceptionUtil.EJBException(rootEx); //253963
          }
          else
          {
              ejbex = new UnknownLocalException(message, rootEx);
          }
  
          // EJBException doesn't normally set the cause on Throwable, so
          // let's do that to be nice :-)                                    d354591
          // Geronimo EJBException.getCause returns getCausedbyException, so
          // we do not expect this code to be used.                           F53643
          if (rootEx != null &&
              rootEx != ejbex &&
              ejbex.getCause() == null)
          {
              ejbex.initCause(rootEx);
          }
  
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
              Tr.debug(tc, "mapException returning: " + ejbex); // d402055
          }
  
          return ejbex;
      }