Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] Null-pointer checking for arguments

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Dmitry Katsubo <dma_k AT mail.ru>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: [XOM-interest] Null-pointer checking for arguments
  • Date: Tue, 23 Mar 2010 11:52:14 +0100

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




Archive powered by MHonArc 2.6.24.

Top of Page