Project

Profile

Help

Bug #1814

closed

Got NPE when tranfroming the SAXSource which is created from DOM2SAX

Added by Willem Jiang over 11 years ago. Updated over 11 years ago.

Status:
Won't fix
Priority:
Normal
Assignee:
Category:
DOM Interface
Sprint/Milestone:
-
Start date:
2013-06-19
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

If you run the DOMSAXTest from the test case, you will get the stack trace.

ava.lang.NullPointerException

at net.sf.saxon.tree.tiny.TinyBuilder.startElement(TinyBuilder.java:245)

at net.sf.saxon.event.ReceivingContentHandler.startElement(ReceivingContentHandler.java:292)

at org.apache.xalan.xsltc.trax.DOM2SAX.parse(DOM2SAX.java:285)

at org.apache.xalan.xsltc.trax.DOM2SAX.parse(DOM2SAX.java:149)

at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:396)

at net.sf.saxon.event.Sender.send(Sender.java:143)

at net.sf.saxon.Controller.transform(Controller.java:1890)

at com.example.esb.DOMSAXTest.main(DOMSAXTest.java:65)

Files

saxon-bug.tgz (8.39 KB) saxon-bug.tgz Willem Jiang, 2013-06-19 11:42
Actions #1

Updated by Michael Kay over 11 years ago

  • Category set to DOM Interface
  • Status changed from New to Won't fix
  • Assignee set to Michael Kay

Looking at the xsltc source code here:

http://grepcode.com/file/repository.springsource.com/org.apache.xalan/com.springsource.org.apache.xalan/2.7.1/org/apache/xalan/xsltc/trax/DOM2SAX.java

it appears that when you create a DOM2SAX object that wraps an Element node (as distinct from a document node), the resulting XMLReader will issue a stream of SAX events that starts with a startElement() event rather than a startDocument(). I would argue that that's contrary to the SAX specification, but whether or not you agree, a SAXSource supplied to Saxon needs to start with a startDocument() event, so this usage isn't going to work.

Please register to edit this issue

Also available in: Atom PDF