Discussion:
Small code Suggestion
Ben Blamey
2013-07-25 12:55:22 UTC
Permalink
Hi,

Cracking library folks! I have a tiny code suggestion:

In the class: com.thoughtworks.xstream.io.xml.AbstractXppDriver I noticed
that exceptions are being caught without the inner exception being set,
i.e.:

try { ... } catch (XmlPullParserException e) {
throw new StreamException("Cannot create XmlPullParser");
}

Rather than:

try { ... } catch (XmlPullParserException e) {
throw new StreamException("Cannot create XmlPullParser", e);
}

I don't know about everyone else, but I find inner exceptions very useful
when debugging. There are 3 exceptions thrown in that class that discard
the information from the underlying cause. I haven't poked around elsewhere.

All the best,
Ben

Loading...