diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQSession.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQSession.java index 9cdcecfd4c..33209320fb 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQSession.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQSession.java @@ -473,7 +473,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { else { localTopic = new ActiveMQTopic(topic.getTopicName()); } - return internalCreateSharedConsumer(localTopic, name, messageSelector, ConsumerDurability.NON_DURABLE, true); + return internalCreateSharedConsumer(localTopic, name, messageSelector, ConsumerDurability.NON_DURABLE); } @Override @@ -523,7 +523,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { else { localTopic = new ActiveMQTopic(topic.getTopicName()); } - return internalCreateSharedConsumer(localTopic, name, messageSelector, ConsumerDurability.DURABLE, true); + return internalCreateSharedConsumer(localTopic, name, messageSelector, ConsumerDurability.DURABLE); } enum ConsumerDurability { @@ -536,8 +536,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { private ActiveMQMessageConsumer internalCreateSharedConsumer(final ActiveMQDestination dest, final String subscriptionName, String selectorString, - ConsumerDurability durability, - final boolean shared) throws JMSException { + ConsumerDurability durability) throws JMSException { try { if (dest.isQueue()) { diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v12/StompFrameHandlerV12.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v12/StompFrameHandlerV12.java index c774d117cc..5127dd0191 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v12/StompFrameHandlerV12.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v12/StompFrameHandlerV12.java @@ -16,7 +16,6 @@ */ package org.apache.activemq.artemis.core.protocol.stomp.v12; -import org.apache.activemq.artemis.core.protocol.stomp.FrameEventListener; import org.apache.activemq.artemis.core.protocol.stomp.ActiveMQStompException; import org.apache.activemq.artemis.core.protocol.stomp.Stomp; import org.apache.activemq.artemis.core.protocol.stomp.StompConnection; @@ -30,7 +29,7 @@ import org.apache.activemq.artemis.core.server.ServerMessage; import static org.apache.activemq.artemis.core.protocol.stomp.ActiveMQStompProtocolMessageBundle.BUNDLE; -public class StompFrameHandlerV12 extends StompFrameHandlerV11 implements FrameEventListener { +public class StompFrameHandlerV12 extends StompFrameHandlerV11 { public StompFrameHandlerV12(StompConnection connection) { super(connection); diff --git a/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/ComparisonExpression.java b/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/ComparisonExpression.java index 98882c94b4..05cbbe5fe4 100755 --- a/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/ComparisonExpression.java +++ b/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/ComparisonExpression.java @@ -158,7 +158,7 @@ public abstract class ComparisonExpression extends BinaryExpression implements B @Override public boolean matches(Filterable message) throws FilterException { Object object = evaluate(message); - return object != null && object == Boolean.TRUE; + return object == Boolean.TRUE; } } @@ -392,19 +392,19 @@ public abstract class ComparisonExpression extends BinaryExpression implements B } else if (lc == Byte.class) { if (rc == Short.class) { - lv = Short.valueOf(((Number) lv).shortValue()); + lv = ((Number) lv).shortValue(); } else if (rc == Integer.class) { - lv = Integer.valueOf(((Number) lv).intValue()); + lv = ((Number) lv).intValue(); } else if (rc == Long.class) { - lv = Long.valueOf(((Number) lv).longValue()); + lv = ((Number) lv).longValue(); } else if (rc == Float.class) { - lv = new Float(((Number) lv).floatValue()); + lv = ((Number) lv).floatValue(); } else if (rc == Double.class) { - lv = new Double(((Number) lv).doubleValue()); + lv = ((Number) lv).doubleValue(); } else if (convertStringExpressions && rc == String.class) { rv = Byte.valueOf((String) rv); @@ -415,16 +415,16 @@ public abstract class ComparisonExpression extends BinaryExpression implements B } else if (lc == Short.class) { if (rc == Integer.class) { - lv = Integer.valueOf(((Number) lv).intValue()); + lv = ((Number) lv).intValue(); } else if (rc == Long.class) { - lv = Long.valueOf(((Number) lv).longValue()); + lv = ((Number) lv).longValue(); } else if (rc == Float.class) { - lv = new Float(((Number) lv).floatValue()); + lv = ((Number) lv).floatValue(); } else if (rc == Double.class) { - lv = new Double(((Number) lv).doubleValue()); + lv = ((Number) lv).doubleValue(); } else if (convertStringExpressions && rc == String.class) { rv = Short.valueOf((String) rv); @@ -435,13 +435,13 @@ public abstract class ComparisonExpression extends BinaryExpression implements B } else if (lc == Integer.class) { if (rc == Long.class) { - lv = Long.valueOf(((Number) lv).longValue()); + lv = ((Number) lv).longValue(); } else if (rc == Float.class) { - lv = new Float(((Number) lv).floatValue()); + lv = ((Number) lv).floatValue(); } else if (rc == Double.class) { - lv = new Double(((Number) lv).doubleValue()); + lv = ((Number) lv).doubleValue(); } else if (convertStringExpressions && rc == String.class) { rv = Integer.valueOf((String) rv); @@ -452,13 +452,13 @@ public abstract class ComparisonExpression extends BinaryExpression implements B } else if (lc == Long.class) { if (rc == Integer.class) { - rv = Long.valueOf(((Number) rv).longValue()); + rv = ((Number) rv).longValue(); } else if (rc == Float.class) { - lv = new Float(((Number) lv).floatValue()); + lv = ((Number) lv).floatValue(); } else if (rc == Double.class) { - lv = new Double(((Number) lv).doubleValue()); + lv = ((Number) lv).doubleValue(); } else if (convertStringExpressions && rc == String.class) { rv = Long.valueOf((String) rv); @@ -468,14 +468,11 @@ public abstract class ComparisonExpression extends BinaryExpression implements B } } else if (lc == Float.class) { - if (rc == Integer.class) { - rv = new Float(((Number) rv).floatValue()); - } - else if (rc == Long.class) { - rv = new Float(((Number) rv).floatValue()); + if (rc == Integer.class || rc == Long.class) { + rv = ((Number) rv).floatValue(); } else if (rc == Double.class) { - lv = new Double(((Number) lv).doubleValue()); + lv = ((Number) lv).doubleValue(); } else if (convertStringExpressions && rc == String.class) { rv = Float.valueOf((String) rv); @@ -485,14 +482,8 @@ public abstract class ComparisonExpression extends BinaryExpression implements B } } else if (lc == Double.class) { - if (rc == Integer.class) { - rv = new Double(((Number) rv).doubleValue()); - } - else if (rc == Long.class) { - rv = new Double(((Number) rv).doubleValue()); - } - else if (rc == Float.class) { - rv = new Double(((Number) rv).doubleValue()); + if (rc == Integer.class || rc == Long.class || rc == Float.class) { + rv = ((Number) rv).doubleValue(); } else if (convertStringExpressions && rc == String.class) { rv = Double.valueOf((String) rv); @@ -545,7 +536,7 @@ public abstract class ComparisonExpression extends BinaryExpression implements B @Override public boolean matches(Filterable message) throws FilterException { Object object = evaluate(message); - return object != null && object == Boolean.TRUE; + return object == Boolean.TRUE; } } diff --git a/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/LogicExpression.java b/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/LogicExpression.java index b77d7b5246..4c9c294cfd 100755 --- a/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/LogicExpression.java +++ b/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/LogicExpression.java @@ -87,7 +87,7 @@ public abstract class LogicExpression extends BinaryExpression implements Boolea @Override public boolean matches(Filterable message) throws FilterException { Object object = evaluate(message); - return object != null && object == Boolean.TRUE; + return object == Boolean.TRUE; } } diff --git a/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/UnaryExpression.java b/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/UnaryExpression.java index 999e51d686..fb9832a69e 100755 --- a/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/UnaryExpression.java +++ b/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/UnaryExpression.java @@ -86,13 +86,7 @@ public abstract class UnaryExpression implements Expression { return null; } - if ((inList != null && inList.contains(rvalue)) ^ not) { - return Boolean.TRUE; - } - else { - return Boolean.FALSE; - } - + return (inList != null && inList.contains(rvalue)) ^ not; } @Override @@ -138,7 +132,7 @@ public abstract class UnaryExpression implements Expression { @Override public boolean matches(Filterable message) throws FilterException { Object object = evaluate(message); - return object != null && object == Boolean.TRUE; + return object == Boolean.TRUE; } } @@ -150,7 +144,7 @@ public abstract class UnaryExpression implements Expression { if (lvalue == null) { return null; } - return lvalue.booleanValue() ? Boolean.FALSE : Boolean.TRUE; + return !lvalue.booleanValue(); } @Override @@ -179,7 +173,7 @@ public abstract class UnaryExpression implements Expression { if (!rvalue.getClass().equals(Boolean.class)) { return Boolean.FALSE; } - return ((Boolean) rvalue).booleanValue() ? Boolean.TRUE : Boolean.FALSE; + return ((Boolean) rvalue).booleanValue(); } @Override @@ -197,16 +191,16 @@ public abstract class UnaryExpression implements Expression { private static Number negate(Number left) { Class clazz = left.getClass(); if (clazz == Integer.class) { - return new Integer(-left.intValue()); + return -left.intValue(); } else if (clazz == Long.class) { - return new Long(-left.longValue()); + return -left.longValue(); } else if (clazz == Float.class) { - return new Float(-left.floatValue()); + return -left.floatValue(); } else if (clazz == Double.class) { - return new Double(-left.doubleValue()); + return -left.doubleValue(); } else if (clazz == BigDecimal.class) { // We ussually get a big deciamal when we have Long.MIN_VALUE diff --git a/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/XPathExpression.java b/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/XPathExpression.java index 17481674a4..111fce953b 100755 --- a/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/XPathExpression.java +++ b/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/XPathExpression.java @@ -77,7 +77,7 @@ public final class XPathExpression implements BooleanExpression { @Override public boolean matches(Filterable message) throws FilterException { Object object = evaluate(message); - return object != null && object == Boolean.TRUE; + return object == Boolean.TRUE; } } diff --git a/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/XQueryExpression.java b/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/XQueryExpression.java index bfea39ed4e..3621f12162 100755 --- a/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/XQueryExpression.java +++ b/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/XQueryExpression.java @@ -46,7 +46,7 @@ public final class XQueryExpression implements BooleanExpression { @Override public boolean matches(Filterable message) throws FilterException { Object object = evaluate(message); - return object != null && object == Boolean.TRUE; + return object == Boolean.TRUE; } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java index 4bf80c3135..7ab5a89f23 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java @@ -265,13 +265,11 @@ public final class BindingsImpl implements Bindings { boolean routed = false; - if (!exclusiveBindings.isEmpty()) { - for (Binding binding : exclusiveBindings) { - if (binding.getFilter() == null || binding.getFilter().match(message)) { - binding.getBindable().route(message, context); + for (Binding binding : exclusiveBindings) { + if (binding.getFilter() == null || binding.getFilter().match(message)) { + binding.getBindable().route(message, context); - routed = true; - } + routed = true; } }