com.lowagie.text
public class: DocumentException [javadoc |
source]
java.lang.Object
java.lang.Throwable
java.lang.Exception
com.lowagie.text.DocumentException
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
PdfException, BadElementException, BadPdfFormatException
Signals that an error has occurred in a
Document.
| Methods from java.lang.Throwable: |
|---|
|
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
| Method from com.lowagie.text.DocumentException Detail: |
public String getLocalizedMessage() {
if (ex == null)
return super.getLocalizedMessage();
else
return ex.getLocalizedMessage();
}
and make sure we also produce a localized version |
public String getMessage() {
if (ex == null)
return super.getMessage();
else
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) {
if (ex == null)
super.printStackTrace(s);
else {
synchronized (s) {
s.print(split(getClass().getName()) + ": ");
ex.printStackTrace(s);
}
}
}
here we prefix, with s.print(), not s.println(), the stack
trace with "ExceptionConverter:" |
public void printStackTrace(PrintWriter s) {
if (ex == null)
super.printStackTrace(s);
else {
synchronized (s) {
s.print(split(getClass().getName()) + ": ");
ex.printStackTrace(s);
}
}
}
Again, we prefix the stack trace with "ExceptionConverter:" |
public String toString() {
if (ex == null)
return super.toString();
else
return split(getClass().getName()) + ": " + ex;
}
The toString() is changed to be prefixed with ExceptionConverter |