summaryrefslogtreecommitdiff
path: root/qpid/java
diff options
context:
space:
mode:
authorMartin Ritchie <ritchiem@apache.org>2009-04-16 12:25:05 +0000
committerMartin Ritchie <ritchiem@apache.org>2009-04-16 12:25:05 +0000
commitb8c12102dc971a13703a3c909e9b6bdddabff6a3 (patch)
tree234c880e14de5e5f2e601823ba8a781e19a128c8 /qpid/java
parent7d67ca405dbcca6f2d8a0393f5f035e48c10a22d (diff)
downloadqpid-python-b8c12102dc971a13703a3c909e9b6bdddabff6a3.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@765600 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessage.java24
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/subscription/SubscriptionImpl.java8
2 files changed, 25 insertions, 7 deletions
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessage.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessage.java
index a485649410..b987dae16d 100644
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessage.java
+++ b/qpid/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/qpid/java/broker/src/main/java/org/apache/qpid/server/subscription/SubscriptionImpl.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/subscription/SubscriptionImpl.java
index a616c2ea35..7aa9d1e3af 100644
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/subscription/SubscriptionImpl.java
+++ b/qpid/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;