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
This commit is contained in:
Hiram R. Chirino 2012-10-30 15:56:20 +00:00
parent 3c9c147e76
commit 822c4f37cb
1 changed files with 7 additions and 3 deletions

View File

@ -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() {