Menu

#151 better exception reporting

open
nobody
5
2010-03-20
2010-03-20
Ximin Luo
No

for example, in edu.uci.ics.jung.io.GraphMLReader.java:246:

throw new IOException(saxe.getMessage());

should be replaced with

throw (new IOException(saxe.getMessage())).initCause(saxe);

so that the stack trace of `saxe` is not lost.

This should also be applied for any other place in the source code which wraps a low-level exception in a higher-level exception. See http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Throwable.html and the section on "chained exception"s. Ideally one would use a SpecificException(Throwable cause) constructor, but IOException does not provide such a constructor (most other exceptions do, however).

Discussion


Log in to post a comment.

MongoDB Logo MongoDB