You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Marc Giger (JIRA)" <ji...@apache.org> on 2008/11/14 14:44:44 UTC
[jira] Created: (CXF-1915) W3CDOMStreamReader returns wrong type in
moveToChild()
W3CDOMStreamReader returns wrong type in moveToChild()
------------------------------------------------------
Key: CXF-1915
URL: https://issues.apache.org/jira/browse/CXF-1915
Project: CXF
Issue Type: Bug
Components: Core
Affects Versions: 2.0.9
Environment: jdk 1.5 / 1.6
Reporter: Marc Giger
I hit a special case under the following conditions:
- WSS enabled so that the W3CDOMStreamReader is called.
- A Document where directly after an element a xml-comment follows (int my case directly after the root element):
<rootElement><!-- some comment --><nextChildElement>
In this case where no TextNode or something other is between, I got the following NPE:
Caused by: java.lang.NullPointerException
at org.apache.cxf.staxutils.W3CDOMStreamReader.getTextCharacters(W3CDOMStreamReader.java:289)
at org.apache.cxf.staxutils.DepthXMLStreamReader.getTextCharacters(DepthXMLStreamReader.java:159)
at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleCharacters(StAXStreamConnector.java:282)
at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:146)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:332)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:311)
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:578)
... 53 more
Attached is a patch which corrects 1) the order and 2) returns correctly the comment type if the current content is a comment
node. The order is very imortant as e.g the com.sun.xml.messaging.saaj.soap.impl.CommentImpl implements javax.xml.soap.Text
where javax.xml.soap.Text implements org.w3c.dom.Text and so it must be checked before org.w3c.dom.Text
This bug has its root in the xfire stack. An xfire based project from us is also affected.
I think the reason why this wasn't detected until now is, that most users use a binding framework. Binding framworks
normally don't marshall comments if nothing special is configured.
Thanks
Marc
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (CXF-1915) W3CDOMStreamReader returns wrong type
in moveToChild()
Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-1915?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Daniel Kulp resolved CXF-1915.
------------------------------
Resolution: Fixed
Fix Version/s: 2.1.4
2.0.10
Assignee: Daniel Kulp
> W3CDOMStreamReader returns wrong type in moveToChild()
> ------------------------------------------------------
>
> Key: CXF-1915
> URL: https://issues.apache.org/jira/browse/CXF-1915
> Project: CXF
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.0.9
> Environment: jdk 1.5 / 1.6
> Reporter: Marc Giger
> Assignee: Daniel Kulp
> Fix For: 2.0.10, 2.1.4
>
> Attachments: W3CDOMStreamReader-commentReading-fix.patch
>
>
> I hit a special case under the following conditions:
> - WSS enabled so that the W3CDOMStreamReader is called.
> - A Document where directly after an element a xml-comment follows (int my case directly after the root element):
> <rootElement><!-- some comment --><nextChildElement>
> In this case where no TextNode or something other is between, I got the following NPE:
> Caused by: java.lang.NullPointerException
> at org.apache.cxf.staxutils.W3CDOMStreamReader.getTextCharacters(W3CDOMStreamReader.java:289)
> at org.apache.cxf.staxutils.DepthXMLStreamReader.getTextCharacters(DepthXMLStreamReader.java:159)
> at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleCharacters(StAXStreamConnector.java:282)
> at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:146)
> at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:332)
> at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:311)
> at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:578)
> ... 53 more
> Attached is a patch which corrects 1) the order and 2) returns correctly the comment type if the current content is a comment
> node. The order is very imortant as e.g the com.sun.xml.messaging.saaj.soap.impl.CommentImpl implements javax.xml.soap.Text
> where javax.xml.soap.Text implements org.w3c.dom.Text and so it must be checked before org.w3c.dom.Text
> This bug has its root in the xfire stack. An xfire based project from us is also affected.
> I think the reason why this wasn't detected until now is, that most users use a binding framework. Binding framworks
> normally don't marshall comments if nothing special is configured.
> Thanks
> Marc
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CXF-1915) W3CDOMStreamReader returns wrong type
in moveToChild()
Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-1915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12647719#action_12647719 ]
Daniel Kulp commented on CXF-1915:
----------------------------------
I actually think this is already fixed on trunk. (not merged to 2.0.x yet. I'll do that in a moment.)
Basically, the code was changed to a switch on the "node.getType()" call which is also faster as it avoids all the casting that is problematic anyway.
switch (content.getNodeType()) {
case Node.ELEMENT_NODE:
return START_ELEMENT;
case Node.TEXT_NODE:
return CHARACTERS;
case Node.COMMENT_NODE:
return COMMENT;
case Node.CDATA_SECTION_NODE:
return CDATA;
case Node.ENTITY_REFERENCE_NODE:
return ENTITY_REFERENCE;
default:
throw new IllegalStateException("Found type: " + content.getClass().
getName());
}
It would be great if you could double check that that works.
> W3CDOMStreamReader returns wrong type in moveToChild()
> ------------------------------------------------------
>
> Key: CXF-1915
> URL: https://issues.apache.org/jira/browse/CXF-1915
> Project: CXF
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.0.9
> Environment: jdk 1.5 / 1.6
> Reporter: Marc Giger
> Attachments: W3CDOMStreamReader-commentReading-fix.patch
>
>
> I hit a special case under the following conditions:
> - WSS enabled so that the W3CDOMStreamReader is called.
> - A Document where directly after an element a xml-comment follows (int my case directly after the root element):
> <rootElement><!-- some comment --><nextChildElement>
> In this case where no TextNode or something other is between, I got the following NPE:
> Caused by: java.lang.NullPointerException
> at org.apache.cxf.staxutils.W3CDOMStreamReader.getTextCharacters(W3CDOMStreamReader.java:289)
> at org.apache.cxf.staxutils.DepthXMLStreamReader.getTextCharacters(DepthXMLStreamReader.java:159)
> at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleCharacters(StAXStreamConnector.java:282)
> at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:146)
> at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:332)
> at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:311)
> at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:578)
> ... 53 more
> Attached is a patch which corrects 1) the order and 2) returns correctly the comment type if the current content is a comment
> node. The order is very imortant as e.g the com.sun.xml.messaging.saaj.soap.impl.CommentImpl implements javax.xml.soap.Text
> where javax.xml.soap.Text implements org.w3c.dom.Text and so it must be checked before org.w3c.dom.Text
> This bug has its root in the xfire stack. An xfire based project from us is also affected.
> I think the reason why this wasn't detected until now is, that most users use a binding framework. Binding framworks
> normally don't marshall comments if nothing special is configured.
> Thanks
> Marc
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (CXF-1915) W3CDOMStreamReader returns wrong type in
moveToChild()
Posted by "Marc Giger (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-1915?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Marc Giger updated CXF-1915:
----------------------------
Attachment: W3CDOMStreamReader-commentReading-fix.patch
> W3CDOMStreamReader returns wrong type in moveToChild()
> ------------------------------------------------------
>
> Key: CXF-1915
> URL: https://issues.apache.org/jira/browse/CXF-1915
> Project: CXF
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.0.9
> Environment: jdk 1.5 / 1.6
> Reporter: Marc Giger
> Attachments: W3CDOMStreamReader-commentReading-fix.patch
>
>
> I hit a special case under the following conditions:
> - WSS enabled so that the W3CDOMStreamReader is called.
> - A Document where directly after an element a xml-comment follows (int my case directly after the root element):
> <rootElement><!-- some comment --><nextChildElement>
> In this case where no TextNode or something other is between, I got the following NPE:
> Caused by: java.lang.NullPointerException
> at org.apache.cxf.staxutils.W3CDOMStreamReader.getTextCharacters(W3CDOMStreamReader.java:289)
> at org.apache.cxf.staxutils.DepthXMLStreamReader.getTextCharacters(DepthXMLStreamReader.java:159)
> at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleCharacters(StAXStreamConnector.java:282)
> at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:146)
> at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:332)
> at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:311)
> at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:578)
> ... 53 more
> Attached is a patch which corrects 1) the order and 2) returns correctly the comment type if the current content is a comment
> node. The order is very imortant as e.g the com.sun.xml.messaging.saaj.soap.impl.CommentImpl implements javax.xml.soap.Text
> where javax.xml.soap.Text implements org.w3c.dom.Text and so it must be checked before org.w3c.dom.Text
> This bug has its root in the xfire stack. An xfire based project from us is also affected.
> I think the reason why this wasn't detected until now is, that most users use a binding framework. Binding framworks
> normally don't marshall comments if nothing special is configured.
> Thanks
> Marc
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.