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 2012/03/30 16:26:11 UTC

svn commit: r1307441 - in /cxf/branches/2.5.x-fixes/rt/bindings/soap/src: main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java test/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptorTest.java

Author: dkulp
Date: Fri Mar 30 14:26:10 2012
New Revision: 1307441

URL: http://svn.apache.org/viewvc?rev=1307441&view=rev
Log:
Merged revisions 1307403 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1307403 | dkulp | 2012-03-30 09:27:33 -0400 (Fri, 30 Mar 2012) | 2 lines

  [CXF-4181] Fix for SAAJ + SOAP 1.2 fault...

........

Modified:
    cxf/branches/2.5.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
    cxf/branches/2.5.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptorTest.java

Modified: cxf/branches/2.5.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java?rev=1307441&r1=1307440&r2=1307441&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java (original)
+++ cxf/branches/2.5.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java Fri Mar 30 14:26:10 2012
@@ -226,12 +226,11 @@ public class SAAJInInterceptor extends A
             
 
             if (hasFault(message, xmlReader)) {
-                SOAPFault soapFault = 
-                    soapMessage.getSOAPPart().getEnvelope().getBody().addFault();
                 SoapFault fault = 
                     message.getVersion() instanceof Soap11 
                     ? Soap11FaultInInterceptor.unmarshalFault(message, xmlReader)
                     : Soap12FaultInInterceptor.unmarshalFault(message, xmlReader);
+<<<<<<< HEAD
                 if (fault.getFaultCode() != null) {
                     soapFault.setFaultCode(fault.getFaultCode());
                 }
@@ -243,21 +242,40 @@ public class SAAJInInterceptor extends A
                 }
                 if (fault.getDetail() != null
                     && fault.getDetail().getFirstChild() != null) {
+=======
+>>>>>>> 941b6cf... [CXF-4181] Fix for SAAJ + SOAP 1.2 fault...
                     
-                    Detail detail = null;
-                    Node child = fault.getDetail().getFirstChild();
-                    while (child != null) {
-                        if (Node.ELEMENT_NODE == child.getNodeType()) {
-                            if (detail == null) {
-                                detail = soapFault.addDetail();
+                SOAPFault soapFault = 
+                    soapMessage.getSOAPPart().getEnvelope().getBody().getFault();
+                if (soapFault == null) {
+                    soapFault = 
+                        soapMessage.getSOAPPart().getEnvelope().getBody().addFault();
+                    if (fault.getFaultCode() != null) {
+                        SAAJUtils.setFaultCode(soapFault, fault.getFaultCode());
+                    }
+                    if (fault.getMessage() != null) {
+                        soapFault.setFaultString(fault.getMessage());
+                    }
+                    if (fault.getRole() != null) {
+                        soapFault.setFaultActor(fault.getRole());
+                    }
+                    if (fault.getDetail() != null
+                        && fault.getDetail().getFirstChild() != null) {
+                        
+                        Detail detail = null;
+                        Node child = fault.getDetail().getFirstChild();
+                        if (child != null) {
+                            detail = soapFault.addDetail();
+                        }
+                        while (child != null) {
+                            if (Node.ELEMENT_NODE == child.getNodeType()) {
+                                Node importedChild = soapMessage.getSOAPPart().importNode(child, true);
+                                detail.appendChild(importedChild);
                             }
-                            Node importedChild = soapMessage.getSOAPPart().importNode(child, true);
-                            detail.appendChild(importedChild);
+                            child = child.getNextSibling();
                         }
-                        child = child.getNextSibling();
                     }
                 }
-
                 DOMSource bodySource = new DOMSource(soapFault);
                 xmlReader = StaxUtils.createXMLStreamReader(bodySource);
             } else { 

Modified: cxf/branches/2.5.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptorTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptorTest.java?rev=1307441&r1=1307440&r2=1307441&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptorTest.java (original)
+++ cxf/branches/2.5.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptorTest.java Fri Mar 30 14:26:10 2012
@@ -45,7 +45,6 @@ import org.apache.cxf.binding.soap.inter
 import org.apache.cxf.headers.Header;
 import org.apache.cxf.interceptor.StaxInInterceptor;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 
 
@@ -141,7 +140,6 @@ public class SAAJInInterceptorTest exten
     }
     
     @Test
-    @Ignore
     public void testFaultDetailSOAP12() throws Exception {
         try {
             prepareSoapMessage("../test-soap-12-fault-detail.xml");