From de7f650b16e6e77ea31f8967202dd8445bd64a5e Mon Sep 17 00:00:00 2001 From: James Strachan Date: Fri, 30 Dec 2005 18:25:15 +0000 Subject: [PATCH] avoid possible NPE; only set the redeliveryPolicy if there is one configured git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@360132 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/activemq/ActiveMQConnectionFactory.java | 4 +++- .../activemq/broker/region/PrefetchSubscription.java | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java b/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java index da2be112d0..867b9e7f28 100755 --- a/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java @@ -210,7 +210,9 @@ public class ActiveMQConnectionFactory implements ConnectionFactory, QueueConnec connection.setAsyncDispatch(isAsyncDispatch()); connection.setUseAsyncSend(isUseAsyncSend()); connection.setUseRetroactiveConsumer(isUseRetroactiveConsumer()); - connection.setRedeliveryPolicy(getRedeliveryPolicy()); + if (getRedeliveryPolicy() != null) { + connection.setRedeliveryPolicy(getRedeliveryPolicy()); + } if( clientID !=null ) connection.setClientID(clientID); diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java index 4c1ad1fdd0..93d9e9ae78 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java @@ -175,11 +175,14 @@ abstract public class PrefetchSubscription extends AbstractSubscription { Message message = node.getMessage(); if( message !=null ) { - // TODO is this meant to be == null - it was != ? - if( message.getOriginalDestination()==null ) + // TODO is this meant to be == null? + if( message.getOriginalDestination()!=null ) message.setOriginalDestination(message.getDestination()); ActiveMQDestination originalDestination = message.getOriginalDestination(); + if (originalDestination == null) { + originalDestination = message.getDestination(); + } DeadLetterStrategy deadLetterStrategy = node.getRegionDestination().getDeadLetterStrategy(); ActiveMQDestination deadLetterDestination = deadLetterStrategy.getDeadLetterQueueFor(originalDestination); message.setDestination(deadLetterDestination);