diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-02-17 16:48:32 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-02-17 16:48:32 +0000 |
commit | e5363963809401e48a2a70ff77f5a5aa087b0b1d (patch) | |
tree | a953c2f3b3ca992b6d43dd24dc81cb0975df8599 /branches | |
parent | 5d822e23be57e5a38572d96a621211b4a0ea81dc (diff) |
TUSCANY-2845: Change JMS binding so unchecked exceptions are returned as RuntimeExceptions
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@745140 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches')
3 files changed, 11 insertions, 8 deletions
diff --git a/branches/sca-java-1.x/itest/jms-nonscaclient-exceptions/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java b/branches/sca-java-1.x/itest/jms-nonscaclient-exceptions/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java index 2ccdbc021b..1dec4a6f92 100644 --- a/branches/sca-java-1.x/itest/jms-nonscaclient-exceptions/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java +++ b/branches/sca-java-1.x/itest/jms-nonscaclient-exceptions/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java @@ -42,7 +42,6 @@ import org.apache.tuscany.sca.host.embedded.SCADomain; import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.osoa.sca.ServiceRuntimeException;
import org.xml.sax.SAXException;
/**
@@ -103,7 +102,9 @@ public class ExceptionsTestCase { // FIXME: what should the response message be for unchecked exceptions with wireFormat.textXML???
Object o = ((ObjectMessage)m).getObject();
- assertTrue(o instanceof ServiceRuntimeException);
+ assertTrue(o instanceof RuntimeException);
+ assertTrue("java.lang.RuntimeException".equals(o.getClass().getName()));
+ assertEquals("java.lang.RuntimeException: bla", ((RuntimeException)o).getMessage());
}
@Test
@@ -147,9 +148,9 @@ public class ExceptionsTestCase { sendJMSObjectRequest("throwUnChecked");
Message m = receiveJMSResponse();
Object o = ((ObjectMessage)m).getObject();
- assertTrue(o instanceof ServiceRuntimeException);
- assertTrue(((ServiceRuntimeException)o).getCause() instanceof RuntimeException);
- assertEquals("bla", ((ServiceRuntimeException)o).getCause().getMessage());
+ assertTrue(o instanceof RuntimeException);
+ assertTrue("java.lang.RuntimeException".equals(o.getClass().getName()));
+ assertEquals("java.lang.RuntimeException: bla", ((RuntimeException)o).getMessage());
}
@After
diff --git a/branches/sca-java-1.x/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java b/branches/sca-java-1.x/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java index 0c56e09d52..bd326b36d2 100644 --- a/branches/sca-java-1.x/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java +++ b/branches/sca-java-1.x/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java @@ -96,7 +96,7 @@ public class ExceptionsTestCase { service.throwUnChecked(); fail(); } catch (Exception e) { - assertEquals("bla", e.getCause().getCause().getMessage()); + assertEquals("java.lang.RuntimeException: bla", e.getCause().getMessage()); } } diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/AbstractMessageProcessor.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/AbstractMessageProcessor.java index c69bac7641..d65522e541 100644 --- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/AbstractMessageProcessor.java +++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/AbstractMessageProcessor.java @@ -109,9 +109,11 @@ public abstract class AbstractMessageProcessor implements JMSMessageProcessor { try { ObjectMessage message = session.createObjectMessage(); - if (o instanceof ServiceRuntimeException && ((ServiceRuntimeException)o).getCause() instanceof InvocationTargetException) { - message.setObject(o.getCause() ); + String causeMsg; + if (o instanceof RuntimeException) { + message.setObject(new RuntimeException(o.getMessage())); } else { + // for a checked exception return the checked exception message.setObject(o); } message.setBooleanProperty(JMSBindingConstants.FAULT_PROPERTY, true); |