activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbert...@apache.org
Subject [2/2] activemq-artemis git commit: Remove unnecessary code
Date Mon, 04 Apr 2016 16:05:28 GMT
Remove unnecessary code


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/3a2d5de4
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/3a2d5de4
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/3a2d5de4

Branch: refs/heads/master
Commit: 3a2d5de49e7408bc8be8bb3bddf308a80ce1d0be
Parents: 6fbf80e
Author: Ville Skyttä <ville.skytta@iki.fi>
Authored: Sat Mar 26 15:02:05 2016 +0200
Committer: jbertram <jbertram@apache.org>
Committed: Mon Apr 4 11:04:49 2016 -0500

----------------------------------------------------------------------
 .../artemis/jms/client/ActiveMQSession.java     |  7 ++-
 .../stomp/v12/StompFrameHandlerV12.java         |  3 +-
 .../selector/filter/ComparisonExpression.java   | 53 ++++++++------------
 .../selector/filter/LogicExpression.java        |  2 +-
 .../selector/filter/UnaryExpression.java        | 22 +++-----
 .../selector/filter/XPathExpression.java        |  2 +-
 .../selector/filter/XQueryExpression.java       |  2 +-
 .../core/postoffice/impl/BindingsImpl.java      | 10 ++--
 8 files changed, 41 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3a2d5de4/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQSession.java
----------------------------------------------------------------------
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 9cdcecf..3320932 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()) {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3a2d5de4/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v12/StompFrameHandlerV12.java
----------------------------------------------------------------------
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 c774d11..5127dd0 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);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3a2d5de4/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/ComparisonExpression.java
----------------------------------------------------------------------
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 98882c9..05cbbe5 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;
    }
 
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3a2d5de4/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/LogicExpression.java
----------------------------------------------------------------------
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 b77d7b5..4c9c294 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;
    }
 
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3a2d5de4/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/UnaryExpression.java
----------------------------------------------------------------------
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 999e51d..fb9832a 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

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3a2d5de4/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/XPathExpression.java
----------------------------------------------------------------------
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 1748167..111fce9 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;
    }
 
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3a2d5de4/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/XQueryExpression.java
----------------------------------------------------------------------
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 bfea39e..3621f12 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;
    }
 
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3a2d5de4/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java
----------------------------------------------------------------------
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 4bf80c3..7ab5a89 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;
          }
       }
 


Mime
View raw message