cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asold...@apache.org
Subject svn commit: r1511754 - in /cxf/branches/2.6.x-fixes: ./ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/
Date Thu, 08 Aug 2013 12:43:47 GMT
Author: asoldano
Date: Thu Aug  8 12:43:47 2013
New Revision: 1511754

URL: http://svn.apache.org/r1511754
Log:
Merged revisions 1511748 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes

................
  r1511748 | asoldano | 2013-08-08 14:37:43 +0200 (Thu, 08 Aug 2013) | 9 lines
  
  Merged revisions 1511398 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r1511398 | asoldano | 2013-08-07 18:59:13 +0200 (Wed, 07 Aug 2013) | 2 lines
    
    [CXF-5186] Properly parse soap 1.2 faul reason xml:lang attribute
  ........
................

Modified:
    cxf/branches/2.6.x-fixes/   (props changed)
    cxf/branches/2.6.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultInInterceptor.java
    cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
    cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java

Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Thu Aug  8 12:43:47 2013
@@ -0,0 +1,2 @@
+/cxf/branches/2.7.x-fixes:1511748
+/cxf/trunk:1511398

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

Modified: cxf/branches/2.6.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultInInterceptor.java?rev=1511754&r1=1511753&r2=1511754&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultInInterceptor.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultInInterceptor.java
Thu Aug  8 12:43:47 2013
@@ -74,6 +74,7 @@ public class Soap12FaultInInterceptor ex
         String role = null;
         String node = null;
         Element detail = null;
+        String lang = null;
 
         Map<String, String> ns = new HashMap<String, String>();
         ns.put("s", Soap12.SOAP_NAMESPACE);
@@ -122,6 +123,10 @@ public class Soap12FaultInInterceptor ex
                                              fault,
                                              XPathConstants.STRING);
             
+            lang = (String) xu.getValue("//s:Fault/s:Reason/s:Text/@xml:lang", 
+                                             fault,
+                                             XPathConstants.STRING);
+            
             Node detailNode = (Node) xu.getValue("//s:Fault/s:Detail",
                                                  fault,
                                                  XPathConstants.NODE);
@@ -152,6 +157,7 @@ public class Soap12FaultInInterceptor ex
         fault.setDetail(detail);
         fault.setRole(role);
         fault.setNode(node);
+        fault.setLang(lang);
         return fault;
     }
 

Modified: cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java?rev=1511754&r1=1511753&r2=1511754&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
Thu Aug  8 12:43:47 2013
@@ -25,6 +25,7 @@ import java.lang.reflect.InvocationHandl
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.net.HttpURLConnection;
+import java.util.Locale;
 import java.util.Map;
 import java.util.concurrent.Future;
 import java.util.logging.Logger;
@@ -214,14 +215,20 @@ public class JaxWsClientProxy extends or
                     //ignore
                 }
             }
-            soapFault.setFaultString(((SoapFault)ex).getReason());
+            final boolean isSoap11 = SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE.equals(soapFault.getNamespaceURI());
+            
+            if (isSoap11 || ((SoapFault)ex).getLang() == null) {
+                soapFault.setFaultString(((SoapFault)ex).getReason());
+            } else {
+                soapFault.setFaultString(((SoapFault)ex).getReason(), stringToLocale(((SoapFault)ex).getLang()));
+            }
+            
             SAAJUtils.setFaultCode(soapFault, ((SoapFault)ex).getFaultCode());
             String role = ((SoapFault)ex).getRole();
             if (role != null) {
                 soapFault.setFaultActor(role);
             }
-            if (((SoapFault)ex).getSubCodes() != null 
-                && !SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE.equals(soapFault.getNamespaceURI()))
{
+            if (((SoapFault)ex).getSubCodes() != null && !isSoap11) {
                 // set the subcode only if it is supported (e.g, 1.2)
                 for (QName fsc : ((SoapFault)ex).getSubCodes()) {
                     soapFault.appendFaultSubcode(fsc);    
@@ -247,6 +254,17 @@ public class JaxWsClientProxy extends or
         }      
         return soapFault;
     }
+    
+    private static Locale stringToLocale(String locale) {
+        String parts[] = locale.split("_", -1);
+        if (parts.length == 1) {
+            return new Locale(parts[0]);
+        } else if (parts.length == 2) {
+            return new Locale(parts[0], parts[1]);
+        } else {
+            return new Locale(parts[0], parts[1], parts[2]);
+        }
+    }
 
     private boolean addressChanged(String address) {
         return !(address == null

Modified: cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java?rev=1511754&r1=1511753&r2=1511754&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java
Thu Aug  8 12:43:47 2013
@@ -101,7 +101,7 @@ public class WebFaultOutInterceptor exte
                     String convertedLang = lang.getLanguage();
                     String country = lang.getCountry();
                     if (country.length() > 0) {
-                        convertedLang = convertedLang + '-' + country;
+                        convertedLang = convertedLang + '_' + country;
                     }
                     f.setLang(convertedLang);
                 }



Mime
View raw message