From 7ffa23799be0c0e43cc2db5423bac3ffbb06a7a8 Mon Sep 17 00:00:00 2001 From: Howard Gao Date: Wed, 17 Dec 2014 09:56:11 +0800 Subject: [PATCH] ACTIVEMQ6-61 SelectorParser package conflict with openwire tests The SelectorParser class in amq6 source code conflicts with the same class in activemq 5 client jar. The activemq 5 client jar is needed to run openwire tests where the activemq5 client interacts with amq6 broker. In tests they are usually in the same VM, so depending on the classpath order, whichever class is loaded it will be used by both client and broker. Unfortunately the method parse() in the class has different return types in the client jar and broker side jar. That will cause NoSuchMethod exception. The fix moves the broker side class into a different package, i.e. from org.apache.activemq.selector.SelectorParser to org.apache.activemq.selector.impl.SelectorParser --- .../java/org/apache/activemq/jms/client/ActiveMQSession.java | 2 +- .../java/org/apache/activemq/selector/{ => impl}/LRUCache.java | 2 +- .../org/apache/activemq/selector/{ => impl}/SelectorParser.java | 2 +- .../java/org/apache/activemq/selector/SelectorParserTest.java | 1 + .../test/java/org/apache/activemq/selector/SelectorTest.java | 1 + .../java/org/apache/activemq/core/filter/impl/FilterImpl.java | 2 +- 6 files changed, 6 insertions(+), 4 deletions(-) rename activemq-selector/src/main/java/org/apache/activemq/selector/{ => impl}/LRUCache.java (98%) mode change 100755 => 100644 rename activemq-selector/src/main/java/org/apache/activemq/selector/{ => impl}/SelectorParser.java (98%) diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/jms/client/ActiveMQSession.java b/activemq-jms-client/src/main/java/org/apache/activemq/jms/client/ActiveMQSession.java index d027fb3934..bb79174a47 100644 --- a/activemq-jms-client/src/main/java/org/apache/activemq/jms/client/ActiveMQSession.java +++ b/activemq-jms-client/src/main/java/org/apache/activemq/jms/client/ActiveMQSession.java @@ -52,7 +52,7 @@ import javax.transaction.xa.XAResource; import org.apache.activemq.api.core.ActiveMQException; import org.apache.activemq.api.core.ActiveMQQueueExistsException; import org.apache.activemq.selector.filter.FilterException; -import org.apache.activemq.selector.SelectorParser; +import org.apache.activemq.selector.impl.SelectorParser; import org.apache.activemq.api.core.SimpleString; import org.apache.activemq.api.core.client.ClientConsumer; import org.apache.activemq.api.core.client.ClientProducer; diff --git a/activemq-selector/src/main/java/org/apache/activemq/selector/LRUCache.java b/activemq-selector/src/main/java/org/apache/activemq/selector/impl/LRUCache.java old mode 100755 new mode 100644 similarity index 98% rename from activemq-selector/src/main/java/org/apache/activemq/selector/LRUCache.java rename to activemq-selector/src/main/java/org/apache/activemq/selector/impl/LRUCache.java index f454fcfb0c..4c535d8329 --- a/activemq-selector/src/main/java/org/apache/activemq/selector/LRUCache.java +++ b/activemq-selector/src/main/java/org/apache/activemq/selector/impl/LRUCache.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.selector; +package org.apache.activemq.selector.impl; import java.util.LinkedHashMap; import java.util.Map; diff --git a/activemq-selector/src/main/java/org/apache/activemq/selector/SelectorParser.java b/activemq-selector/src/main/java/org/apache/activemq/selector/impl/SelectorParser.java similarity index 98% rename from activemq-selector/src/main/java/org/apache/activemq/selector/SelectorParser.java rename to activemq-selector/src/main/java/org/apache/activemq/selector/impl/SelectorParser.java index 367d20a3d9..27c908162f 100644 --- a/activemq-selector/src/main/java/org/apache/activemq/selector/SelectorParser.java +++ b/activemq-selector/src/main/java/org/apache/activemq/selector/impl/SelectorParser.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.selector; +package org.apache.activemq.selector.impl; import java.io.StringReader; diff --git a/activemq-selector/src/test/java/org/apache/activemq/selector/SelectorParserTest.java b/activemq-selector/src/test/java/org/apache/activemq/selector/SelectorParserTest.java index 4699ea29b5..e48b112182 100755 --- a/activemq-selector/src/test/java/org/apache/activemq/selector/SelectorParserTest.java +++ b/activemq-selector/src/test/java/org/apache/activemq/selector/SelectorParserTest.java @@ -22,6 +22,7 @@ import org.apache.activemq.selector.filter.Expression; import org.apache.activemq.selector.filter.LogicExpression; import org.apache.activemq.selector.filter.PropertyExpression; import org.apache.activemq.selector.filter.XPathExpression; +import org.apache.activemq.selector.impl.SelectorParser; import org.junit.Assert; import org.junit.Test; diff --git a/activemq-selector/src/test/java/org/apache/activemq/selector/SelectorTest.java b/activemq-selector/src/test/java/org/apache/activemq/selector/SelectorTest.java index c0db4a924a..0e629de782 100755 --- a/activemq-selector/src/test/java/org/apache/activemq/selector/SelectorTest.java +++ b/activemq-selector/src/test/java/org/apache/activemq/selector/SelectorTest.java @@ -21,6 +21,7 @@ import java.util.HashMap; import org.apache.activemq.selector.filter.BooleanExpression; import org.apache.activemq.selector.filter.FilterException; import org.apache.activemq.selector.filter.Filterable; +import org.apache.activemq.selector.impl.SelectorParser; import org.junit.Assert; import org.junit.Test; diff --git a/activemq-server/src/main/java/org/apache/activemq/core/filter/impl/FilterImpl.java b/activemq-server/src/main/java/org/apache/activemq/core/filter/impl/FilterImpl.java index bc843b9ba2..72d84c0d49 100644 --- a/activemq-server/src/main/java/org/apache/activemq/core/filter/impl/FilterImpl.java +++ b/activemq-server/src/main/java/org/apache/activemq/core/filter/impl/FilterImpl.java @@ -21,7 +21,7 @@ import org.apache.activemq.core.server.ActiveMQServerLogger; import org.apache.activemq.selector.filter.BooleanExpression; import org.apache.activemq.selector.filter.FilterException; import org.apache.activemq.selector.filter.Filterable; -import org.apache.activemq.selector.SelectorParser; +import org.apache.activemq.selector.impl.SelectorParser; import org.apache.activemq.api.core.FilterConstants; import org.apache.activemq.api.core.SimpleString; import org.apache.activemq.core.filter.Filter;