diff options
| author | Rajith Muditha Attapattu <rajith@apache.org> | 2010-03-04 03:40:48 +0000 |
|---|---|---|
| committer | Rajith Muditha Attapattu <rajith@apache.org> | 2010-03-04 03:40:48 +0000 |
| commit | 6a86f1eebb4bce897d900b03cd498e3fceff1b66 (patch) | |
| tree | 36d90e4933a9a5b752bf0673507f964b8246c03d /java/client | |
| parent | b3197f88032c1fe9dc92db4bcb97b9d014f02cbc (diff) | |
| download | qpid-python-6a86f1eebb4bce897d900b03cd498e3fceff1b66.tar.gz | |
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
Diffstat (limited to 'java/client')
3 files changed, 19 insertions, 4 deletions
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<BasicMessageConsumer_0_10, Basic } else { - throw new AMQException("The name supplied in the address doesn't resolve to an exchange or a queue"); + throw new AMQException( + "The name '" + dest.getName() + + "' supplied in the address doesn't resolve to an exchange or a queue"); } } diff --git a/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java b/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java index 4cc419b0cf..045cb24454 100644 --- a/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java +++ b/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java @@ -21,13 +21,14 @@ import static org.apache.qpid.transport.Option.NONE; import static org.apache.qpid.transport.Option.SYNC; import java.nio.ByteBuffer; +import java.util.HashMap; +import java.util.Map; import java.util.UUID; import javax.jms.DeliveryMode; import javax.jms.JMSException; import javax.jms.Message; -import org.apache.qpid.client.AMQDestination.AddressOption; import org.apache.qpid.client.AMQDestination.DestSyntax; import org.apache.qpid.client.message.AMQMessageDelegate_0_10; import org.apache.qpid.client.message.AbstractJMSMessage; @@ -166,6 +167,17 @@ public class BasicMessageProducer_0_10 extends BasicMessageProducer { deliveryProp.setRoutingKey(routingKey); } + + if (destination.getSubject() != null && !destination.getSubject().equals("")) + { + Map<String,Object> appProps = messageProps.getApplicationHeaders(); + if (appProps == null) + { + appProps = new HashMap<String,Object>(); + } + 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<Binding> bindings = new ArrayList<Binding>(); 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<String> bindingList = |
