servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r706021 - in /servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src: main/java/org/apache/servicemix/cxfbc/ main/java/org/apache/servicemix/cxfbc/interceptors/ test/java/org/apache/servicemix/cxfbc/ tes...
Date Sun, 19 Oct 2008 14:41:31 GMT
Author: ffang
Date: Sun Oct 19 07:41:30 2008
New Revision: 706021

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

Modified:
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcProviderMessageObserver.java
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcHttpJmsBridgeMtomTest.java
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/mtom/TestMtomImpl.java

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java?rev=706021&r1=706020&r2=706021&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
Sun Oct 19 07:41:30 2008
@@ -635,7 +635,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()
                                 .getContent());
@@ -647,13 +650,20 @@
                         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);
@@ -701,6 +711,9 @@
         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/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcProviderMessageObserver.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcProviderMessageObserver.java?rev=706021&r1=706020&r2=706021&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcProviderMessageObserver.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcProviderMessageObserver.java
Sun Oct 19 07:41:30 2008
@@ -169,6 +169,9 @@
             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/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java?rev=706021&r1=706020&r2=706021&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java
Sun Oct 19 07:41:30 2008
@@ -228,20 +228,22 @@
         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);
         }

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcHttpJmsBridgeMtomTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcHttpJmsBridgeMtomTest.java?rev=706021&r1=706020&r2=706021&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcHttpJmsBridgeMtomTest.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcHttpJmsBridgeMtomTest.java
Sun Oct 19 07:41:30 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/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/mtom/TestMtomImpl.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/mtom/TestMtomImpl.java?rev=706021&r1=706020&r2=706021&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/mtom/TestMtomImpl.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/mtom/TestMtomImpl.java
Sun Oct 19 07:41:30 2008
@@ -36,6 +36,9 @@
     public void testXop(Holder<String> name, Holder<DataHandler> attachinfo)
{
         
         try {
+            if ("runtime exception".equals(name.value)) {
+                throw new RuntimeException("throw runtime exception");
+            }
             InputStream bis = attachinfo.value.getDataSource().getInputStream();
             byte b[] = new byte[6];
             bis.read(b, 0, 6);



Mime
View raw message