|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface CoreException
Interface defines the core exception features. It is required to have a common type for the checked and runtime exception types.
Method Summary | |
---|---|
Throwable |
getCause() Returns the cause of this throwable or null if the cause is nonexistent or unknown. |
Code |
getCode() Returns the error or exception code of the exception. |
ExceptionId<?> |
getId() Returns the unique identifier of the exception. |
String |
getLocalizedMessage() Creates a localized description of this throwable. |
String |
getMessage() Returns the detail message string of this throwable. |
StackTraceElement[] |
getStackTrace() Provides programmatic access to the stack trace information printed by Throwable.printStackTrace() . |
Date |
getTime() Returns the time the exception has been raised. |
void |
setStackTrace(StackTraceElement[] stackTrace) Sets the stack trace elements that will be returned by Throwable.getStackTrace() and printed by Throwable.printStackTrace() and related methods. |
void |
truncateCause() Truncates the cause from the exception dependent on the ThrowableHandleMode set to the thread-local context. |
Method Detail |
---|
ExceptionId<?> getId()
This identifier must never be null
.
Code getCode()
This code must never be null
.
Date getTime()
Throwable getCause()
null
if the cause is nonexistent or unknown. (The cause is the throwable that caused this throwable to get thrown.)
This implementation returns the cause that was supplied via one of the constructors requiring a Throwable. While it is typically unnecessary to override this method, a subclass can override it to return a cause set by some other means. This is appropriate for a "legacy chained throwable" that predates the addition of chained exceptions to Throwable. Note that it is not necessary to override any of the PrintStackTrace methods, all of which invoke the getCause method to determine the cause of a throwable.
null
if the cause is nonexistent or unknown.
StackTraceElement[] getStackTrace()
Throwable.printStackTrace()
. Returns an array of stack trace elements, each representing one stack frame. The zeroth element of the array (assuming the array's length is non-zero) represents the top of the stack, which is the last method invocation in the sequence. Typically, this is the point at which this throwable was created and thrown. The last element of the array (assuming the array's length is non-zero) represents the bottom of the stack, which is the first method invocation in the sequence.
Some virtual machines may, under some circumstances, omit one or more stack frames from the stack trace. In the extreme case, a virtual machine that has no stack trace information concerning this throwable is permitted to return a zero-length array from this method. Generally speaking, the array returned by this method will contain one element for every frame that would be printed by printStackTrace.
void setStackTrace(StackTraceElement[] stackTrace) throws NullPointerException
Throwable.getStackTrace()
and printed by
Throwable.printStackTrace()
and related methods. This method, which is designed for use by RPC frameworks and other advanced systems, allows the client to override the default stack trace that is either generated by
Throwable.fillInStackTrace()
when a throwable is constructed or deserialized when a throwable is read from a serialization stream.
stackTrace
- the stack trace elements to be associated with this
Throwable
. The specified array is copied by this call; changes in the specified array after the method invocation returns will have no affect on this
Throwable
's stack trace.
NullPointerException
- if
stackTrace
is
null
, or if any of the elements of
stackTrace
are
null
String getMessage()
String getLocalizedMessage()
getMessage()
.
void truncateCause()
ThrowableHandleMode
set to the thread-local context. After running this method the cause will be truncate and the full stack trace will no longer be available.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |