org.displaytag.exception
abstract public class: BaseNestableJspTagException [javadoc |
source]
java.lang.Object
java.lang.Throwable
java.lang.Exception
javax.servlet.jsp.JspException
javax.servlet.jsp.JspTagException
org.displaytag.exception.BaseNestableJspTagException
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
PdfGenerationException, ExportException, HssfGenerationException, ItextGenerationException, MissingAttributeException, ExcelGenerationException, DecoratorException, ObjectLookupException, TagStructureException, InvalidTagAttributeValueException, DecoratorInstantiationException
Base exception: extendes JspTagException providing logging and exception nesting functionalities.
- author:
Fabrizio
- Giustina
- version:
$
- Revision: 1081 $ ($Author: fgiust $)
Constructor: |
public BaseNestableJspTagException(Class source,
String message) {
super(message);
this.sourceClass = source;
// log exception
Log log = LogFactory.getLog(source);
// choose appropriate logging method
if (getSeverity() == SeverityEnum.DEBUG)
{
log.debug(toString());
}
else if (getSeverity() == SeverityEnum.INFO)
{
log.info(toString());
}
else if (getSeverity() == SeverityEnum.WARN)
{
log.warn(toString());
}
else
{
// error - default
log.error(toString());
}
}
Instantiate a new BaseNestableJspTagException. Parameters:
source - Class where the exception is generated
message - message
|
public BaseNestableJspTagException(Class source,
String message,
Throwable cause) {
super(message);
this.sourceClass = source;
this.nestedException = cause;
// log exception
Log log = LogFactory.getLog(source);
// choose appropriate logging method
if (getSeverity() == SeverityEnum.DEBUG)
{
log.debug(toString(), cause);
}
else if (getSeverity() == SeverityEnum.INFO)
{
log.info(toString(), cause);
}
else if (getSeverity() == SeverityEnum.WARN)
{
log.warn(toString(), cause);
}
else
{
// error - default
log.error(toString(), cause);
}
}
Instantiate a new BaseNestableJspTagException. Parameters:
source - Class where the exception is generated
message - message
cause - previous Exception
|
Methods from java.lang.Throwable: |
---|
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
Method from org.displaytag.exception.BaseNestableJspTagException Detail: |
public Throwable getCause() {
return this.nestedException;
}
returns the previous exception. |
abstract public SeverityEnum getSeverity()
subclasses need to define the getSeverity method to provide correct severity for logging. |
public String toString() {
String className = this.sourceClass.getName();
className = className.substring(className.lastIndexOf(".")); //$NON-NLS-1$
if (this.nestedException == null)
{
return Messages.getString("NestableException.msg", //$NON-NLS-1$
new Object[]{className, getMessage()});
}
return Messages.getString("NestableException.msgcause", //$NON-NLS-1$
new Object[]{className, getMessage(), this.nestedException.getMessage()});
}
basic toString. Returns the message plus the previous exception (if a previous exception exists). |