docs: public static EJBException EJBException(String message,
                                              Throwable cause) {
          EJBException ejbex = null;
  
          // -----------------------------------------------------------------------
          // If a cause was not specified, then this method has been called to
          // just create a generic EJBException with the specified message.
          // -----------------------------------------------------------------------
          if (cause == null) {
              ejbex = new EJBException(message);
          }
  
          // -----------------------------------------------------------------------
          // If the cause happens to be a WebSphere specific subclass of
          // EJBException or RemoteException, then convert it to a plain
          // EJBException or at least unwrap it, so a plain EJBException
          // is created below.
          // -----------------------------------------------------------------------
          String causeMessage = null;
          while (cause != null &&
                 (!(cause instanceof RecursiveInjectionException)) && // d408351
                 (cause instanceof ContainerException ||
                  cause instanceof UncheckedException ||
                  cause instanceof EJSPersistenceException ||
                  cause instanceof CPIException ||
                  cause instanceof CPMIException ||
                  cause instanceof CSIException ||
                  cause instanceof InjectionException || // d436080
                  cause instanceof ManagedObjectException ||
                  (cause instanceof EJBException &&
                   cause instanceof WsNestedException))) {
  
              Throwable nextCause = cause.getCause();
              if (nextCause == null) {
                  // Nothing was nested in the WebSphere specific exception,
                  // so convert to EJBException, copying the message and stack.
                  if (causeMessage == null) {
                      causeMessage = cause.getMessage();
                  }
                  ejbex = new EJBException(causeMessage);
                  ejbex.setStackTrace(cause.getStackTrace());
              } else if (causeMessage == null && cause instanceof InjectionException) {
                  causeMessage = cause.getMessage();
              }
              cause = nextCause;
          }
  
          // -----------------------------------------------------------------------
          // If the cause is not already an EJBException, then create a new
          // EJBException.  Since EJBException doesn't have a constructor that
          // accepts a Throwable, wrap any Throwable in an Exception...
          // but note that the cause on Throwable will be the root cause
          // (i.e. not wrapped in Exception).  In all cases, insure getCause()
          // works if there is a cause, and clear the stack if the EJBException
          // wasn't thrown by the customer.... let the cause stack point to
          // the failure.
          // -----------------------------------------------------------------------
          if (ejbex == null) {
              if (cause instanceof EJBException) {
                  ejbex = (EJBException) cause;
  
                  // EJBException doesn't normally set the cause on Throwable, so
                  // let's do that to be nice :-)
                  // Geronimo EJBException.getCause returns getCausedbyException, so
                  // we do not expect this code to be used.                     F53643
                  cause = ejbex.getCausedByException();
                  if (cause != null && ejbex.getCause() == null)
                      ejbex.initCause(cause);
              } else {
                  if (causeMessage == null) {
                      causeMessage = message;
                  }
                  ejbex = new EJBException(causeMessage, Exception(cause));
  
                  // And finally... insure the cause is set on Throwable.
                  // Geronimo EJBException.getCause returns getCausedbyException, so
                  // we do not expect this code to be used.                     F53643
                  if (ejbex.getCause() == null) { // F743-16279
                      ejbex.initCause(cause);
                  }
              }
          }
  
          return ejbex;
      }