com.ibm.broker.plugin

Class MbException

  • java.lang.Object
    • java.lang.Throwable
      • java.lang.Exception
        • com.ibm.broker.plugin.MbException
  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    MbFatalException, MbJavaException, MbRecoverableException, MbSecurityException


    public class MbException
    extends java.lang.Exception
    This is the base class of the exception hierarchy from which all exceptions are derived. An MbException object represents a single item within an exception list. An exception list is a hierarchy of exceptions which grow as error conditions get passed back up through the message flow. Despite the name, an exception list is, in fact, a tree structure with each exception able to have more than one child. It is possible to traverse the exception hierarchy within an exception handler in a Java user-defined node by calling getNestedExceptions() in a recursive manner.

    Example usage:

      public void evaluate(MbMessageAssembly assembly, MbInputTerminal inTerm) throws MbException
      {
        try
          {
    
            // plug-in functionality
    
          }
        catch(MbException ex)
          {
            traverse(ex, 0);
    
            throw ex; // if re-throwing, it must be the original exception that was caught
          }
      }
    
      void traverse(MbException ex, int level)
      {
        if(ex != null)
          {
            // Do whatever action here
            System.out.println("Level: " + level);
            System.out.println(ex.toString());
            System.out.println("traceText:  " + ex.getTraceText());
    
            // traverse the hierarchy
            MbException e[] = ex.getNestedExceptions();
            int size = e.length;
            for(int i = 0; i < size; i++)
            if( ex instanceof MbJavaException )
              {
                System.out.println("Level: " + level);
                System.out.println(((MbJavaException)ex).getThrowable().toString());
              }
            else
              {
                // Do whatever action here
                System.out.println("Level: " + level);
                System.out.println(ex.toString());
                System.out.println("traceText:  " + ex.getTraceText());
                // traverse the hierarchy
                MbException e[] = ex.getNestedExceptions();
                int size = e.length;
                for(int i = 0; i < size; i++)
                  {
                      traverse(e[i], level + 1);
                  }
              }
          }
      }
     
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void addNestedException(MbException childException)
      Adds an exception to the array of exception objects representing the children of this exception in the hierarchy (exception list).
      java.lang.String getClassName()
      Returns the class name of the object that generated the exception.
      java.lang.Object[] getInserts()
      Returns the object array containing the inserts in the message.
      java.lang.String getLocalizedMessage()
      Returns the localized text for the message.
      java.lang.String getMessage()
      Returns the full message with inserts.
      java.lang.String getMessageKey()
      Returns the key to the message in the exception.
      java.lang.String getMessageSource()
      Returns the source of the message in the exception.
      java.lang.String getMethodName()
      Returns the name of the method which threw the exception.
      MbException[] getNestedExceptions()
      Returns an array of exception objects representing the children of this exception in the hierarchy (exception list).
      java.lang.String getTraceText()
      Returns the trace text.
      java.lang.String toString()
      Returns the String representation of the exception.
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • getClassName

        public java.lang.String getClassName()
        Returns the class name of the object that generated the exception.
        Returns:
        The string containing the name of the class which generated the exception.
      • getInserts

        public java.lang.Object[] getInserts()
        Returns the object array containing the inserts in the message.
        Returns:
        The Object array containing the inserts in the message.
      • getMessageKey

        public java.lang.String getMessageKey()
        Returns the key to the message in the exception.
        Returns:
        The key to the message in the exception.
      • getMessageSource

        public java.lang.String getMessageSource()
        Returns the source of the message in the exception.
        Returns:
        The source of the message in the exception.
      • getMethodName

        public java.lang.String getMethodName()
        Returns the name of the method which threw the exception.
        Returns:
        The name of the method which generated the exception.
      • getTraceText

        public java.lang.String getTraceText()
        Returns the trace text.
        Returns:
        The text of the extra message in the exception.
      • getMessage

        public java.lang.String getMessage()
        Returns the full message with inserts.
        Overrides:
        getMessage in class java.lang.Throwable
        Returns:
        The full message.
      • getLocalizedMessage

        public java.lang.String getLocalizedMessage()
        Returns the localized text for the message.
        Overrides:
        getLocalizedMessage in class java.lang.Throwable
        Returns:
        The full message.
      • getNestedExceptions

        public MbException[] getNestedExceptions()
        Returns an array of exception objects representing the children of this exception in the hierarchy (exception list). Each element will be of the correct exception type (e.g. MbDatabaseException for a database error). If the current exception has no children, an empty array will be returned.
        Returns:
        An array of nested exceptions
      • addNestedException

        public void addNestedException(MbException childException)
        Adds an exception to the array of exception objects representing the children of this exception in the hierarchy (exception list). Each element should be of the correct exception type (e.g. MbDatabaseException for a database error).
      • toString

        public java.lang.String toString()
        Returns the String representation of the exception.
        Overrides:
        toString in class java.lang.Throwable
        Returns:
        A String representation of the exception.
IBM Integration BusTM
JavaTM Plugin Node API