Java XML SAXParser throws NullPointerException on method .parse(InputSource,XMLCommandsHandler)
I get a very misterious NullPointerException when parsing a stream comming from a socket with jdk's javax.xml.parsers.SAXParser.
My InputSource is a RecordingInputStream that I created by extending FilterInputStream in order to be able to record in a log file all the data that I receive on the socket before it goes down to the parser. By using this way I can now see, that the NullPointerException is thrown specifically when the following tag appears in the stream:
<order act="D" order_id="16508679" scn="147185767940" reason="DELETE_ORDR" who_id="90296"/>
Otherwise the parsing of the stream is working okay. All other XML tags that frequently comes, get parsed开发者_开发知识库 successfuly (no exceptions are thrown), and corresponding XMLCommandsHandler's methods do get invoked correctly.
Please, any clue why this NullPointerException appears? Otherwise I'm facing the alternative to curse all ready-written XML stream parsers, and write my own simple parser. Tired of exploring other software's bugs, or poor design :(
You might want to try Xerces or Saxon.
I found the error. Sorry I forgot to post my answer back then I was realy overwhelmed with work. I remember now, and I answer it now. It was a nullpointer exception in my code. Code that the XMLCommandsHandler is calling. Of course it had nothing to do with the SAX parser.
My appologies.
精彩评论