de.smartics.exceptions
Interface CoreException

Package class diagram package CoreException
All Known Subinterfaces:
LocalizedException
All Known Implementing Classes:
AbstractCoreException, AbstractCoreRuntimeException, AbstractLocalizedException, AbstractLocalizedRuntimeException, ConfigurationException, MethodAccessConfigurationException, ParseException, PropertyAccessConfigurationException

public interface CoreException

Interface defines the core exception features. It is required to have a common type for the checked and runtime exception types.

Author:
Robert Reiner

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

getId

ExceptionId<?> getId()
Returns the unique identifier of the exception. The identifier is used to track an exception in different tiers.

This identifier must never be null.

Returns:
the unique identifier of the exception.

getCode

Code getCode()
Returns the error or exception code of the exception.

This code must never be null.

Returns:
the error or exception code of the exception.

getTime

Date getTime()
Returns the time the exception has been raised. The time instance is created and stored as soon as the exception is constructed.

Returns:
the time the exception has been raised.

getCause

Throwable getCause()
Returns the cause of this throwable or 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.

Returns:
the cause of this throwable or null if the cause is nonexistent or unknown.

getStackTrace

StackTraceElement[] getStackTrace()
Provides programmatic access to the stack trace information printed by 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.

Returns:
an array of stack trace elements representing the stack trace pertaining to this throwable.

setStackTrace

void setStackTrace(StackTraceElement[] stackTrace)
                   throws NullPointerException
Sets the stack trace elements that will be returned by 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.

Parameters:
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.
Throws:
NullPointerException - if stackTrace is null , or if any of the elements of stackTrace are null

getMessage

String getMessage()
Returns the detail message string of this throwable.

Returns:
the detail message string of this Throwable instance (which may be null).

getLocalizedMessage

String getLocalizedMessage()
Creates a localized description of this throwable. Subclasses may override this method in order to produce a locale-specific message. For subclasses that do not override this method, the default implementation returns the same result as getMessage().

Returns:
The localized description of this throwable.

truncateCause

void truncateCause()
Truncates the cause from the exception dependent on the 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.



Copyright © 2007-null Kronseder & Reiner GmbH - smartics. All Rights Reserved.