Discussion:
[XOM-interest] Null-pointer checking for arguments
Dmitry Katsubo
2010-03-23 10:52:14 UTC
Permalink
Dear XOM developers!

First of all, thank you for your contribution into XOM development. It
looks nice, and in general I like this library.

Builder.build() is passed a null InputStream, I've got the exception,
which is difficult to understand, because xerces (in case InputStream is
null) tries to discover all other ways to load the resource:

java.net.MalformedURLException
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at
com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDocumentEntity(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.setInputSource(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.DTDConfiguration.parse(Unknown Source)
at
com.sun.org.apache.xerces.internal.parsers.DTDConfiguration.parse(Unknown Source)
at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown
Source)
at nu.xom.Builder.build(Builder.java:1127)
at nu.xom.Builder.build(Builder.java:586)

I think, to avoid such cases, null-pointer checks should be added to
Builder method implementations. Then the error can be reported at early
stage just by throwing NullPointerException.
--
With best regards,
Dmitry
Elliotte Rusty Harold
2010-03-23 11:28:06 UTC
Permalink
Post by Dmitry Katsubo
Dear XOM developers!
First of all, thank you for your contribution into XOM development. It
looks nice, and in general I like this library.
Builder.build() is passed a null InputStream, I've got the exception,
which is difficult to understand, because xerces (in case InputStream is
Sounds like a good idea. Let me look into it. Ping me in a month or so
if you don't hear anything, or you could file a bug at java.net.
--
Elliotte Rusty Harold
elharo at ibiblio.org
Elliotte Rusty Harold
2010-04-03 11:18:28 UTC
Permalink
Post by Dmitry Katsubo
Dear XOM developers!
First of all, thank you for your contribution into XOM development. It
looks nice, and in general I like this library.
Builder.build() is passed a null InputStream, I've got the exception,
which is difficult to understand, because xerces (in case InputStream is
Actually that's what happens when build is passed a null reader, not a
null InputStream.
--
Elliotte Rusty Harold
elharo at ibiblio.org
Elliotte Rusty Harold
2010-04-03 11:22:45 UTC
Permalink
I've checked a fix into head. It will be in the next release whenever
that is. I probably won't bother with a release just for this, but I
do need to make some more modifications to the maven rules.
--
Elliotte Rusty Harold
elharo at ibiblio.org
Loading...