diff options
author | Rajith Muditha Attapattu <rajith@apache.org> | 2011-03-07 21:38:52 +0000 |
---|---|---|
committer | Rajith Muditha Attapattu <rajith@apache.org> | 2011-03-07 21:38:52 +0000 |
commit | ab3a8d6bf4f22b7271047bbf4377fdbb9135bbeb (patch) | |
tree | aff5047eed658ff7259b5f18cd8a850c303a6b05 | |
parent | a53705eb2513e91efdbece8133fe052c261c52d7 (diff) | |
download | qpid-python-ab3a8d6bf4f22b7271047bbf4377fdbb9135bbeb.tar.gz |
QPID-3109
Added a null check for the destination in both MessageConsumer and MessageProducer close methods.
According to the JMS spec the MessageProducer can be created with a null destination and still be used properly by specifying a destination on the send. Therefore this null check especially important on the message producer side.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1078961 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_10.java | 3 | ||||
-rw-r--r-- | qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_10.java b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_10.java index 1c7c9a7bb5..964c238946 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_10.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_10.java @@ -23,6 +23,7 @@ import org.apache.qpid.client.AMQDestination.AddressOption; import org.apache.qpid.client.AMQDestination.DestSyntax; import org.apache.qpid.client.failover.FailoverException; import org.apache.qpid.client.message.*; +import org.apache.qpid.client.messaging.address.Node.QueueNode; import org.apache.qpid.client.protocol.AMQProtocolHandler; import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.framing.FieldTable; @@ -515,7 +516,7 @@ public class BasicMessageConsumer_0_10 extends BasicMessageConsumer<UnprocessedM void cleanupQueue() throws AMQException, FailoverException { AMQDestination dest = this.getDestination(); - if (dest.getDestSyntax() == AMQDestination.DestSyntax.ADDR) + if (dest != null && dest.getDestSyntax() == AMQDestination.DestSyntax.ADDR) { if (dest.getDelete() == AddressOption.ALWAYS || dest.getDelete() == AddressOption.RECEIVER ) diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java index 0e3f4a5524..a6fc1d6997 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java @@ -34,6 +34,7 @@ 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; +import org.apache.qpid.client.messaging.address.Node.QueueNode; import org.apache.qpid.client.protocol.AMQProtocolHandler; import org.apache.qpid.transport.DeliveryProperties; import org.apache.qpid.transport.Header; @@ -242,11 +243,11 @@ public class BasicMessageProducer_0_10 extends BasicMessageProducer } @Override - public void close() + public void close() throws JMSException { super.close(); AMQDestination dest = _destination; - if (dest.getDestSyntax() == AMQDestination.DestSyntax.ADDR) + if (dest != null && dest.getDestSyntax() == AMQDestination.DestSyntax.ADDR) { if (dest.getDelete() == AddressOption.ALWAYS || dest.getDelete() == AddressOption.SENDER ) |