servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r706022 - in /servicemix/components/bindings/servicemix-cxf-bc/trunk/src: main/java/org/apache/servicemix/cxfbc/ main/java/org/apache/servicemix/cxfbc/interceptors/ test/java/org/apache/servicemix/cxfbc/ test/java/org/apache/servicemix/cxfb...
Date Sun, 19 Oct 2008 14:41:34 GMT
Author: ffang
Date: Sun Oct 19 07:41:33 2008
New Revision: 706022

URL: http://svn.apache.org/viewvc?rev=706022&view=rev
Log:
[SM-1637]smx-cxf-bc provider throws NPE at JbiInWsdl1Interceptor.handleJBIFault

Modified:
    servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
    servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcProviderMessageObserver.java
    servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java
    servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcHttpJmsBridgeMtomTest.java
    servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/mtom/TestMtomImpl.java

Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java?rev=706022&r1=706021&r2=706022&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
(original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
Sun Oct 19 07:41:33 2008
@@ -656,6 +656,10 @@
                         Element details = toElement(exchange.getFault()
                                 .getContent());
                         f.setDetail(details);
+                        if (exchange.getProperty("faultstring") != null) {
+                            f.setMessage((String)exchange.getProperty("faultstring"));
+                        }
+
                         
                     } else {
                         Element details = toElement(exchange.getFault()
@@ -668,13 +672,22 @@
                         details = (Element) details.getElementsByTagNameNS(
                                 details.getNamespaceURI(), "Fault").item(0);
                         assert details != null;
-                        details = (Element) details.getElementsByTagName("detail").item(0);
+                        if (exchange.getProperty("faultstring") != null) {
+                            details = (Element) details.getElementsByTagName("faultstring").item(0);
+                        } else {
+                            details = (Element) details.getElementsByTagName("detail").item(0);
+                        }
+
                         assert details != null;
                         f = new SoapFault(
                                 new org.apache.cxf.common.i18n.Message(
                                         "Fault occured", (ResourceBundle) null),
                                 new QName(details.getNamespaceURI(), "detail"));
                         f.setDetail(details);
+                        if (exchange.getProperty("faultstring") != null) {
+                            f.setMessage((String)exchange.getProperty("faultstring"));
+                        }
+
 
                     }
                     processFaultDetail(f, message);
@@ -722,6 +735,10 @@
         protected void processFaultDetail(Fault fault, Message msg) {
             Element exDetail = (Element) DOMUtils.getChild(fault.getDetail(),
                     Node.ELEMENT_NODE);
+            if (exDetail == null) {
+                return;
+            }
+
             QName qname = new QName(exDetail.getNamespaceURI(), exDetail
                     .getLocalName());
 

Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcProviderMessageObserver.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcProviderMessageObserver.java?rev=706022&r1=706021&r2=706022&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcProviderMessageObserver.java
(original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcProviderMessageObserver.java
Sun Oct 19 07:41:33 2008
@@ -143,6 +143,10 @@
                 Fault fault = messageExchange.createFault();
                 fault.setContent(soapMessage.getContent(Source.class));
                 messageExchange.setFault(fault);
+                if (soapMessage.get("faultstring") != null) {
+                    messageExchange.setProperty("faultstring", soapMessage.get("faultstring"));
+                }
+
             } else if (messageExchange instanceof InOut) {
                 NormalizedMessage msg = messageExchange.createMessage();
                 msg.setContent(soapMessage.getContent(Source.class));

Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java?rev=706022&r1=706021&r2=706022&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java
(original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java
Sun Oct 19 07:41:33 2008
@@ -226,22 +226,25 @@
         Node jbiFaultDetail = null;
         if (message.getVersion() instanceof Soap11) {
             NodeList nodeList = soapFault.getElementsByTagName("detail");
-            if (nodeList == null) {
+            if (nodeList == null || nodeList.getLength() == 0) {
                 //there is no detail in the fault, which means the fault is
                 //thrown during soap header process according to soap spec,
                 //try get the mandatory elemenet faultstring
                 nodeList = soapFault.getElementsByTagName("faultstring");
+                message.put("faultstring", nodeList.item(0).getTextContent());
             }
             jbiFaultDetail = doc.importNode(nodeList.item(0).getFirstChild(), true);
         } else {
             NodeList nodeList = soapFault.getElementsByTagName("soap:Detail");
-            if (nodeList == null) {
+            if (nodeList == null || nodeList.getLength() == 0) {
                 //there is no detail in the fault, which means the fault is
                 //thrown during soap header process according to soap spec,
                 //try get the mandatory elemenet soap:Reason
                 nodeList = soapFault.getElementsByTagName("soap:Reason");
+                message.put("faultstring", nodeList.item(0).getTextContent());
             }
             jbiFaultDetail = doc.importNode(nodeList.item(0).getFirstChild(), true);
+            
         }
 
         SchemaInfo schemaInfo = 

Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcHttpJmsBridgeMtomTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcHttpJmsBridgeMtomTest.java?rev=706022&r1=706021&r2=706022&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcHttpJmsBridgeMtomTest.java
(original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcHttpJmsBridgeMtomTest.java
Sun Oct 19 07:41:33 2008
@@ -20,7 +20,6 @@
 import java.io.InputStream;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Proxy;
-import java.lang.reflect.UndeclaredThrowableException;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -150,8 +149,11 @@
             bis.read(b, 0, 10);
             String attachContent = new String(b);
             assertEquals(attachContent, "testfoobar");
-        } catch (UndeclaredThrowableException ex) {
-            throw (Exception) ex.getCause();
+            name.value = "runtime exception";
+            mtomPort.testXop(name, param);
+            fail("should catch RuntimeException");
+        } catch (RuntimeException ex) {
+            //
         }
 
     }

Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/mtom/TestMtomImpl.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/mtom/TestMtomImpl.java?rev=706022&r1=706021&r2=706022&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/mtom/TestMtomImpl.java
(original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/mtom/TestMtomImpl.java
Sun Oct 19 07:41:33 2008
@@ -34,8 +34,12 @@
             wsdlLocation = "testutils/mtom_xop.wsdl")
 public class TestMtomImpl implements TestMtom {
     public void testXop(Holder<String> name, Holder<DataHandler> attachinfo)
{
+        if ("runtime exception".equals(name.value)) {
+            throw new RuntimeException("throw runtime exception");
+        }
         
         try {
+
             InputStream bis = attachinfo.value.getDataSource().getInputStream();
             byte b[] = new byte[6];
             bis.read(b, 0, 6);



Mime
View raw message