activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1403753 - /activemq/trunk/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java
Date Tue, 30 Oct 2012 15:56:21 GMT
Author: chirino
Date: Tue Oct 30 15:56:20 2012
New Revision: 1403753

URL: http://svn.apache.org/viewvc?rev=1403753&view=rev
Log:
Protect against a possible NPE in the selector handling logic.

Modified:
    activemq/trunk/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java

Modified: activemq/trunk/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java?rev=1403753&r1=1403752&r2=1403753&view=diff
==============================================================================
--- activemq/trunk/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java
(original)
+++ activemq/trunk/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java
Tue Oct 30 15:56:20 2012
@@ -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() {



Mime
View raw message