summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/modules/binding-jms-runtime/src/main
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-02-06 11:15:45 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-02-06 11:15:45 +0000
commit881f8d2bf9283e9087530898d059c8e7c7a7c018 (patch)
treef811fcf1ab2cefcb549288564f7c77571c3c5119 /branches/sca-java-1.x/modules/binding-jms-runtime/src/main
parentb0a546d5031b286358f3971c90abe2de0203eaeb (diff)
TUSCANY-2799 Fix NPE in JMS Object wire format when a null object is returned. Add a test also.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@741535 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/BytesMessageProcessor.java6
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/ObjectMessageProcessor.java14
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/TextMessageProcessor.java6
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java5
4 files changed, 21 insertions, 10 deletions
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);