diff options
| author | Martin Ritchie <ritchiem@apache.org> | 2009-04-16 12:25:05 +0000 |
|---|---|---|
| committer | Martin Ritchie <ritchiem@apache.org> | 2009-04-16 12:25:05 +0000 |
| commit | a52c62ae6a7411adc70a7bfed6e237f42dd29028 (patch) | |
| tree | 73f355c275ceb0855609ad7d3cf84ed08f2f5cc1 /java/broker | |
| parent | 978d7d947295561a53f89b19971fe3344552e01e (diff) | |
| download | qpid-python-a52c62ae6a7411adc70a7bfed6e237f42dd29028.tar.gz | |
QPID-1813 : Check the value of _sessionIdentifier and return null if it is null rather than an NPE.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@765600 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/broker')
| -rw-r--r-- | java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessage.java | 24 | ||||
| -rw-r--r-- | java/broker/src/main/java/org/apache/qpid/server/subscription/SubscriptionImpl.java | 8 |
2 files changed, 25 insertions, 7 deletions
diff --git a/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessage.java b/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessage.java index a485649410..b987dae16d 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessage.java +++ b/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessage.java @@ -457,12 +457,32 @@ public class AMQMessage implements Filterable<AMQException> public Object getPublisherClientInstance() { - return _sessionIdentifier.getSessionInstance(); + //todo store sessionIdentifier/client id with message in store + //Currently the _sessionIdentifier will be null if the message has been + // restored from a message Store + if (_sessionIdentifier == null) + { + return null; + } + else + { + return _sessionIdentifier.getSessionInstance(); + } } public Object getPublisherIdentifier() { - return _sessionIdentifier.getSessionIdentifier(); + //todo store sessionIdentifier/client id with message in store + //Currently the _sessionIdentifier will be null if the message has been + // restored from a message Store + if (_sessionIdentifier == null) + { + return null; + } + else + { + return _sessionIdentifier.getSessionIdentifier(); + } } public void setClientIdentifier(final AMQProtocolSession.ProtocolSessionIdentifier sessionIdentifier) diff --git a/java/broker/src/main/java/org/apache/qpid/server/subscription/SubscriptionImpl.java b/java/broker/src/main/java/org/apache/qpid/server/subscription/SubscriptionImpl.java index a616c2ea35..7aa9d1e3af 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/subscription/SubscriptionImpl.java +++ b/java/broker/src/main/java/org/apache/qpid/server/subscription/SubscriptionImpl.java @@ -382,11 +382,10 @@ public abstract class SubscriptionImpl implements Subscription, FlowCreditManage // return false; } - - - //todo - client id should be recoreded and this test removed but handled below if (_noLocal) { + //todo - client id should be recoreded so we don't have to handle + // the case where this is null. final Object publisherId = entry.getMessage().getPublisherClientInstance(); // We don't want local messages so check to see if message is one we sent @@ -404,9 +403,8 @@ public abstract class SubscriptionImpl implements Subscription, FlowCreditManage { localInstance = getProtocolSession().getClientIdentifier(); - //todo - client id should be recoreded and this test removed but handled here - + //todo - client id should be recoreded so we don't have to do the null check if (localInstance != null && localInstance.equals(entry.getMessage().getPublisherIdentifier())) { return false; |
