diff options
Diffstat (limited to '')
8 files changed, 35 insertions, 12 deletions
diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReferenceImpl.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReferenceImpl.java index a2cb1b6763..e0611f3ddc 100644 --- a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReferenceImpl.java +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReferenceImpl.java @@ -31,8 +31,15 @@ public class HelloWorldReferenceImpl implements HelloWorldReference { person.setFirstName(firstName); person.setLastName(lastName); Person returnPerson = helloWorldService.getGreetings(person); + Person returnNullPerson = helloWorldService.getNullGreetings(person); - return returnPerson.getFirstName() + " " + returnPerson.getLastName(); + String returnString = returnPerson.getFirstName() + " " + returnPerson.getLastName(); + + if (returnNullPerson == null){ + returnString += " null"; + } + + return returnString; } } diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldService.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldService.java index 485e184f6c..fdbc894d3c 100644 --- a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldService.java +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldService.java @@ -27,6 +27,7 @@ import org.osoa.sca.annotations.Remotable; public interface HelloWorldService { public Person getGreetings(Person person); + public Person getNullGreetings(Person person); } diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldServiceImpl.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldServiceImpl.java index 4747136509..73f415cc3f 100644 --- a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldServiceImpl.java +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldServiceImpl.java @@ -28,5 +28,9 @@ public class HelloWorldServiceImpl implements HelloWorldService { return person; } + + public Person getNullGreetings(Person person){ + return null; + } } diff --git a/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSObjectTestCase.java b/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSObjectTestCase.java index 5306497a3f..aa34a53d01 100644 --- a/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSObjectTestCase.java +++ b/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSObjectTestCase.java @@ -52,7 +52,7 @@ public class FormatJMSObjectTestCase { HelloWorldReference helloWorldService = ((SCAClient) node).getService( HelloWorldReference.class, "HelloWorldReferenceComponent"); - assertEquals("Hello Fred Hello Bloggs", + assertEquals("Hello Fred Hello Bloggs null", helloWorldService.getGreetings("Fred", "Bloggs")); } diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/BytesMessageProcessor.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/BytesMessageProcessor.java index 047743654f..457b519051 100644 --- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/BytesMessageProcessor.java +++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/BytesMessageProcessor.java @@ -63,7 +63,11 @@ public class BytesMessageProcessor extends AbstractMessageProcessor { // TODO - an experiment. How to enforce a single // byte array parameter BytesMessage message = session.createBytesMessage(); - message.writeBytes((byte[])o); + + if (o != null){ + message.writeBytes((byte[])o); + } + return message; } catch (JMSException e) { diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/ObjectMessageProcessor.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/ObjectMessageProcessor.java index 4e07e4eab8..781d9fc93c 100644 --- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/ObjectMessageProcessor.java +++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/ObjectMessageProcessor.java @@ -54,12 +54,16 @@ public class ObjectMessageProcessor extends AbstractMessageProcessor { protected Message createJMSMessage(Session session, Object o) { try { - if (!(o instanceof Serializable)) { - throw new IllegalStateException("JMS ObjectMessage payload not Serializable: " + o); - } - ObjectMessage message = session.createObjectMessage(); - message.setObject((Serializable)o); + + if (o != null){ + if (!(o instanceof Serializable)) { + throw new IllegalStateException("JMS ObjectMessage payload not Serializable: " + o); + } + + message.setObject((Serializable)o); + } + return message; } catch (JMSException e) { diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/TextMessageProcessor.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/TextMessageProcessor.java index cf22e400b1..b87a206f03 100644 --- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/TextMessageProcessor.java +++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/TextMessageProcessor.java @@ -57,7 +57,11 @@ public class TextMessageProcessor extends AbstractMessageProcessor { try { TextMessage message = session.createTextMessage(); - message.setText(String.valueOf(o)); + + if (o != null){ + message.setText(String.valueOf(o)); + } + return message; } catch (JMSException e) { diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java index bb3c036287..f4eaa78eec 100644 --- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java +++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java @@ -93,12 +93,11 @@ public class WireFormatJMSObjectServiceInterceptor implements Interceptor { JMSBindingContext context = msg.getBindingContext(); Session session = context.getJmsSession(); - javax.jms.Message responseJMSMsg; + javax.jms.Message responseJMSMsg = null; if (msg.isFault()) { responseJMSMsg = responseMessageProcessor.createFaultMessage(session, (Throwable)msg.getBody()); } else { - Object response = msg.getBody(); - responseJMSMsg = responseMessageProcessor.insertPayloadIntoJMSMessage(session, response); + responseJMSMsg = responseMessageProcessor.insertPayloadIntoJMSMessage(session, msg.getBody()); } msg.setBody(responseJMSMsg); |