tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sl...@apache.org
Subject svn commit: r747826 - in /tuscany/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms: provider/ wireformat/jmsbytes/runtime/ wireformat/jmsobject/runtime/ wireformat/jmstext/runtime/
Date Wed, 25 Feb 2009 15:33:02 GMT
Author: slaws
Date: Wed Feb 25 15:32:59 2009
New Revision: 747826

URL: http://svn.apache.org/viewvc?rev=747826&view=rev
Log:
TUSCANY-2867 - Pass checked exceptions as InvocationTargetExceptions. Don't rely on boolean
fault flag for messages of object type. Thanks for the patch Kaushik

Modified:
    tuscany/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/AbstractMessageProcessor.java
    tuscany/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/ObjectMessageProcessor.java
    tuscany/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceInterceptor.java
    tuscany/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceInterceptor.java
    tuscany/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceInterceptor.java

Modified: tuscany/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/AbstractMessageProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/AbstractMessageProcessor.java?rev=747826&r1=747825&r2=747826&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/AbstractMessageProcessor.java
(original)
+++ tuscany/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/AbstractMessageProcessor.java
Wed Feb 25 15:32:59 2009
@@ -93,7 +93,12 @@
     public Object extractPayloadFromJMSMessage(Message msg) {
         try {
             if (msg.getBooleanProperty(JMSBindingConstants.FAULT_PROPERTY)) {
-                throw new ServiceRuntimeException("remote service exception, see nested exception",
(Throwable)((ObjectMessage)msg).getObject());
+                Object exc = ((ObjectMessage)msg).getObject();
+                if (exc instanceof RuntimeException) {
+                    throw new ServiceRuntimeException("remote service exception, see nested
exception", (Throwable)exc);
+                } else {
+                    return new InvocationTargetException((Throwable) exc);
+                }
             }
         } catch (JMSException e) {
             throw new JMSBindingException(e);

Modified: tuscany/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/ObjectMessageProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/ObjectMessageProcessor.java?rev=747826&r1=747825&r2=747826&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/ObjectMessageProcessor.java
(original)
+++ tuscany/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/ObjectMessageProcessor.java
Wed Feb 25 15:32:59 2009
@@ -19,6 +19,7 @@
 package org.apache.tuscany.sca.binding.jms.provider;
 
 import java.io.Serializable;
+import java.lang.reflect.InvocationTargetException;
 import java.util.logging.Logger;
 
 import javax.jms.JMSException;
@@ -28,6 +29,7 @@
 
 import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
 import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
+import org.osoa.sca.ServiceRuntimeException;
 
 /**
  * MessageProcessor for sending/receiving Serializable objects with the JMSBinding.
@@ -77,4 +79,21 @@
         }
     }
 
+    @Override
+    public Object extractPayloadFromJMSMessage(Message msg) {
+        try {
+            Object o = ((ObjectMessage)msg).getObject();
+            if (o instanceof Throwable ) {
+                if (o instanceof RuntimeException) {
+                    throw new ServiceRuntimeException("remote service exception, see nested
exception", (RuntimeException)o);
+                } else {
+                    return new InvocationTargetException((Throwable) o);
+                }
+            }
+        } catch (JMSException e) {
+            throw new JMSBindingException(e);
+        }
+        return extractPayload(msg);
+    }
+    
 }

Modified: tuscany/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceInterceptor.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceInterceptor.java?rev=747826&r1=747825&r2=747826&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceInterceptor.java
(original)
+++ tuscany/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceInterceptor.java
Wed Feb 25 15:32:59 2009
@@ -19,6 +19,7 @@
 package org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.runtime;
 
 
+import java.lang.reflect.InvocationTargetException;
 import javax.jms.JMSException;
 import javax.jms.Session;
 
@@ -98,10 +99,14 @@
     public Message invokeResponse(Message msg) {
         if (msg.getBody() != null){
             Object response = responseMessageProcessor.extractPayloadFromJMSMessage((javax.jms.Message)msg.getBody());
-            if (response != null){
-                msg.setBody(response);
+            if (response instanceof InvocationTargetException) {
+                msg.setFaultBody(((InvocationTargetException) response).getCause());
             } else {
-                msg.setBody(null);
+                if (response != null){
+                    msg.setBody(response);
+                } else {
+                    msg.setBody(null);
+                }
             }
         }
 

Modified: tuscany/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceInterceptor.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceInterceptor.java?rev=747826&r1=747825&r2=747826&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceInterceptor.java
(original)
+++ tuscany/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceInterceptor.java
Wed Feb 25 15:32:59 2009
@@ -19,6 +19,7 @@
 package org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.runtime;
 
 
+import java.lang.reflect.InvocationTargetException;
 import javax.jms.JMSException;
 import javax.jms.Session;
 
@@ -92,10 +93,15 @@
     public Message invokeResponse(Message msg) {
         if (msg.getBody() != null){
             Object response = responseMessageProcessor.extractPayloadFromJMSMessage((javax.jms.Message)msg.getBody());
-            if (response != null){
-                msg.setBody(response);
+            
+            if (response instanceof InvocationTargetException) {
+                msg.setFaultBody(((InvocationTargetException) response).getCause());
             } else {
-                msg.setBody(null);
+                if (response != null){
+                    msg.setBody(response);
+                } else {
+                    msg.setBody(null);
+                }
             }
         }
 

Modified: tuscany/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceInterceptor.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceInterceptor.java?rev=747826&r1=747825&r2=747826&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceInterceptor.java
(original)
+++ tuscany/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceInterceptor.java
Wed Feb 25 15:32:59 2009
@@ -19,6 +19,7 @@
 package org.apache.tuscany.sca.binding.jms.wireformat.jmstext.runtime;
 
 
+import java.lang.reflect.InvocationTargetException;
 import javax.jms.JMSException;
 import javax.jms.Session;
 
@@ -99,10 +100,15 @@
     public Message invokeResponse(Message msg) {
         if (msg.getBody() != null){
             Object response = responseMessageProcessor.extractPayloadFromJMSMessage((javax.jms.Message)msg.getBody());
-            if (response != null ){
-                msg.setBody(response);
+            
+            if (response instanceof InvocationTargetException) {
+                msg.setFaultBody(((InvocationTargetException) response).getCause());
             } else {
-                msg.setBody(null);
+                if (response != null){
+                    msg.setBody(response);
+                } else {
+                    msg.setBody(null);
+                }
             }
         }
 



Mime
View raw message