You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by mc...@apache.org on 2008/04/14 13:41:37 UTC

svn commit: r647737 - in /incubator/tuscany/java/sca/modules/core/src: main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java test/java/org/apache/tuscany/sca/core/wire/NonBlockingInterceptorTestCase.java

Author: mcombellack
Date: Mon Apr 14 04:41:35 2008
New Revision: 647737

URL: http://svn.apache.org/viewvc?rev=647737&view=rev
Log:
TUSCANY-2225 - Added code to handle the case where an Exception is thrown by a @OneWay method so the exception is not just silently ignored

Modified:
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java
    incubator/tuscany/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/NonBlockingInterceptorTestCase.java

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java?rev=647737&r1=647736&r2=647737&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java Mon Apr 14 04:41:35 2008
@@ -68,7 +68,15 @@
                 public void run() {
                     Message context = ThreadMessageContext.setMessageContext(msg);
                     try {
-                        next.invoke(msg);
+                        Message response = next.invoke(msg);
+
+                        // Tuscany-2225 - Did the @OneWay method complete successfully?
+                        // (i.e. no exceptions)
+                        if (response != null && response.isFault()) {
+                            // The @OneWay method threw an Exception.
+                            Throwable t = (Throwable) response.getBody();
+                            throw new ServiceRuntimeException("Exception from @OneWay invocation", t);
+                        }
                     } finally {
                         ThreadMessageContext.setMessageContext(context);
                     }

Modified: incubator/tuscany/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/NonBlockingInterceptorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/NonBlockingInterceptorTestCase.java?rev=647737&r1=647736&r2=647737&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/NonBlockingInterceptorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/NonBlockingInterceptorTestCase.java Mon Apr 14 04:41:35 2008
@@ -61,6 +61,7 @@
         //msg.setConversationID(convID);
         Interceptor next = EasyMock.createMock(Interceptor.class);
         EasyMock.expect(next.invoke(EasyMock.eq(msg))).andReturn(msg);
+        EasyMock.expect(msg.isFault()).andReturn(false);
         EasyMock.replay(next);
         EasyMock.replay(msg);
         Interceptor interceptor = new NonBlockingInterceptor(scheduler, next);



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org