You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2010/10/05 19:32:11 UTC

svn commit: r1004730 - in /cxf/branches/2.2.x-fixes: ./ common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java common/common/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java

Author: dkulp
Date: Tue Oct  5 17:32:11 2010
New Revision: 1004730

URL: http://svn.apache.org/viewvc?rev=1004730&view=rev
Log:
Merged revisions 1004725 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1004725 | dkulp | 2010-10-05 13:23:58 -0400 (Tue, 05 Oct 2010) | 1 line
  
  [CXF-3034] Fix issue with StaxUtils and DOMs with comments
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java
    cxf/branches/2.2.x-fixes/common/common/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java

Propchange: cxf/branches/2.2.x-fixes/
            ('svn:mergeinfo' removed)

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java?rev=1004730&r1=1004729&r2=1004730&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java (original)
+++ cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java Tue Oct  5 17:32:11 2010
@@ -27,6 +27,7 @@ import javax.xml.stream.XMLStreamExcepti
 
 import org.w3c.dom.Attr;
 
+import org.w3c.dom.Comment;
 import org.w3c.dom.Document;
 import org.w3c.dom.DocumentFragment;
 import org.w3c.dom.Element;
@@ -330,6 +331,8 @@ public class W3CDOMStreamReader extends 
     public String getText() {
         if (content instanceof Text) {
             return ((Text)content).getData();
+        } else if (content instanceof Comment) {
+            return ((Comment)content).getData();
         }
         return DOMUtils.getRawContent(getCurrentNode());
     }

Modified: cxf/branches/2.2.x-fixes/common/common/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/common/common/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java?rev=1004730&r1=1004729&r2=1004730&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/common/common/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java (original)
+++ cxf/branches/2.2.x-fixes/common/common/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java Tue Oct  5 17:32:11 2010
@@ -50,7 +50,15 @@ public class StaxUtilsTest extends Asser
     private InputStream getTestStream(String resource) {
         return getClass().getResourceAsStream(resource);
     }
-
+    @Test
+    public void testCommentNode() throws Exception {
+        //CXF-3034
+        Document document = DocumentBuilderFactory.newInstance()
+            .newDocumentBuilder().newDocument();
+        Element root = document.createElementNS("urn:test", "root");
+        root.appendChild(document.createComment("test comment"));
+        StaxUtils.copy(StaxUtils.createXMLStreamReader(root), StaxUtils.createXMLStreamWriter(System.out));
+    }
     @Test
     public void testToNextElement() {
         String soapMessage = "./resources/sayHiRpcLiteralReq.xml";