cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1532871 - /cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java
Date Wed, 16 Oct 2013 19:25:51 GMT
Author: dkulp
Date: Wed Oct 16 19:25:50 2013
New Revision: 1532871

URL: http://svn.apache.org/r1532871
Log:
If the dispatch throws an excpetion (likely from the fault out chain), try to do something
smart with it.

Modified:
    cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java

Modified: cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java?rev=1532871&r1=1532870&r2=1532871&view=diff
==============================================================================
--- cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java
(original)
+++ cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java
Wed Oct 16 19:25:50 2013
@@ -82,7 +82,23 @@ public class LocalConduit extends Abstra
                     ex.setInMessage(inMsg);
                     inMsg.setExchange(ex);
                     ex.put(IN_EXCHANGE, exchange);
-                    destination.getMessageObserver().onMessage(inMsg);
+                    try {
+                        destination.getMessageObserver().onMessage(inMsg);
+                    } catch (Throwable t) {
+                        Message m = inMsg.getExchange().getOutFaultMessage();
+                        if (m == null) {
+                            m = inMsg.getExchange().getOutMessage();
+                        }
+                        if (m != null) {
+                            try {
+                                m.put(Message.RESPONSE_CODE, 500);
+                                m.getExchange().put(Message.RESPONSE_CODE, 500);
+                                m.getContent(OutputStream.class).close();
+                            } catch (IOException e) {
+                                //ignore
+                            }
+                        }
+                    }
                 }
             };
             Executor ex = message.getExchange() != null



Mime
View raw message