activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [3/4] activemq-artemis git commit: Remove unnecessary null checks and assignments
Date Tue, 05 Jul 2016 18:18:16 GMT
Remove unnecessary null checks and assignments


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

Branch: refs/heads/master
Commit: 149216e8ecc2ba812959ad696b0a664b1b2cf813
Parents: c4ab150
Author: Ville Skyttä <ville.skytta@iki.fi>
Authored: Sat Jul 2 00:31:06 2016 +0300
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Tue Jul 5 14:18:01 2016 -0400

----------------------------------------------------------------------
 .../artemis/core/client/impl/ServerLocatorImpl.java    | 11 +++--------
 .../java/org/apache/activemq/artemis/dto/XmlUtil.java  |  4 +---
 .../artemis/jms/bridge/impl/JMSBridgeControlImpl.java  |  3 ---
 .../artemis/jms/bridge/impl/JMSBridgeImpl.java         |  3 +--
 .../message/JMSMappingOutboundTransformer.java         | 13 ++++---------
 .../activemq/artemis/jms/example/SecurityExample.java  |  1 -
 6 files changed, 9 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/149216e8/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java
index e7c67cf..a2c1922 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java
@@ -787,7 +787,6 @@ public final class ServerLocatorImpl implements ServerLocatorInternal,
Discovery
             }
             catch (ActiveMQException e) {
                factory.close();
-               factory = null;
                if (e.getType() == ActiveMQExceptionType.NOT_CONNECTED) {
                   attempts++;
 
@@ -813,9 +812,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal,
Discovery
       // how the sendSubscription happens.
       // in case this ever changes.
       if (topology != null && !factory.waitForTopology(callTimeout, TimeUnit.MILLISECONDS))
{
-         if (factory != null) {
-            factory.cleanup();
-         }
+         factory.cleanup();
          throw ActiveMQClientMessageBundle.BUNDLE.connectionTimedOutOnReceiveTopology(discoveryGroup);
       }
 
@@ -1647,21 +1644,19 @@ public final class ServerLocatorImpl implements ServerLocatorInternal,
Discovery
 
          initialise();
 
-         ClientSessionFactory csf = null;
-
          createConnectors();
 
          try {
 
             int retryNumber = 0;
-            while (csf == null && !isClosed()) {
+            while (!isClosed()) {
                retryNumber++;
                for (Connector conn : connectors) {
                   if (logger.isDebugEnabled()) {
                      logger.debug(this + "::Submitting connect towards " + conn);
                   }
 
-                  csf = conn.tryConnect();
+                  ClientSessionFactory csf = conn.tryConnect();
 
                   if (csf != null) {
                      csf.getConnection().addFailureListener(new FailureListener() {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/149216e8/artemis-dto/src/main/java/org/apache/activemq/artemis/dto/XmlUtil.java
----------------------------------------------------------------------
diff --git a/artemis-dto/src/main/java/org/apache/activemq/artemis/dto/XmlUtil.java b/artemis-dto/src/main/java/org/apache/activemq/artemis/dto/XmlUtil.java
index 4b937a8..f474453 100644
--- a/artemis-dto/src/main/java/org/apache/activemq/artemis/dto/XmlUtil.java
+++ b/artemis-dto/src/main/java/org/apache/activemq/artemis/dto/XmlUtil.java
@@ -102,9 +102,7 @@ public class XmlUtil {
 
       XMLStreamReader reader = factory.createXMLStreamReader(new FileInputStream(configuration));
 
-      if (props != null) {
-         reader = new PropertiesFilter(reader, props);
-      }
+      reader = new PropertiesFilter(reader, props);
 
       return clazz.cast(unmarshaller.unmarshal(reader));
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/149216e8/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeControlImpl.java
----------------------------------------------------------------------
diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeControlImpl.java
b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeControlImpl.java
index 7734c9e..b457831 100644
--- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeControlImpl.java
+++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeControlImpl.java
@@ -176,9 +176,6 @@ public class JMSBridgeControlImpl extends StandardMBean implements JMSBridgeCont
       if (mode != null) {
          bridge.setQualityOfServiceMode(QualityOfServiceMode.valueOf(mode));
       }
-      else {
-         mode = null;
-      }
    }
 
    @Override

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/149216e8/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeImpl.java
----------------------------------------------------------------------
diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeImpl.java
b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeImpl.java
index 157305c..c363651 100644
--- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeImpl.java
+++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeImpl.java
@@ -1523,8 +1523,7 @@ public final class JMSBridgeImpl implements JMSBridge {
 
          targetProducer.send(targetDestination, msg, msg.getJMSDeliveryMode(), msg.getJMSPriority(),
timeToLive);
 
-         if (msg != null)
-            messageCount++;
+         messageCount++;
          if (JMSBridgeImpl.trace) {
             ActiveMQJMSBridgeLogger.LOGGER.trace("Sent message " + msg);
          }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/149216e8/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/proton/converter/message/JMSMappingOutboundTransformer.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/proton/converter/message/JMSMappingOutboundTransformer.java
b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/proton/converter/message/JMSMappingOutboundTransformer.java
index cc3c2ac..46dc269 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/proton/converter/message/JMSMappingOutboundTransformer.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/proton/converter/message/JMSMappingOutboundTransformer.java
@@ -148,16 +148,11 @@ public class JMSMappingOutboundTransformer extends OutboundTransformer
{
 
          String msgId = msg.getJMSMessageID();
 
-         if (msgId != null) {
-            try {
-               props.setMessageId(AMQPMessageIdHelper.INSTANCE.toIdObject(msgId));
-            }
-            catch (ActiveMQAMQPIllegalStateException e) {
-               props.setMessageId(msgId);
-            }
+         try {
+            props.setMessageId(AMQPMessageIdHelper.INSTANCE.toIdObject(msgId));
          }
-         else {
-            props.setMessageId(msgId.toString());
+         catch (ActiveMQAMQPIllegalStateException e) {
+            props.setMessageId(msgId);
          }
       }
       if (msg.getJMSDestination() != null) {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/149216e8/examples/features/standard/security-ldap/src/main/java/org/apache/activemq/artemis/jms/example/SecurityExample.java
----------------------------------------------------------------------
diff --git a/examples/features/standard/security-ldap/src/main/java/org/apache/activemq/artemis/jms/example/SecurityExample.java
b/examples/features/standard/security-ldap/src/main/java/org/apache/activemq/artemis/jms/example/SecurityExample.java
index 94f4b43..abf5fac 100644
--- a/examples/features/standard/security-ldap/src/main/java/org/apache/activemq/artemis/jms/example/SecurityExample.java
+++ b/examples/features/standard/security-ldap/src/main/java/org/apache/activemq/artemis/jms/example/SecurityExample.java
@@ -64,7 +64,6 @@ public class SecurityExample {
          }
 
          // Step 5. bill tries to make a connection using wrong password
-         billConnection = null;
          try {
             billConnection = createConnection("bill", "activemq1", cf);
             result = false;


Mime
View raw message