Thursday, March 4, 2010

Weird Java SAX XML Parsing Error

One of our customers reported some erroneous data output by our command-line client. After about a day's worth of tracing code, I traced the bad data to the default implementation of SAXParser in Sun's Java 6 JRE.

We use Apache XML-RPC as an XMLRPC client, and it just calls out to SAXParserFactory.newInstance() to grab a SAX implementation. Java 5 and 6 both offer default implementations, but the error only appears in Java 6 JREs. In my debugging, I can see the JRE6 implementation passing in obviously bad data to the ContentHandler.characters() method in the Apache XMLRPC implementation.

Thankfully, if you drop in a replacement SAX parser, Sun's implementation will call out to it, so fixing the error was as easy as dropping in Apache Xerces.

The thing is, I'd like to track down the issue so I can make a proper bug report. I haven't been able to find any similar bug reports via googling or directly searching Sun's bug database.

The bad data is coming from "com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser", so it looks like it's a(n older) version of Xerces, but after about 15 minutes of searching I still hadn't found the correct version of source code to attach to my debugger. If anyone has suggestions let me know, but otherwise I think I'm going to give up searching for the root cause of the issue.

No comments:

Post a Comment