Class Hierarchy All Classes All Fields and Methods

Class com.ibm.broker.plugin.MbException

java.lang.Object
        java.lang.Throwable
                java.lang.Exception
                        com.ibm.broker.plugin.MbException

public class MbException
extends 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);
              }
          }
      }
  }
 

Method Index
Method Description
String getClassName() Returns the class name of the object that generated the exception.
Object[] getInserts() Returns the object array containing the inserts in the message.
String getMessage() Returns the full message with inserts.
String getMessageKey() Returns the key to the message in the exception.
String getMessageSource() Returns the source of the message in the exception.
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).
String getTraceText() Returns the trace text.
String toString() Returns the String representation of the exception.

Methods

getClassName

public String getClassName() 

Returns the class name of the object that generated the exception.

getInserts

public Object[] getInserts() 

Returns the object array containing the inserts in the message.

getMessage

public String getMessage() 

Returns the full message with inserts.

getMessageKey

public String getMessageKey() 

Returns the key to the message in the exception.

getMessageSource

public String getMessageSource() 

Returns the source of the message in the exception.

getMethodName

public String getMethodName() 

Returns the name of the method which threw the exception.

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.

getTraceText

public String getTraceText() 

Returns the trace text.

toString

public String toString() 

Returns the String representation of the exception.

Class Hierarchy All Classes All Fields and Methods