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
This commit is contained in:
James Strachan 2005-12-30 18:25:15 +00:00
parent 80f5e0ced1
commit de7f650b16
2 changed files with 8 additions and 3 deletions

View File

@ -210,7 +210,9 @@ public class ActiveMQConnectionFactory implements ConnectionFactory, QueueConnec
connection.setAsyncDispatch(isAsyncDispatch());
connection.setUseAsyncSend(isUseAsyncSend());
connection.setUseRetroactiveConsumer(isUseRetroactiveConsumer());
if (getRedeliveryPolicy() != null) {
connection.setRedeliveryPolicy(getRedeliveryPolicy());
}
if( clientID !=null )
connection.setClientID(clientID);

View File

@ -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);