Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-3034

StaxUtils.copy fails on pure DOM comment node

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 2.2.11
    • Core
    • None

    Description

      When StaxUtils.copy is used with an XMLStreamReader created from a DOM tree containing a comment node, it will fail with a NullPointerException:

      java.lang.NullPointerException
      at com.ctc.wstx.sw.BufferingXmlWriter.verifyCommentContent(BufferingXmlWriter.java:1467)
      at com.ctc.wstx.sw.BufferingXmlWriter.writeComment(BufferingXmlWriter.java:591)
      at com.ctc.wstx.sw.BaseStreamWriter.writeComment(BaseStreamWriter.java:513)
      at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:477)
      at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:452)

      Note that this only occurs with a pure DOM implementation, not with SAAJ. The reason is that in SAAJ, a comment node also implements org.w3c.dom.Text.

      A test case can be found in attachment. The issue occurs with current trunk (r1004461).

      Attachments

        1. StaxUtilsCopyTest.java
          0.6 kB
          Andreas Veithen

        Activity

          People

            dkulp Daniel Kulp
            veithen Andreas Veithen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: