From 6a86f1eebb4bce897d900b03cd498e3fceff1b66 Mon Sep 17 00:00:00 2001 From: Rajith Muditha Attapattu Date: Thu, 4 Mar 2010 03:40:48 +0000 Subject: BasicMessageProducer_0_10.java contains a fix for QPID-2428. I also changed the exception handling code to use initCause() instead of setLinkedException as the latter does not show the 'cause' properly. AMQSession_0_10.java was modified to include the 'name' in the error message thrown if the address does not resolve to an exchange or a queue. AddressHelper.java - added a null check. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@918842 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/qpid/client/AMQSession_0_10.java | 4 +++- .../apache/qpid/client/BasicMessageProducer_0_10.java | 16 ++++++++++++++-- .../qpid/client/messaging/address/AddressHelper.java | 3 ++- 3 files changed, 19 insertions(+), 4 deletions(-) (limited to 'java/client') diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java b/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java index 6ea338a667..71a4010d62 100644 --- a/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java +++ b/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java @@ -1128,7 +1128,9 @@ public class AMQSession_0_10 extends AMQSession appProps = messageProps.getApplicationHeaders(); + if (appProps == null) + { + appProps = new HashMap(); + } + appProps.put("qpid.subject",destination.getSubject()); + messageProps.setApplicationHeaders(appProps); + } messageProps.setContentLength(message.getContentLength()); @@ -201,7 +213,7 @@ public class BasicMessageProducer_0_10 extends BasicMessageProducer catch (RuntimeException rte) { JMSException ex = new JMSException("Exception when sending message"); - ex.setLinkedException(rte); + ex.initCause(rte); throw ex; } } diff --git a/java/client/src/main/java/org/apache/qpid/client/messaging/address/AddressHelper.java b/java/client/src/main/java/org/apache/qpid/client/messaging/address/AddressHelper.java index d1ea8dce2d..84bc4d596e 100644 --- a/java/client/src/main/java/org/apache/qpid/client/messaging/address/AddressHelper.java +++ b/java/client/src/main/java/org/apache/qpid/client/messaging/address/AddressHelper.java @@ -193,7 +193,8 @@ public class AddressHelper { List bindings = new ArrayList(); if (address.getOptions() != null && - address.getOptions().get(NODE_PROPS) != null) + address.getOptions().get(NODE_PROPS) != null && + ((Map)address.getOptions().get(NODE_PROPS)).get(X_PROPS) != null) { Map node_props = (Map)address.getOptions().get(NODE_PROPS); List bindingList = -- cgit v1.2.1