cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject git commit: [CXF-5911] Make sure the xml:lang attribute is recorded for SOAP 1.1 faults. If the user specifies a lang for a SOAP 1.1 fault, write it out. (otherwise, don't)
Date Wed, 30 Jul 2014 17:57:22 GMT
Repository: cxf
Updated Branches:
  refs/heads/master cb4bc5312 -> 3bf3d07c9


[CXF-5911] Make sure the xml:lang attribute is recorded for SOAP 1.1 faults.
If the user specifies a lang for a SOAP 1.1 fault, write it out.  (otherwise, don't)


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/3bf3d07c
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/3bf3d07c
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/3bf3d07c

Branch: refs/heads/master
Commit: 3bf3d07c954536d099274ebf1c5690e84ff3a423
Parents: cb4bc53
Author: Daniel Kulp <dkulp@apache.org>
Authored: Wed Jul 30 13:55:55 2014 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Wed Jul 30 13:55:55 2014 -0400

----------------------------------------------------------------------
 .../binding/soap/interceptor/Soap11FaultInInterceptor.java    | 7 ++++++-
 .../binding/soap/interceptor/Soap11FaultOutInterceptor.java   | 5 +++++
 .../binding/soap/interceptor/Soap12FaultOutInterceptor.java   | 2 +-
 .../src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java  | 3 ++-
 4 files changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/3bf3d07c/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultInInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultInInterceptor.java
b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultInInterceptor.java
index ff0b05a..2943f77 100644
--- a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultInInterceptor.java
+++ b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultInInterceptor.java
@@ -32,6 +32,7 @@ import org.apache.cxf.binding.soap.SoapFault;
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.interceptor.ClientFaultConverter;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.phase.Phase;
@@ -57,12 +58,13 @@ public class Soap11FaultInInterceptor extends AbstractSoapInterceptor
{
         QName faultCode = null;
         String role = null;
         Element detail = null;
-        
+        String lang = null;
         try {
             while (reader.nextTag() == XMLStreamReader.START_ELEMENT) {
                 if (reader.getLocalName().equals("faultcode")) {
                     faultCode = StaxUtils.readQName(reader);
                 } else if (reader.getLocalName().equals("faultstring")) {
+                    lang = reader.getAttributeValue("http://www.w3.org/XML/1998/namespace",
"lang");
                     exMessage = reader.getElementText();
                 } else if (reader.getLocalName().equals("faultactor")) {
                     role = reader.getElementText();
@@ -84,6 +86,9 @@ public class Soap11FaultInInterceptor extends AbstractSoapInterceptor {
         SoapFault fault = new SoapFault(exMessage, faultCode);
         fault.setDetail(detail);
         fault.setRole(role);
+        if (!StringUtils.isEmpty(lang)) {
+            fault.setLang(lang);
+        }
         return fault;
     }
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/3bf3d07c/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultOutInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultOutInterceptor.java
b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultOutInterceptor.java
index b7a9bd1..45ad4ad 100644
--- a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultOutInterceptor.java
+++ b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultOutInterceptor.java
@@ -33,6 +33,7 @@ import org.apache.cxf.binding.soap.SoapFault;
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.interceptor.Soap12FaultOutInterceptor.Soap12FaultOutInterceptorInternal;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.staxutils.StaxUtils;
@@ -90,6 +91,10 @@ public class Soap11FaultOutInterceptor extends AbstractSoapInterceptor
{
                 writer.writeEndElement();
 
                 writer.writeStartElement("faultstring");
+                String lang = f.getLang();
+                if (!StringUtils.isEmpty(lang)) {
+                    writer.writeAttribute("xml", "http://www.w3.org/XML/1998/namespace",
"lang", lang);
+                }
                 writer.writeCharacters(getFaultMessage(message, fault));
                 writer.writeEndElement();
                 prepareStackTrace(message, fault);

http://git-wip-us.apache.org/repos/asf/cxf/blob/3bf3d07c/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java
b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java
index ea0cf4b..e0affa9 100644
--- a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java
+++ b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java
@@ -112,7 +112,7 @@ public class Soap12FaultOutInterceptor extends AbstractSoapInterceptor
{
                 writer.writeStartElement(defaultPrefix, "Reason", ns);
                 writer.writeStartElement(defaultPrefix, "Text", ns);
                 String lang = f.getLang();
-                if (lang == null || lang.equalsIgnoreCase("")) {
+                if (StringUtils.isEmpty(lang)) {
                     lang = getLangCode();
                 }
                 writer.writeAttribute("xml", "http://www.w3.org/XML/1998/namespace", "lang",
lang);

http://git-wip-us.apache.org/repos/asf/cxf/blob/3bf3d07c/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
index 3b97d5d..d155ab8 100644
--- a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
+++ b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
@@ -52,6 +52,7 @@ import org.apache.cxf.binding.soap.saaj.SAAJFactoryResolver;
 import org.apache.cxf.binding.soap.saaj.SAAJUtils;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.ClientCallback;
 import org.apache.cxf.endpoint.Endpoint;
@@ -218,7 +219,7 @@ public class JaxWsClientProxy extends org.apache.cxf.frontend.ClientProxy
implem
             }
             final boolean isSoap11 = SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE.equals(soapFault.getNamespaceURI());
             
-            if (isSoap11 || ((SoapFault)ex).getLang() == null) {
+            if (StringUtils.isEmpty(((SoapFault)ex).getLang())) {
                 soapFault.setFaultString(((SoapFault)ex).getReason());
             } else {
                 soapFault.setFaultString(((SoapFault)ex).getReason(), stringToLocale(((SoapFault)ex).getLang()));


Mime
View raw message