Author: dkulp
Date: Fri Jan 17 17:03:59 2014
New Revision: 1559186

URL: http://svn.apache.org/r1559186
Log:
Merged revisions 1559173 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1559173 | dkulp | 2014-01-17 11:33:46 -0500 (Fri, 17 Jan 2014) | 2 lines

  [CXF-5493] DOMUtils isn't handling CDATASections when grabbing text content

........

Added:
    
cxf/branches/2.7.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/cxf5493.xml
   (with props)
Modified:
    
cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/helpers/DOMUtils.java
    
cxf/branches/2.7.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/SoapFaultSerializerTest.java

Modified: 
cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/helpers/DOMUtils.java
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/helpers/DOMUtils.java?rev=1559186&r1=1559185&r2=1559186&view=diff
==============================================================================
--- 
cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/helpers/DOMUtils.java 
(original)
+++ 
cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/helpers/DOMUtils.java 
Fri Jan 17 17:03:59 2014
@@ -161,7 +161,7 @@ public final class DOMUtils {
         String s = null;
         Node n1 = n.getFirstChild();
         while (n1 != null) {
-            if (n1.getNodeType() == Node.TEXT_NODE) {
+            if (n1.getNodeType() == Node.TEXT_NODE || n1.getNodeType() == 
Node.CDATA_SECTION_NODE) {
                 if (b != null) {
                     b.append(((Text)n1).getNodeValue());
                 } else if (s == null) {

Modified: 
cxf/branches/2.7.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/SoapFaultSerializerTest.java
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/SoapFaultSerializerTest.java?rev=1559186&r1=1559185&r2=1559186&view=diff
==============================================================================
--- 
cxf/branches/2.7.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/SoapFaultSerializerTest.java
 (original)
+++ 
cxf/branches/2.7.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/SoapFaultSerializerTest.java
 Fri Jan 17 17:03:59 2014
@@ -315,4 +315,48 @@ public class SoapFaultSerializerTest ext
         assertEquals(new QName("http://schemas.xmlsoap.org/ws/2005/02/trust";, 
"FailedAuthentication"), 
              fault2.getSubCode());
     }
+    
+    
+    @Test
+    public void testCXF5493() throws Exception {
+
+        SoapMessage m = new SoapMessage(new MessageImpl());
+        m.setVersion(Soap11.getInstance());        
+
+
+        XMLStreamReader reader = 
StaxUtils.createXMLStreamReader(this.getClass()
+                                                                 
.getResourceAsStream("cxf5493.xml"));
+        m.setContent(XMLStreamReader.class, reader);
+        reader.nextTag(); //env
+        reader.nextTag(); //body
+        reader.nextTag(); //fault
+
+        Soap11FaultInInterceptor inInterceptor = new 
Soap11FaultInInterceptor();
+        inInterceptor.handleMessage(m);
+
+        SoapFault fault2 = (SoapFault)m.getContent(Exception.class);
+        assertNotNull(fault2);
+        assertEquals(Soap11.getInstance().getReceiver(), 
fault2.getFaultCode());
+        assertEquals("some text containing a xml tag <xml-tag>", 
fault2.getMessage());
+        
+        
+        
+        m = new SoapMessage(new MessageImpl());
+        m.put(Message.HTTP_REQUEST_METHOD, "POST");
+        m.setVersion(Soap11.getInstance());        
+        reader = 
StaxUtils.createXMLStreamReader(this.getClass().getResourceAsStream("cxf5493.xml"));
+
+        m.setContent(XMLStreamReader.class, reader);
+
+        new SAAJPreInInterceptor().handleMessage(m);
+        new ReadHeadersInterceptor(null).handleMessage(m);
+        new StartBodyInterceptor().handleMessage(m);
+        new SAAJInInterceptor().handleMessage(m);
+        new Soap11FaultInInterceptor().handleMessage(m);
+
+        fault2 = (SoapFault)m.getContent(Exception.class);
+        assertNotNull(fault2);
+        assertEquals(Soap11.getInstance().getReceiver(), 
fault2.getFaultCode());
+        assertEquals("some text containing a xml tag <xml-tag>", 
fault2.getMessage());
+    }
 }

Added: 
cxf/branches/2.7.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/cxf5493.xml
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/cxf5493.xml?rev=1559186&view=auto
==============================================================================
--- 
cxf/branches/2.7.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/cxf5493.xml
 (added)
+++ 
cxf/branches/2.7.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/cxf5493.xml
 Fri Jan 17 17:03:59 2014
@@ -0,0 +1,8 @@
+<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
+ <soap:Body xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
+   <soap:Fault>
+     <faultcode>soap:Server</faultcode>
+     <faultstring><![CDATA[some text containing a xml tag 
<xml-tag>]]></faultstring>
+   </soap:Fault>
+ </soap:Body>
+</soap:Envelope>
\ No newline at end of file

Propchange: 
cxf/branches/2.7.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/cxf5493.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
cxf/branches/2.7.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/cxf5493.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml


Reply via email to