com.lowagie.text

Class ExceptionConverter

public class ExceptionConverter extends RuntimeException

The ExceptionConverter changes a checked exception into an unchecked exception.
Field Summary
Exceptionex
we keep a handle to the wrapped exception
Stringprefix
prefix for the exception
static longserialVersionUID
Constructor Summary
ExceptionConverter(Exception ex)
Construct a RuntimeException based on another Exception
Method Summary
ThrowablefillInStackTrace()
requests to fill in the stack trace we will have to ignore.
ExceptiongetException()
and allow the user of ExceptionConverter to get a handle to it.
StringgetLocalizedMessage()
and make sure we also produce a localized version
StringgetMessage()
We print the message of the checked exception
voidprintStackTrace()
we have to override this as well
voidprintStackTrace(PrintStream s)
here we prefix, with s.print(), not s.println(), the stack trace with "ExceptionConverter:"
voidprintStackTrace(PrintWriter s)
Again, we prefix the stack trace with "ExceptionConverter:"
StringtoString()
The toString() is changed to be prefixed with ExceptionConverter

Field Detail

ex

private Exception ex
we keep a handle to the wrapped exception

prefix

private String prefix
prefix for the exception

serialVersionUID

private static final long serialVersionUID

Constructor Detail

ExceptionConverter

public ExceptionConverter(Exception ex)
Construct a RuntimeException based on another Exception

Parameters: ex the exception that has to be turned into a RuntimeException

Method Detail

fillInStackTrace

public Throwable fillInStackTrace()
requests to fill in the stack trace we will have to ignore. We can't throw an exception here, because this method is called by the constructor of Throwable

Returns: a Throwable

getException

public Exception getException()
and allow the user of ExceptionConverter to get a handle to it.

Returns: the original exception

getLocalizedMessage

public String getLocalizedMessage()
and make sure we also produce a localized version

Returns: localized version of the message

getMessage

public String getMessage()
We print the message of the checked exception

Returns: message of the original exception

printStackTrace

public void printStackTrace()
we have to override this as well

printStackTrace

public void printStackTrace(PrintStream s)
here we prefix, with s.print(), not s.println(), the stack trace with "ExceptionConverter:"

Parameters: s

printStackTrace

public void printStackTrace(PrintWriter s)
Again, we prefix the stack trace with "ExceptionConverter:"

Parameters: s

toString

public String toString()
The toString() is changed to be prefixed with ExceptionConverter

Returns: Stringversion of the exception