// in some SAX event handler:
try {
... application specific stuff ...
} catch (MyApplicationException cause) {
throw new SAXException ("it broke!", cause);
// or better yet: throw new SAXParseException
// ("broke", locator, cause)
}
If you print the stack backtrace of such a SAXException,
you'll see two stacks, starting with the root cause.
Being able to see that root cause information
can be a real lifesaver when debugging.
And some application error recovery strategies will use the
SAXException.getException() method
to find the root cause and then determine how to recover from it.
For example, if the application exception identified some
resource that was unavailable, higher levels in the
application might be able to use that information to
choose an alternative resource and restart processing.