Retrofitting exception link mechanism of JAXBException #41
Description
Since JAXB 2.0 is going to require J2SE 5.0, we should take this opportunity to
retrofit JAXBException's exception chaining mechanism into that of JDK 1.4.
Today, JAXBException has its own mechanism to link to another (wrapped) exception,
and it has its own code to print the information about this linked exception
in its printStackTrace method.
Starting from JDK 1.4, java.lang.Throwable has this exact feature. We can take
advantage of this by tweaking JAXBException.
The change would allow the stack trace to be printed in the same way as the rest
of exceptions. The printing method in JDK is also smarter than the one in
JAXBException.
When making this change, we have to be careful not to break the compatibility.
Fortunately, many of the core JDK exceptions
(such as java.lang.InvocationTargetException) went through this retrofitting
process, so we know how to do it right.
Environment
Operating System: All
Platform: All
Affected Versions
[2.0 v0.4]