cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r1442024 - in /cxf/branches/2.6.x-fixes: ./ api/src/main/java/org/apache/cxf/interceptor/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/
Date Mon, 04 Feb 2013 04:39:40 GMT
Author: ffang
Date: Mon Feb  4 04:39:40 2013
New Revision: 1442024

URL: http://svn.apache.org/viewvc?rev=1442024&view=rev
Log:
Merged revisions 1442021 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes

................
  r1442021 | ffang | 2013-02-04 12:04:01 +0800 (一, 04  2 2013) | 9 lines
  
  Merged revisions 1442015 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r1442015 | ffang | 2013-02-04 11:06:19 +0800 (一, 04  2 2013) | 1 line
    
    [CXF-4790]Set lang and subcode for soapfault
  ........
................

Modified:
    cxf/branches/2.6.x-fixes/   (props changed)
    cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/interceptor/Fault.java
    cxf/branches/2.6.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.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/
------------------------------------------------------------------------------
  Merged /cxf/branches/2.7.x-fixes:r1442021
  Merged /cxf/trunk:r1442015

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

Modified: cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/interceptor/Fault.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/interceptor/Fault.java?rev=1442024&r1=1442023&r2=1442024&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/interceptor/Fault.java (original)
+++ cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/interceptor/Fault.java Mon Feb
 4 04:39:40 2013
@@ -44,11 +44,12 @@ public class Fault extends UncheckedExce
     private Element detail;
     private String message;
     private QName code;
+    private String lang;
     /**
      * response http header status code
      */
     private int statusCode = DEFAULT_HTTP_RESPONSE_CODE;
-    
+
     public Fault(Message message, Throwable throwable) {
         super(message, throwable);
         this.message = message.toString();
@@ -185,4 +186,12 @@ public class Fault extends UncheckedExce
     public void setStatusCode(int statusCode) {
         this.statusCode = statusCode;
     }
+
+    public void setLang(String convertedLang) {
+        lang = convertedLang;
+    }
+
+    public String getLang() {
+        return lang;
+    }
 }

Modified: cxf/branches/2.6.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.6.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java?rev=1442024&r1=1442023&r2=1442024&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java
Mon Feb  4 04:39:40 2013
@@ -105,7 +105,11 @@ public class Soap12FaultOutInterceptor e
 
                 writer.writeStartElement(defaultPrefix, "Reason", ns);
                 writer.writeStartElement(defaultPrefix, "Text", ns);
-                writer.writeAttribute("xml", "http://www.w3.org/XML/1998/namespace", "lang",
getLangCode());
+                String lang = f.getLang();
+                if (lang == null || lang.equalsIgnoreCase("")) {
+                    lang = getLangCode();
+                }
+                writer.writeAttribute("xml", "http://www.w3.org/XML/1998/namespace", "lang",
lang);
                 writer.writeCharacters(getFaultMessage(message, fault));
                 writer.writeEndElement();
                 writer.writeEndElement();

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=1442024&r1=1442023&r2=1442024&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
Mon Feb  4 04:39:40 2013
@@ -21,6 +21,7 @@ package org.apache.cxf.jaxws.interceptor
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
+import java.util.Locale;
 import java.util.ResourceBundle;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -28,7 +29,9 @@ import java.util.logging.Logger;
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamWriter;
 import javax.xml.ws.WebFault;
+import javax.xml.ws.soap.SOAPFaultException;
 
+import org.apache.cxf.binding.soap.SoapFault;
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.logging.LogUtils;
@@ -82,7 +85,35 @@ public class WebFaultOutInterceptor exte
         if (f == null) {
             return;
         }
-
+        try {
+            if (f.getCause().getClass().equals(SOAPFaultException.class)) {
+                SOAPFaultException sf = (SOAPFaultException) (f.getCause());
+                if (sf.getFault().getFaultSubcodes().hasNext()
+                        && f.getClass().equals(SoapFault.class)) {
+                    String subcode = sf.getFault().getFaultSubcodes().next()
+                           .toString();
+                    String nameSpace = subcode.substring(
+                           subcode.indexOf("{") + 1, subcode.indexOf("}"));
+                    String localPart = subcode
+                           .substring(subcode.indexOf("}") + 1);
+                    QName subcodeQName = new QName(nameSpace, localPart);
+                    ((SoapFault) f).setSubCode(subcodeQName);
+                }
+                if (sf.getFault().getFaultReasonLocales().hasNext()) {
+                    Locale lang = (Locale) sf.getFault()
+                           .getFaultReasonLocales().next();
+                    String convertedLang = lang.getLanguage();
+                    String country = lang.getCountry();
+                    if (country.length() > 0) {
+                        convertedLang = convertedLang + '-' + country;
+                    }
+                    f.setLang(convertedLang);
+                }
+                message.setContent(Exception.class, f);
+            }
+        } catch (Exception e) {
+          // do nothing;
+        }
         Throwable cause = f.getCause();
         WebFault fault = null;
         if (cause != null) {



Mime
View raw message