Package uk.blankaspect.common.exception2
Class BaseException
java.lang.Object
java.lang.Throwable
java.lang.Exception
uk.blankaspect.common.exception2.BaseException
- All Implemented Interfaces:
 Serializable
- Direct Known Subclasses:
 LocationException
This class implements a base checked exception.
- See Also:
 
- 
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BaseExceptionAn empty exception that may be tested for identity. - 
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a new instance of an exception with no detail message.BaseException(String message, Object... replacements) Creates a new instance of an exception with the specified detail message.BaseException(String message, Throwable cause) Creates a new instance of an exception with the specified detail message and cause.BaseException(String message, Throwable cause, Object... replacements) Creates a new instance of an exception with the specified detail message and cause. - 
Method Summary
Modifier and TypeMethodDescriptionstatic StringcreateMessage(String message, Object... replacements) Creates a composite message from the specified message and replacement sequences, and returns the result.static voidthrowCause(Throwable exception) Tests the cause of the specified exception, and throws the causal exception if it is aBaseException.static voidthrowCause(Throwable exception, boolean traverse) Tests the cause of the specified exception, or, optionally, searches the causal chain of the specified exception, and, if aBaseExceptionis found, throws it.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString 
- 
Field Details
- 
EMPTY
An empty exception that may be tested for identity. 
 - 
 - 
Constructor Details
- 
BaseException
protected BaseException()Creates a new instance of an exception with no detail message. - 
BaseException
Creates a new instance of an exception with the specified detail message and cause.- Parameters:
 message- the detail message of the exception.cause- the underlying cause of the exception, which may benull.
 - 
BaseException
Creates a new instance of an exception with the specified detail message.- Parameters:
 message- the detail message of the exception.replacements- the items whose string representations will replace placeholders inmessage.
 - 
BaseException
Creates a new instance of an exception with the specified detail message and cause.- Parameters:
 message- the detail message of the exception.cause- the underlying cause of the exception, which may benull.replacements- the items whose string representations will replace placeholders inmessage.
 
 - 
 - 
Method Details
- 
createMessage
Creates a composite message from the specified message and replacement sequences, and returns the result.- Parameters:
 message- the base message.replacements- the items whose string representations will replace placeholders inmessage.- Returns:
 - the composite message that was created from 
messageandreplacements. 
 - 
throwCause
Tests the cause of the specified exception, and throws the causal exception if it is aBaseException.- Parameters:
 exception- the exception of interest.- Throws:
 BaseException- if the cause ofexceptionis aBaseException.
 - 
throwCause
Tests the cause of the specified exception, or, optionally, searches the causal chain of the specified exception, and, if aBaseExceptionis found, throws it.- Parameters:
 exception- the exception of interest.traverse- iftrue, the causal chain ofexceptionwill be searched for aBaseException; otherwise, only the immediate cause will be tested.- Throws:
 BaseException-- if 
traverseisfalseand the cause ofexceptionis aBaseException, or - if 
traverseistrueand aBaseExceptionis found in the causal chain ofexception. 
- if 
 
 
 -