The ExceptionConverter changes a checked exception into an
unchecked exception.
| Method from com.lowagie.text.ExceptionConverter Detail: |
public Throwable fillInStackTrace() {
return this;
}
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 |
public Exception getException() {
return ex;
}
and allow the user of ExceptionConverter to get a handle to it. |
public String getLocalizedMessage() {
return ex.getLocalizedMessage();
}
and make sure we also produce a localized version |
public String getMessage() {
return ex.getMessage();
}
We print the message of the checked exception |
public void printStackTrace() {
printStackTrace(System.err);
}
we have to override this as well |
public void printStackTrace(PrintStream s) {
synchronized (s) {
s.print(prefix);
ex.printStackTrace(s);
}
}
here we prefix, with s.print(), not s.println(), the stack
trace with "ExceptionConverter:" |
public void printStackTrace(PrintWriter s) {
synchronized (s) {
s.print(prefix);
ex.printStackTrace(s);
}
}
Again, we prefix the stack trace with "ExceptionConverter:" |
public String toString() {
return prefix + ex;
}
The toString() is changed to be prefixed with ExceptionConverter |