cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Kulp (JIRA)" <>
Subject [jira] Commented: (CXF-1915) W3CDOMStreamReader returns wrong type in moveToChild()
Date Fri, 14 Nov 2008 20:49:44 GMT


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;
            throw new IllegalStateException("Found type: " + content.getClass().

It would be great if you could double check that that works.

> W3CDOMStreamReader returns wrong type in moveToChild()
> ------------------------------------------------------
>                 Key: CXF-1915
>                 URL:
>             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(
>         at org.apache.cxf.staxutils.DepthXMLStreamReader.getTextCharacters(
>         at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleCharacters(
>         at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(
>         at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(
>         at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(
>         at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(
>         ... 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
> 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.

View raw message