org.jdiagnose.message
Class ExceptionMessageFactory
java.lang.Object
org.jdiagnose.message.ExceptionMessageFactory
- All Implemented Interfaces:
- MessageFactory
- public class ExceptionMessageFactory
- extends java.lang.Object
- implements MessageFactory
Creates diagnostic messages from exceptions. The exception message
is used as the summary and the stacktrace as the body. Will use the
root exception by default and can optionally suppress the stack trace.
Uses reflection to find the root cause so that it can be backwards
compatible with Java 1.3
- Author:
- jmccrindle
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_EXCEPTION_MESSAGE_FACTORY
public static final ExceptionMessageFactory DEFAULT_EXCEPTION_MESSAGE_FACTORY
ExceptionMessageFactory
public ExceptionMessageFactory(boolean suppressStackTrace,
boolean rootExceptionOnly)
- Parameters:
suppressStackTrace
- whether the stackTrace should be used for the
message bodyrootExceptionOnly
- whether the root exception should be used or the
whole exception.
ExceptionMessageFactory
public ExceptionMessageFactory()
- Default Constructor
getRootCause
protected java.lang.Throwable getRootCause(java.lang.Throwable t)
- Finds the root cause given an exception. Uses reflection to make it
compatible with Java 1.3
- Parameters:
t
-
- Returns:
getMessage
public DiagnosticMessage getMessage(java.lang.Object object)
- Specified by:
getMessage
in interface MessageFactory
- See Also:
MessageFactory.getMessage(java.lang.Object)
setRootExceptionOnly
public void setRootExceptionOnly(boolean rootExceptionOnly)
- Parameters:
rootExceptionOnly
- whether the root exception should be used or the
whole exception.
setSuppressStackTrace
public void setSuppressStackTrace(boolean suppressStackTrace)
- Parameters:
suppressStackTrace
- whether the stackTrace should be used for the
message body
Copyright © 2004-2005 Grape Design Limited. All Rights Reserved.