qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgodf...@apache.org
Subject svn commit: r1723036 - in /qpid/java/trunk: broker-plugins/management-http/src/main/grammar/ broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/query/ common/src/main/grammar/ common/src/main/java/org/apache/q...
Date Tue, 05 Jan 2016 10:39:12 GMT
Author: rgodfrey
Date: Tue Jan  5 10:39:12 2016
New Revision: 1723036

URL: http://svn.apache.org/viewvc?rev=1723036&view=rev
Log:
QPID-6969 : fix behaviour of in for JMS selectors where property does not evaluate to a String
value

Modified:
    qpid/java/trunk/broker-plugins/management-http/src/main/grammar/ConfiguredObjectFilterParser.jj
    qpid/java/trunk/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/query/ConfiguredObjectFilterParser.java
    qpid/java/trunk/common/src/main/grammar/SelectorParser.jj
    qpid/java/trunk/common/src/main/java/org/apache/qpid/filter/ComparisonExpression.java
    qpid/java/trunk/common/src/main/java/org/apache/qpid/filter/UnaryExpression.java
    qpid/java/trunk/common/src/main/java/org/apache/qpid/filter/selector/SelectorParser.java

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/grammar/ConfiguredObjectFilterParser.jj
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/grammar/ConfiguredObjectFilterParser.jj?rev=1723036&r1=1723035&r2=1723036&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/grammar/ConfiguredObjectFilterParser.jj
(original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/grammar/ConfiguredObjectFilterParser.jj
Tue Jan  5 10:39:12 2016
@@ -86,8 +86,6 @@ import org.apache.qpid.server.model.Conf
 public class ConfiguredObjectFilterParser
 {
     private ConfiguredObjectExpressionFactory _factory;
-    private boolean _allowNonPropertyInExpressions;
-
 
     public ConfiguredObjectFilterParser()
     {
@@ -99,11 +97,6 @@ public class ConfiguredObjectFilterParse
         _factory = factory;
     }
 
-    public void allowNonPropertyInExpressions(boolean allow)
-    {
-      _allowNonPropertyInExpressions = allow;
-    }
-
     public BooleanExpression<ConfiguredObject> parseWhere(String sql) throws ParseException
     {
         this.ReInit(new StringReader(sql));
@@ -378,7 +371,7 @@ Expression comparisonExpression() :
 			        )*
 		        ")"
 		        {
-		           left = ComparisonExpression.createInFilter(left, list, _allowNonPropertyInExpressions
);
+		           left = ComparisonExpression.createInFilter(left, list, true );
 		        }
             |
 	        	LOOKAHEAD(2)
@@ -399,7 +392,7 @@ Expression comparisonExpression() :
 			        )*
 		        ")"
 		        {
-		           left = ComparisonExpression.createNotInFilter(left, list, _allowNonPropertyInExpressions);
+		           left = ComparisonExpression.createNotInFilter(left, list, true);
 		        }
 
         )*

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/query/ConfiguredObjectFilterParser.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/query/ConfiguredObjectFilterParser.java?rev=1723036&r1=1723035&r2=1723036&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/query/ConfiguredObjectFilterParser.java
(original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/query/ConfiguredObjectFilterParser.java
Tue Jan  5 10:39:12 2016
@@ -45,8 +45,6 @@ import org.apache.qpid.server.model.Conf
  */
 public class ConfiguredObjectFilterParser implements ConfiguredObjectFilterParserConstants
{
     private ConfiguredObjectExpressionFactory _factory;
-    private boolean _allowNonPropertyInExpressions;
-
 
     public ConfiguredObjectFilterParser()
     {
@@ -58,11 +56,6 @@ public class ConfiguredObjectFilterParse
         _factory = factory;
     }
 
-    public void allowNonPropertyInExpressions(boolean allow)
-    {
-      _allowNonPropertyInExpressions = allow;
-    }
-
     public BooleanExpression<ConfiguredObject> parseWhere(String sql) throws ParseException
     {
         this.ReInit(new StringReader(sql));
@@ -309,7 +302,7 @@ public class ConfiguredObjectFilterParse
                                             list.add( right );
                 }
                 jj_consume_token(37);
-                           left = ComparisonExpression.createInFilter(left, list, _allowNonPropertyInExpressions
);
+                           left = ComparisonExpression.createInFilter(left, list, true );
                 break;
               default:
                 if (jj_2_4(2)) {
@@ -333,7 +326,7 @@ public class ConfiguredObjectFilterParse
                                             list.add( right );
                   }
                   jj_consume_token(37);
-                           left = ComparisonExpression.createNotInFilter(left, list, _allowNonPropertyInExpressions);
+                           left = ComparisonExpression.createNotInFilter(left, list, true);
                 } else {
                   jj_consume_token(-1);
                   throw new ParseException();

Modified: qpid/java/trunk/common/src/main/grammar/SelectorParser.jj
URL: http://svn.apache.org/viewvc/qpid/java/trunk/common/src/main/grammar/SelectorParser.jj?rev=1723036&r1=1723035&r2=1723036&view=diff
==============================================================================
--- qpid/java/trunk/common/src/main/grammar/SelectorParser.jj (original)
+++ qpid/java/trunk/common/src/main/grammar/SelectorParser.jj Tue Jan  5 10:39:12 2016
@@ -83,8 +83,6 @@ import org.apache.qpid.filter.UnaryExpre
 public class SelectorParser<E>
 {
     private PropertyExpressionFactory<E> _factory;
-    private boolean _allowNonPropertyInExpressions;
-
 
     public SelectorParser()
     {
@@ -96,11 +94,6 @@ public class SelectorParser<E>
         _factory = factory;
     }
 
-    public void allowNonPropertyInExpressions(boolean allow)
-    {
-      _allowNonPropertyInExpressions = allow;
-    }
-
     public BooleanExpression<E> parse(String sql) throws ParseException
     {
         this.ReInit(new StringReader(sql));
@@ -363,7 +356,7 @@ Expression comparisonExpression() :
 			        )*
 		        ")"
 		        {
-		           left = ComparisonExpression.createInFilter(left, list, _allowNonPropertyInExpressions
);
+		           left = ComparisonExpression.createInFilter(left, list, false );
 		        }
             |
 	        	LOOKAHEAD(2)
@@ -384,7 +377,7 @@ Expression comparisonExpression() :
 			        )*
 		        ")"
 		        {
-		           left = ComparisonExpression.createNotInFilter(left, list, _allowNonPropertyInExpressions);
+		           left = ComparisonExpression.createNotInFilter(left, list, false);
 		        }
 
         )*

Modified: qpid/java/trunk/common/src/main/java/org/apache/qpid/filter/ComparisonExpression.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/common/src/main/java/org/apache/qpid/filter/ComparisonExpression.java?rev=1723036&r1=1723035&r2=1723036&view=diff
==============================================================================
--- qpid/java/trunk/common/src/main/java/org/apache/qpid/filter/ComparisonExpression.java
(original)
+++ qpid/java/trunk/common/src/main/java/org/apache/qpid/filter/ComparisonExpression.java
Tue Jan  5 10:39:12 2016
@@ -180,27 +180,27 @@ public abstract class ComparisonExpressi
         return UnaryExpression.createNOT(createLike(left, right, escape));
     }
 
-    public static <E> BooleanExpression<E> createInFilter(Expression<E>
left, List<?> elements, boolean allowNonProperties)
+    public static <E> BooleanExpression<E> createInFilter(Expression<E>
left, List<?> elements, boolean allowNonJms)
     {
 
-        if (!(allowNonProperties || left instanceof PropertyExpression))
+        if (!(allowNonJms || left instanceof PropertyExpression))
         {
             throw new SelectorParsingException("Expected a property for In expression, got:
" + left);
         }
 
-        return UnaryExpression.createInExpression(left, elements, false);
+        return UnaryExpression.createInExpression(left, elements, false, allowNonJms);
 
     }
 
-    public static <E> BooleanExpression<E> createNotInFilter(Expression<E>
left, List<?> elements, boolean allowNonProperties)
+    public static <E> BooleanExpression<E> createNotInFilter(Expression<E>
left, List<?> elements, boolean allowNonJms)
     {
 
-        if (!(allowNonProperties || left instanceof PropertyExpression))
+        if (!(allowNonJms || left instanceof PropertyExpression))
         {
             throw new SelectorParsingException("Expected a property for In expression, got:
" + left);
         }
 
-        return UnaryExpression.createInExpression(left, elements, true);
+        return UnaryExpression.createInExpression(left, elements, true, allowNonJms);
 
     }
 

Modified: qpid/java/trunk/common/src/main/java/org/apache/qpid/filter/UnaryExpression.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/common/src/main/java/org/apache/qpid/filter/UnaryExpression.java?rev=1723036&r1=1723035&r2=1723036&view=diff
==============================================================================
--- qpid/java/trunk/common/src/main/java/org/apache/qpid/filter/UnaryExpression.java (original)
+++ qpid/java/trunk/common/src/main/java/org/apache/qpid/filter/UnaryExpression.java Tue Jan
 5 10:39:12 2016
@@ -42,7 +42,10 @@ public abstract class UnaryExpression<T>
         return new NegativeExpression<>(left);
     }
 
-    public static <E> BooleanExpression<E> createInExpression(Expression<E>
right, List<?> elements, final boolean not)
+    public static <E> BooleanExpression<E> createInExpression(Expression<E>
right,
+                                                              List<?> elements,
+                                                              final boolean not,
+                                                              final boolean allowNonJms)
     {
 
         // Use a HashSet if there are many elements.
@@ -62,7 +65,7 @@ public abstract class UnaryExpression<T>
 
         final Collection<?> inList = t;
 
-        return new InExpression<>(right, inList, not);
+        return new InExpression<>(right, inList, not, allowNonJms);
     }
 
     abstract static class BooleanUnaryExpression<E> extends UnaryExpression<E>
implements BooleanExpression<E>
@@ -210,19 +213,24 @@ public abstract class UnaryExpression<T>
     {
         private final Collection<?> _inList;
         private final boolean _not;
+        private final boolean _allowNonJms;
 
-        public InExpression(final Expression<E> right, final Collection<?> inList,
final boolean not)
+        public InExpression(final Expression<E> right,
+                            final Collection<?> inList,
+                            final boolean not,
+                            final boolean allowNonJms)
         {
             super(right);
             _inList = inList;
             _not = not;
+            _allowNonJms = allowNonJms;
         }
 
         public Object evaluate(E message)
         {
 
             Object rvalue = getRight().evaluate(message);
-            if (rvalue == null)
+            if (rvalue == null || !(_allowNonJms || rvalue instanceof String))
             {
                 return null;
             }

Modified: qpid/java/trunk/common/src/main/java/org/apache/qpid/filter/selector/SelectorParser.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/common/src/main/java/org/apache/qpid/filter/selector/SelectorParser.java?rev=1723036&r1=1723035&r2=1723036&view=diff
==============================================================================
--- qpid/java/trunk/common/src/main/java/org/apache/qpid/filter/selector/SelectorParser.java
(original)
+++ qpid/java/trunk/common/src/main/java/org/apache/qpid/filter/selector/SelectorParser.java
Tue Jan  5 10:39:12 2016
@@ -1,23 +1,23 @@
 /* Generated By:JavaCC: Do not edit this line. SelectorParser.java */
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
  */
 
 package org.apache.qpid.filter.selector;
@@ -35,14 +35,13 @@ import org.apache.qpid.filter.PropertyEx
 import org.apache.qpid.filter.PropertyExpressionFactory;
 import org.apache.qpid.filter.UnaryExpression;
 
-/**
- * JMS Selector Parser generated by JavaCC
- *
- * Do not edit this .java file directly - it is autogenerated from SelectorParser.jj
+/**
+ * JMS Selector Parser generated by JavaCC
+ *
+ * Do not edit this .java file directly - it is autogenerated from SelectorParser.jj
  */
 public class SelectorParser<E> implements SelectorParserConstants {
     private PropertyExpressionFactory<E> _factory;
-    private boolean _allowNonPropertyInExpressions;
 
 
     public SelectorParser()
@@ -55,11 +54,6 @@ public class SelectorParser<E> implement
         _factory = factory;
     }
 
-    public void allowNonPropertyInExpressions(boolean allow)
-    {
-      _allowNonPropertyInExpressions = allow;
-    }
-
     public BooleanExpression<E> parse(String sql) throws ParseException
     {
         this.ReInit(new StringReader(sql));
@@ -81,9 +75,9 @@ public class SelectorParser<E> implement
         throw new ParseException("Expression will not result in a boolean value: " + value);
     }
 
-// ----------------------------------------------------------------------------
-// Grammer
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// Grammer
+// ----------------------------------------------------------------------------
   final public BooleanExpression JmsSelector() throws ParseException {
     Expression left=null;
     left = orExpression();
@@ -297,7 +291,7 @@ public class SelectorParser<E> implement
                                             list.add( t );
                 }
                 jj_consume_token(35);
-                           left = ComparisonExpression.createInFilter(left, list, _allowNonPropertyInExpressions
);
+                           left = ComparisonExpression.createInFilter(left, list, false );
                 break;
               default:
                 if (jj_2_4(2)) {
@@ -321,7 +315,7 @@ public class SelectorParser<E> implement
                                             list.add( t );
                   }
                   jj_consume_token(35);
-                           left = ComparisonExpression.createNotInFilter(left, list, _allowNonPropertyInExpressions);
+                           left = ComparisonExpression.createNotInFilter(left, list, false);
                 } else {
                   jj_consume_token(-1);
                   throw new ParseException();



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message