docs: public static String getBaseMessage(Throwable exception) {
          String message = null;
  
          // -----------------------------------------------------------------------
          // RemoteException contains a 'detail' field that holds the 'cause',
          // instead of the normal cause defined by Throwable.  When detail is
          // set, getMessage() will include the text and stack of the detail,
          // which may ends up duplicating the message text.
          //
          // To avoid this, 'detail' is temporarily cleared, resulting in
          // getMessage() returning only the message text specified when the
          // RemoteException was created.                                    d366807
          // -----------------------------------------------------------------------
          if (exception instanceof RemoteException) {
              RemoteException rex = (RemoteException) exception;
              Throwable detail = rex.detail;
              rex.detail = null;
  
              message = rex.getMessage();
  
              rex.detail = detail;
  
              // We frequently create remote exceptions with an empty message
              // to avoid redundant messages being printed in stack traces.  If the
              // remote exception has an empty message, use the detail.       d739198
              if ("".equals(message) && detail != null) {
                  message = getBaseMessage(detail);
              }
          }
  
          // -----------------------------------------------------------------------
          // Other exceptions, like EJBException, do not contain a public field
          // that holds the 'cause'. So for these exceptions, the returned
          // message text is just parsed for the beginning of the nested
          // exceptions... and then truncated.
          // -----------------------------------------------------------------------
          else if (exception != null) {
              message = exception.getMessage();
              if (message != null) {
                  if (message.startsWith("nested exception is:")) {
                      message = null;
                  } else {
                      int nestIndex = message.indexOf("; nested exception is:");
                      if (nestIndex > -1)
                          message = message.substring(0, nestIndex);
                  }
              }
          }
          return message;
      }