cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1080438 - /cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java
Date Fri, 11 Mar 2011 04:24:21 GMT
Author: dkulp
Date: Fri Mar 11 04:24:21 2011
New Revision: 1080438

URL: http://svn.apache.org/viewvc?rev=1080438&view=rev
Log:
[CXF-3342] Port some fixes from the Soap11FaultOutInterceptor
Pointers from Aaron Pieper applied

Modified:
    cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java

Modified: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java?rev=1080438&r1=1080437&r2=1080438&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java
(original)
+++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java
Fri Mar 11 04:24:21 2011
@@ -66,25 +66,30 @@ public class Soap12FaultOutInterceptor e
             Fault f = (Fault)message.getContent(Exception.class);
     
             SoapFault fault = SoapFault.createFault(f, message.getVersion());       
-            
+
             try {
                 Map<String, String> namespaces = fault.getNamespaces();
                 for (Map.Entry<String, String> e : namespaces.entrySet()) {
                     writer.writeNamespace(e.getKey(), e.getValue());
                 }
-    
+
                 String ns = message.getVersion().getNamespace();
-                String defaultPrefix = StaxUtils.getUniquePrefix(writer, ns, true);
-    
-                writer.writeStartElement(defaultPrefix, "Fault", ns);
-    
+                String defaultPrefix = writer.getPrefix(ns);
+                if (defaultPrefix == null) {
+                    defaultPrefix = StaxUtils.getUniquePrefix(writer, ns, false);
+                    writer.writeStartElement(defaultPrefix, "Fault", ns);
+                    writer.writeNamespace(defaultPrefix, ns);
+                } else {
+                    writer.writeStartElement(defaultPrefix, "Fault", ns);
+                }
+
                 writer.writeStartElement(defaultPrefix, "Code", ns);
                 writer.writeStartElement(defaultPrefix, "Value", ns);
            
                 writer.writeCharacters(fault.getCodeString(getFaultCodePrefix(writer, fault.getFaultCode()),

                                                            defaultPrefix));
                 writer.writeEndElement();
-                
+
                 if (fault.getSubCode() != null) {
                     writer.writeStartElement(defaultPrefix, "Subcode", ns);
                     writer.writeStartElement(defaultPrefix, "Value", ns);
@@ -95,7 +100,7 @@ public class Soap12FaultOutInterceptor e
                     writer.writeEndElement();
                 }
                 writer.writeEndElement();
-    
+
                 writer.writeStartElement(defaultPrefix, "Reason", ns);
                 writer.writeStartElement(defaultPrefix, "Text", ns);
                 writer.writeAttribute("xml", "http://www.w3.org/XML/1998/namespace", "lang",
getLangCode());
@@ -106,27 +111,27 @@ public class Soap12FaultOutInterceptor e
                 }
                 writer.writeEndElement();
                 writer.writeEndElement();
-    
+
                 if (fault.hasDetails()) {
                     Element detail = fault.getDetail();
                     writer.writeStartElement(defaultPrefix, "Detail", ns);
-    
+
                     Node node = detail.getFirstChild();
                     while (node != null) {
                         StaxUtils.writeNode(node, writer, true);
                         node = node.getNextSibling();
                     }
-    
+
                     // Details
                     writer.writeEndElement();
                 }
-    
+
                 if (fault.getRole() != null) {
                     writer.writeStartElement(defaultPrefix, "Role", ns);
                     writer.writeCharacters(fault.getRole());
                     writer.writeEndElement();
                 }
-    
+
                 // Fault
                 writer.writeEndElement();
             } catch (Exception xe) {
@@ -134,7 +139,7 @@ public class Soap12FaultOutInterceptor e
                 throw f;
             }
         }
-        
+
         private String getLangCode() {        
             String code = LOG.getResourceBundle().getLocale().getLanguage();
             if (StringUtils.isEmpty(code)) {



Mime
View raw message