cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1090041 - in /cxf/branches/2.3.x-fixes: ./ api/src/main/java/org/apache/cxf/interceptor/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ rt/core/src/main/java/org/apache/cxf/interceptor/ systests/uncategorized/src/t...
Date Thu, 07 Apr 2011 22:01:33 GMT
Author: dkulp
Date: Thu Apr  7 22:01:32 2011
New Revision: 1090041

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

........
  r1089871 | ningjiang | 2011-04-07 09:15:35 -0400 (Thu, 07 Apr 2011) | 1 line
  
  CXF-3445 Support the faultStackTraceEnabled option in Soap12FaultOutputInterceptor
........

Added:
    cxf/branches/2.3.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/
      - copied from r1089871, cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/
    cxf/branches/2.3.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/GreeterImpl11.java
      - copied unchanged from r1089871, cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/GreeterImpl11.java
    cxf/branches/2.3.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/GreeterImpl12.java
      - copied unchanged from r1089871, cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/GreeterImpl12.java
    cxf/branches/2.3.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/Server11.java
      - copied unchanged from r1089871, cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/Server11.java
    cxf/branches/2.3.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/Server12.java
      - copied unchanged from r1089871, cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/Server12.java
    cxf/branches/2.3.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/Soap11ClientServerTest.java
      - copied unchanged from r1089871, cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/Soap11ClientServerTest.java
    cxf/branches/2.3.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/Soap12ClientServerTest.java
      - copied unchanged from r1089871, cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/Soap12ClientServerTest.java
Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/interceptor/Fault.java
    cxf/branches/2.3.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/AbstractSoapInterceptor.java
    cxf/branches/2.3.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultOutInterceptor.java
    cxf/branches/2.3.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java
    cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java

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

Modified: cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/interceptor/Fault.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/interceptor/Fault.java?rev=1090041&r1=1090040&r2=1090041&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/interceptor/Fault.java (original)
+++ cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/interceptor/Fault.java Thu Apr
 7 22:01:32 2011
@@ -36,7 +36,7 @@ import org.apache.cxf.helpers.DOMUtils;
 public class Fault extends UncheckedException {
     public static final QName FAULT_CODE_CLIENT = new QName("http://cxf.apache.org/faultcode",
"client");
     public static final QName FAULT_CODE_SERVER = new QName("http://cxf.apache.org/faultcode",
"server");
-    
+    public static final String STACKTRACE_NAMESPACE = "http://cxf.apache.org/fault";
     public static final String STACKTRACE = "stackTrace";
     private Element detail;
     private String message;

Modified: cxf/branches/2.3.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/AbstractSoapInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/AbstractSoapInterceptor.java?rev=1090041&r1=1090040&r2=1090041&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/AbstractSoapInterceptor.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/AbstractSoapInterceptor.java
Thu Apr  7 22:01:32 2011
@@ -27,7 +27,13 @@ import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import org.apache.cxf.binding.soap.SoapFault;
 import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.helpers.XMLUtils;
+import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
 import org.apache.cxf.staxutils.StaxUtils;
 
@@ -64,5 +70,35 @@ public abstract class AbstractSoapInterc
             prefix = StaxUtils.getUniquePrefix(writer, codeNs, true);
         }        
         return prefix;
-    }    
+    }
+    
+    protected void prepareStackTrace(SoapMessage message, SoapFault fault) throws Exception
{
+        String config = (String)message
+            .getContextualProperty(org.apache.cxf.message.Message.FAULT_STACKTRACE_ENABLED);
+        if (config != null && Boolean.valueOf(config).booleanValue() && fault.getCause()
!= null) {
+            StringBuilder sb = new StringBuilder();
+            for (StackTraceElement ste : fault.getCause().getStackTrace()) {
+                sb.append(ste.getClassName() + "!" + ste.getMethodName() + "!" + ste.getFileName()
+ "!"
+                          + ste.getLineNumber() + "\n");
+            }
+            Element detail = fault.getDetail();
+            String soapNamespace = message.getVersion().getNamespace();
+            if (detail == null) {
+                Document doc = XMLUtils.newDocument();
+                Element stackTrace = doc.createElementNS(
+                    Fault.STACKTRACE_NAMESPACE, Fault.STACKTRACE);
+                stackTrace.setTextContent(sb.toString());
+                detail = doc.createElementNS(
+                    soapNamespace, "detail");
+                fault.setDetail(detail);
+                detail.appendChild(stackTrace);
+            } else {
+                Element stackTrace = 
+                    detail.getOwnerDocument().createElementNS(Fault.STACKTRACE_NAMESPACE,
+                                                              Fault.STACKTRACE);
+                stackTrace.setTextContent(sb.toString());
+                detail.appendChild(stackTrace);
+            }
+        }
+    }
 }

Modified: cxf/branches/2.3.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultOutInterceptor.java?rev=1090041&r1=1090040&r2=1090041&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultOutInterceptor.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultOutInterceptor.java
Thu Apr  7 22:01:32 2011
@@ -25,15 +25,12 @@ import java.util.logging.Logger;
 
 import javax.xml.stream.XMLStreamWriter;
 
-import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
-import org.apache.cxf.binding.soap.Soap11;
 import org.apache.cxf.binding.soap.SoapFault;
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.helpers.XMLUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.staxutils.StaxUtils;
@@ -92,29 +89,7 @@ public class Soap11FaultOutInterceptor e
                     writer.writeCharacters("Fault occurred while processing.");
                 }
                 writer.writeEndElement();
-                String config = (String)message.getContextualProperty(
-                        org.apache.cxf.message.Message.FAULT_STACKTRACE_ENABLED);
-                if (config != null && Boolean.valueOf(config).booleanValue() &&
fault.getCause() != null) {
-                    StringBuilder sb = new StringBuilder();
-                    for (StackTraceElement ste : fault.getCause().getStackTrace()) {    
               
-                        sb.append(ste.getClassName() + "!" + ste.getMethodName() + "!" +
ste.getFileName()  
-                                + "!" + ste.getLineNumber() + "\n");
-                    }
-                    Element detail = fault.getDetail(); 
-                    if (detail == null) {
-                        Document doc = XMLUtils.newDocument();
-                        Element stackTrace = doc.createElementNS(Soap11.SOAP_NAMESPACE, Fault.STACKTRACE);
-                        stackTrace.setTextContent(sb.toString());
-                        detail = doc.createElementNS(Soap11.SOAP_NAMESPACE, "detail");
-                        fault.setDetail(detail);
-                        detail.appendChild(stackTrace);
-                    } else {
-                        Element stackTrace = detail.getOwnerDocument().createElementNS(
-                                Soap11.SOAP_NAMESPACE, Fault.STACKTRACE);
-                        stackTrace.setTextContent(sb.toString());
-                        detail.appendChild(stackTrace);
-                    }                    
-                }
+                prepareStackTrace(message, fault);
     
                 if (fault.hasDetails()) {
                     Element detail = fault.getDetail();

Modified: cxf/branches/2.3.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java?rev=1090041&r1=1090040&r2=1090041&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java
Thu Apr  7 22:01:32 2011
@@ -112,6 +112,8 @@ public class Soap12FaultOutInterceptor e
                 writer.writeEndElement();
                 writer.writeEndElement();
 
+                prepareStackTrace(message, fault);
+                
                 if (fault.hasDetails()) {
                     Element detail = fault.getDetail();
                     writer.writeStartElement(defaultPrefix, "Detail", ns);

Modified: cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java?rev=1090041&r1=1090040&r2=1090041&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
Thu Apr  7 22:01:32 2011
@@ -235,7 +235,8 @@ public class ClientFaultConverter extend
     private void setStackTrace(Fault fault, Message msg) {
         Map<String, String> ns = new HashMap<String, String>();
         XPathUtils xu = new XPathUtils(ns);
-        String ss = (String) xu.getValue("/" + Fault.STACKTRACE + "/text()", fault.getDetail(),
+        ns.put("s", Fault.STACKTRACE_NAMESPACE);
+        String ss = (String) xu.getValue("//s:" + Fault.STACKTRACE + "/text()", fault.getDetail(),
                 XPathConstants.STRING);
         List<StackTraceElement> stackTraceList = new ArrayList<StackTraceElement>();
         if (!StringUtils.isEmpty(ss)) {



Mime
View raw message