org.aspectj.bridge
Class AbortException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by org.aspectj.bridge.AbortException
All Implemented Interfaces:
java.io.Serializable

public class AbortException
extends java.lang.RuntimeException

Signal that a process was aborted before completion. This may contain a structured IMessage which indicates why the process was aborted (e.g., the underlying exception). For processes using try/catch to complete a method abruptly but complete the process normally (e.g., a test failure causes the test to abort but the reporting and testing continues normally), use the static methods to borrow and return a "porter" to avoid the expense of constructing a stack trace each time. A porter stack trace is invalid, and it should only be used to convey a message. E.g., to print the stack of the AbortException and any contained message:

 catch (AbortException ae) {
     IMessage m = ae.getMessage();
     if (!ae.isPorter()) ae.printStackTrace(System.err);
     Throwable thrown = ae.getThrown();
     if (null != thrown) thrown.printStackTrace(System.err);
 }
 

See Also:
Serialized Form

Field Summary
protected  boolean isPorter
          true if this is a porter exception - only used to hold message
protected  IMessage message
          structured message abort
static java.lang.String NO_MESSAGE_TEXT
          used when message text is null
 
Constructor Summary
AbortException()
          abort with default String message
AbortException(IMessage message)
          abort with structured message
AbortException(java.lang.String s)
          abort with message
 
Method Summary
static AbortException borrowPorter(IMessage message)
          Get a porter exception from the pool.
 IMessage getIMessage()
           
 java.lang.String getMessage()
          Get message for this AbortException, either associated explicitly as message or implicitly as IMessage message or its thrown message.
 java.lang.Throwable getThrown()
           
 boolean isPorter()
          The stack trace of a porter is invalid; it is only used to carry a message (which may itself have a wrapped exception).
 boolean isSilent()
           
 void printStackTrace()
           
 void printStackTrace(java.io.PrintStream s)
          Print the stack trace of any enclosed thrown or this otherwise.
 void printStackTrace(java.io.PrintWriter s)
          Print the stack trace of any enclosed thrown or this otherwise.
static void returnPorter(AbortException porter)
          Return (or add) a porter exception to the pool.
 void setIsSilent(boolean isSilent)
           
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_MESSAGE_TEXT

public static final java.lang.String NO_MESSAGE_TEXT
used when message text is null

See Also:
Constant Field Values

message

protected IMessage message
structured message abort


isPorter

protected boolean isPorter
true if this is a porter exception - only used to hold message

Constructor Detail

AbortException

public AbortException()
abort with default String message


AbortException

public AbortException(java.lang.String s)
abort with message


AbortException

public AbortException(IMessage message)
abort with structured message

Method Detail

borrowPorter

public static AbortException borrowPorter(IMessage message)
Get a porter exception from the pool. Porter exceptions do not have valid stack traces. They are used only to avoid generating stack traces when using throw/catch to abruptly complete but continue.


returnPorter

public static void returnPorter(AbortException porter)
Return (or add) a porter exception to the pool.


getIMessage

public IMessage getIMessage()
Returns:
IMessage structured message, if set

isPorter

public boolean isPorter()
The stack trace of a porter is invalid; it is only used to carry a message (which may itself have a wrapped exception).

Returns:
true if this exception is only to carry exception

getThrown

public java.lang.Throwable getThrown()
Returns:
Throwable at bottom of IMessage chain, if any

getMessage

public java.lang.String getMessage()
Get message for this AbortException, either associated explicitly as message or implicitly as IMessage message or its thrown message.

Overrides:
getMessage in class java.lang.Throwable
See Also:
Throwable.getMessage()

printStackTrace

public void printStackTrace()
Overrides:
printStackTrace in class java.lang.Throwable
See Also:
Throwable.printStackTrace()

printStackTrace

public void printStackTrace(java.io.PrintStream s)
Print the stack trace of any enclosed thrown or this otherwise.

Overrides:
printStackTrace in class java.lang.Throwable
See Also:
Throwable.printStackTrace(PrintStream)

printStackTrace

public void printStackTrace(java.io.PrintWriter s)
Print the stack trace of any enclosed thrown or this otherwise.

Overrides:
printStackTrace in class java.lang.Throwable
See Also:
Throwable.printStackTrace(PrintWriter)

isSilent

public boolean isSilent()

setIsSilent

public void setIsSilent(boolean isSilent)