Package org.aspectj.bridge
Class AbortException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.aspectj.bridge.AbortException
- All Implemented Interfaces:
Serializable
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); }
- Author:
- PARC, Andy Clement
- See Also:
- Serialized Form
-
Field Summary
-
Constructor Summary
ConstructorDescriptionabort with default String messageAbortException(String s)
abort with messageAbortException(IMessage message)
abort with structured message -
Method Summary
Modifier and TypeMethodDescriptionstatic AbortException
borrowPorter(IMessage message)
Get a porter exception from the pool.Get message for this AbortException, either associated explicitly as message or implicitly as IMessage message or its thrown message.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
void
Print the stack trace of any enclosed thrown or this otherwise.void
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
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, setStackTrace, toString
-
Field Details
-
NO_MESSAGE_TEXT
used when message text is null- See Also:
- Constant Field Values
-
message
structured message abort -
isPorter
protected boolean isPortertrue if this is a porter exception - only used to hold message
-
-
Constructor Details
-
AbortException
public AbortException()abort with default String message -
AbortException
abort with message -
AbortException
abort with structured message
-
-
Method Details
-
borrowPorter
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
Return (or add) a porter exception to the pool. -
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
- Returns:
- Throwable at bottom of IMessage chain, if any
-
getMessage
Get message for this AbortException, either associated explicitly as message or implicitly as IMessage message or its thrown message.- Overrides:
getMessage
in classThrowable
- See Also:
Throwable.getMessage()
-
printStackTrace
public void printStackTrace()- Overrides:
printStackTrace
in classThrowable
- See Also:
Throwable.printStackTrace()
-
printStackTrace
Print the stack trace of any enclosed thrown or this otherwise.- Overrides:
printStackTrace
in classThrowable
- See Also:
Throwable.printStackTrace(PrintStream)
-
printStackTrace
Print the stack trace of any enclosed thrown or this otherwise.- Overrides:
printStackTrace
in classThrowable
- See Also:
Throwable.printStackTrace(PrintWriter)
-
isSilent
public boolean isSilent() -
setIsSilent
public void setIsSilent(boolean isSilent)
-