Elexis API documentation
Version 2.1.6 as of December 11 2011

ch.elexis.exchange
Class ExchangeException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by ch.elexis.exchange.ExchangeException
All Implemented Interfaces:
java.io.Serializable

public class ExchangeException
extends java.lang.RuntimeException

Runtime Exception containing a status object describing the cause of the exception.

This class can be used without OSGi running.

See Also:
IStatus, Serialized Form

Constructor Summary
ExchangeException(IStatus status)
          Creates a new exception with the given status object.
 
Method Summary
 java.lang.Throwable getCause()
          Returns the cause of this exception, or null if none.
 IStatus getStatus()
          Returns the status object for this exception.
static void printChildren(IStatus status, java.io.PrintStream output)
           
static void printChildren(IStatus status, java.io.PrintWriter output)
           
 void printStackTrace()
          Prints a stack trace out for the exception, and any nested exception that it may have embedded in its Status object.
 void printStackTrace(java.io.PrintStream output)
          Prints a stack trace out for the exception, and any nested exception that it may have embedded in its Status object.
 void printStackTrace(java.io.PrintWriter output)
          Prints a stack trace out for the exception, and any nested exception that it may have embedded in its Status object.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, initCause, setStackTrace, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExchangeException

public ExchangeException(IStatus status)
Creates a new exception with the given status object. The message of the given status is used as the exception message.

Parameters:
status - the status object to be associated with this exception
Method Detail

getCause

public java.lang.Throwable getCause()
Returns the cause of this exception, or null if none.

Overrides:
getCause in class java.lang.Throwable
Returns:
the cause for this exception

getStatus

public final IStatus getStatus()
Returns the status object for this exception.

IMPORTANT:
The result must NOT be used for logging, error reporting, or as a method return value, since that code pattern hides the original stack trace. Instead, create a new Status with your plug-in ID and this CoreException, and use that new status for error reporting or as a method return value. For example, instead of:

 yourPlugin.getLog().log(exception.getStatus());
 
Use:
 IStatus result = new Status(exception.getStatus().getSeverity(), pluginId, message, exception);
 yourPlugin.getLog().log(result);
 

Returns:
a status object

printStackTrace

public void printStackTrace()
Prints a stack trace out for the exception, and any nested exception that it may have embedded in its Status object.

Overrides:
printStackTrace in class java.lang.Throwable

printStackTrace

public void printStackTrace(java.io.PrintStream output)
Prints a stack trace out for the exception, and any nested exception that it may have embedded in its Status object.

Overrides:
printStackTrace in class java.lang.Throwable
Parameters:
output - the stream to write to

printStackTrace

public void printStackTrace(java.io.PrintWriter output)
Prints a stack trace out for the exception, and any nested exception that it may have embedded in its Status object.

Overrides:
printStackTrace in class java.lang.Throwable
Parameters:
output - the stream to write to

printChildren

public static void printChildren(IStatus status,
                                 java.io.PrintStream output)

printChildren

public static void printChildren(IStatus status,
                                 java.io.PrintWriter output)

Elexis API documentation
Version 2.1.6 as of December 11 2011

Copyright 2005-2011 by Gerry Weirich, Elexis