From 822c4f37cba69c5c2b32053d0169b0d5723a2548 Mon Sep 17 00:00:00 2001 From: "Hiram R. Chirino" Date: Tue, 30 Oct 2012 15:56:20 +0000 Subject: [PATCH] Protect against a possible NPE in the selector handling logic. git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1403753 13f79535-47bb-0310-9956-ffa450edef68 --- .../activemq/transport/amqp/AmqpProtocolConverter.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java b/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java index 275fcb9b08..d7e98afe29 100644 --- a/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java +++ b/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java @@ -58,6 +58,7 @@ class AmqpProtocolConverter { static final public byte[] EMPTY_BYTE_ARRAY = new byte[]{}; private final AmqpTransport amqpTransport; private static final Symbol COPY = Symbol.getSymbol("copy"); + private static final Symbol JMS_SELECTOR = Symbol.valueOf("jms-selector"); public AmqpProtocolConverter(AmqpTransport amqpTransport, BrokerContext brokerContext) { this.amqpTransport = amqpTransport; @@ -887,10 +888,13 @@ class AmqpProtocolConverter { if( source.getDistributionMode() == COPY) { consumerInfo.setBrowser(true); } - Map filter = ((org.apache.qpid.proton.type.messaging.Source)source).getFilter(); + + Map filter = source.getFilter(); if (filter != null) { - DescribedType type = (DescribedType)filter.get(Symbol.valueOf("jms-selector")); - consumerInfo.setSelector(type.getDescribed().toString()); + DescribedType value = (DescribedType)filter.get(JMS_SELECTOR); + if( value!=null ) { + consumerInfo.setSelector(value.getDescribed().toString()); + } } sendToActiveMQ(consumerInfo, new ResponseHandler() {