activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [1/2] activemq-artemis git commit: Remove redundant null checks
Date Mon, 07 Mar 2016 20:16:04 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 87fc396d2 -> ce7d93df2


Remove redundant null checks


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

Branch: refs/heads/master
Commit: 516d7df7ccff6fcf65a4b9fab1af4ae8f91258b6
Parents: 8cbcc80
Author: Ville Skyttä <ville.skytta@iki.fi>
Authored: Sat Mar 5 11:29:34 2016 +0200
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Mon Mar 7 15:10:17 2016 -0500

----------------------------------------------------------------------
 .../artemis/core/client/impl/ServerLocatorImpl.java   |  4 +---
 .../artemis/core/remoting/impl/ssl/SSLSupport.java    |  4 ++--
 .../activemq/artemis/jlibaio/util/CallbackCache.java  | 10 ++++------
 .../java/org/apache/activemq/artemis/rest/Jms.java    |  3 +--
 .../core/paging/cursor/impl/PageSubscriptionImpl.java |  2 +-
 .../activemq/artemis/core/server/impl/QueueImpl.java  |  8 +++-----
 .../artemis/core/server/impl/ServerConsumerImpl.java  |  8 ++------
 .../server/management/impl/ManagementServiceImpl.java | 14 ++++++++------
 .../core/security/ActiveMQSecurityManagerImpl.java    |  2 +-
 .../spi/core/security/jaas/LDAPLoginModule.java       |  8 ++------
 .../artemis/jms/example/JMSBridgeExample.java         |  4 +---
 .../activemq/artemis/jms/example/SecurityExample.java |  1 -
 .../apache/activemq/JmsRollbackRedeliveryTest.java    |  6 +++---
 .../java/org/apache/activemq/bugs/AMQ4671Test.java    |  4 +---
 .../java/org/apache/activemq/bugs/AMQ4952Test.java    |  6 ++----
 .../activemq/bugs/RedeliveryPluginHeaderTest.java     |  4 +---
 .../java/org/apache/activemq/config/ConfigTest.java   |  4 +---
 .../jndi/ActiveMQInitialContextFactoryTest.java       |  3 ---
 .../org/apache/activemq/jndi/InitialContextTest.java  |  4 ----
 .../artemis/tests/integration/divert/DivertTest.java  |  1 -
 .../jms/server/management/JMSServerControlTest.java   |  8 ++------
 21 files changed, 36 insertions(+), 72 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/516d7df7/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 53ba9df..e7cc55a 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
@@ -809,9 +809,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);
       }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/516d7df7/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/ssl/SSLSupport.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/ssl/SSLSupport.java
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/ssl/SSLSupport.java
index 092b1c7..5320bac 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/ssl/SSLSupport.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/ssl/SSLSupport.java
@@ -81,7 +81,7 @@ public class SSLSupport {
    private static TrustManager[] loadTrustManager(final String trustStoreProvider,
                                                   final String trustStorePath,
                                                   final String trustStorePassword) throws
Exception {
-      if (trustStorePath == null && (trustStoreProvider == null || (trustStoreProvider
!= null && !"PKCS11".equals(trustStoreProvider.toUpperCase())))) {
+      if (trustStorePath == null && (trustStoreProvider == null || !"PKCS11".equals(trustStoreProvider.toUpperCase())))
{
          return null;
       }
       else {
@@ -120,7 +120,7 @@ public class SSLSupport {
    private static KeyManager[] loadKeyManagers(final String keyStoreProvider,
                                                final String keystorePath,
                                                final String keystorePassword) throws Exception
{
-      if (keystorePath == null && (keyStoreProvider == null || (keyStoreProvider
!= null && !"PKCS11".equals(keyStoreProvider.toUpperCase())))) {
+      if (keystorePath == null && (keyStoreProvider == null || !"PKCS11".equals(keyStoreProvider.toUpperCase())))
{
          return null;
       }
       else {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/516d7df7/artemis-native/src/main/java/org/apache/activemq/artemis/jlibaio/util/CallbackCache.java
----------------------------------------------------------------------
diff --git a/artemis-native/src/main/java/org/apache/activemq/artemis/jlibaio/util/CallbackCache.java
b/artemis-native/src/main/java/org/apache/activemq/artemis/jlibaio/util/CallbackCache.java
index 00a3826..2205103 100644
--- a/artemis-native/src/main/java/org/apache/activemq/artemis/jlibaio/util/CallbackCache.java
+++ b/artemis-native/src/main/java/org/apache/activemq/artemis/jlibaio/util/CallbackCache.java
@@ -49,12 +49,10 @@ public class CallbackCache<Callback extends SubmitInfo> {
             if (retValue == null) {
                throw new NullPointerException("You should initialize the pool before using
it");
             }
-            if (retValue != null) {
-               available--;
-               get++;
-               if (get >= size) {
-                  get = 0;
-               }
+            available--;
+            get++;
+            if (get >= size) {
+               get = 0;
             }
             return retValue;
          }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/516d7df7/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/Jms.java
----------------------------------------------------------------------
diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/Jms.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/Jms.java
index 5f25d48..692bddb 100644
--- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/Jms.java
+++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/Jms.java
@@ -109,8 +109,7 @@ public class Jms {
 
    public static boolean isHttpMessage(Message message) {
       try {
-         Boolean aBoolean = message.getBooleanProperty(HttpMessageHelper.POSTED_AS_HTTP_MESSAGE);
-         return aBoolean != null && aBoolean.booleanValue() == true;
+         return message.getBooleanProperty(HttpMessageHelper.POSTED_AS_HTTP_MESSAGE);
       }
       catch (JMSException e) {
          return false;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/516d7df7/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java
index 3b74b76..eae44dd 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java
@@ -1236,7 +1236,7 @@ final class PageSubscriptionImpl implements PageSubscription {
                else if (ignored) {
                   positionIgnored(message.getPosition());
                }
-            } while (message != null && !match);
+            } while (!match);
 
             if (message != null) {
                lastOperation = lastPosition;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/516d7df7/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
index b74ecc4..8bf5d08 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
@@ -2943,12 +2943,10 @@ public class QueueImpl implements Queue {
 
                         props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS, address);
 
-                        if (connection != null) {
-                           props.putSimpleStringProperty(ManagementHelper.HDR_REMOTE_ADDRESS,
SimpleString.toSimpleString(connection.getRemoteAddress()));
+                        props.putSimpleStringProperty(ManagementHelper.HDR_REMOTE_ADDRESS,
SimpleString.toSimpleString(connection.getRemoteAddress()));
 
-                           if (connection.getID() != null) {
-                              props.putSimpleStringProperty(ManagementHelper.HDR_CONNECTION_NAME,
SimpleString.toSimpleString(connection.getID().toString()));
-                           }
+                        if (connection.getID() != null) {
+                           props.putSimpleStringProperty(ManagementHelper.HDR_CONNECTION_NAME,
SimpleString.toSimpleString(connection.getID().toString()));
                         }
 
                         props.putLongProperty(ManagementHelper.HDR_CONSUMER_NAME, serverConsumer.getID());

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/516d7df7/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java
index 1cfc4f8..25c657e 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java
@@ -682,9 +682,7 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener
{
 
             if (ref == null) {
                ActiveMQIllegalStateException ils = ActiveMQMessageBundle.BUNDLE.consumerNoReference(id,
messageID, messageQueue.getName());
-               if (tx != null) {
-                  tx.markAsRollbackOnly(ils);
-               }
+               tx.markAsRollbackOnly(ils);
                throw ils;
             }
 
@@ -752,9 +750,7 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener
{
 
          if (ref == null) {
             ActiveMQIllegalStateException ils = new ActiveMQIllegalStateException("Cannot
find ref to ack " + messageID);
-            if (tx != null) {
-               tx.markAsRollbackOnly(ils);
-            }
+            tx.markAsRollbackOnly(ils);
             throw ils;
          }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/516d7df7/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java
index c4d0cd6..a65498d 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java
@@ -392,13 +392,14 @@ public class ManagementServiceImpl implements ManagementService {
          catch (Exception e) {
             ActiveMQServerLogger.LOGGER.managementOperationError(e, operation, resourceName);
             reply.putBooleanProperty(ManagementHelper.HDR_OPERATION_SUCCEEDED, false);
-            String exceptionMessage = e.getMessage();
+            String exceptionMessage;
             if (e instanceof InvocationTargetException) {
                exceptionMessage = ((InvocationTargetException) e).getTargetException().getMessage();
             }
-            if (e != null) {
-               ManagementHelper.storeResult(reply, exceptionMessage);
+            else {
+               exceptionMessage = e.getMessage();
             }
+            ManagementHelper.storeResult(reply, exceptionMessage);
          }
       }
       else {
@@ -415,13 +416,14 @@ public class ManagementServiceImpl implements ManagementService {
             catch (Exception e) {
                ActiveMQServerLogger.LOGGER.managementAttributeError(e, attribute, resourceName);
                reply.putBooleanProperty(ManagementHelper.HDR_OPERATION_SUCCEEDED, false);
-               String exceptionMessage = e.getMessage();
+               String exceptionMessage;
                if (e instanceof InvocationTargetException) {
                   exceptionMessage = ((InvocationTargetException) e).getTargetException().getMessage();
                }
-               if (e != null) {
-                  ManagementHelper.storeResult(reply, exceptionMessage);
+               else {
+                  exceptionMessage = e.getMessage();
                }
+               ManagementHelper.storeResult(reply, exceptionMessage);
             }
          }
       }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/516d7df7/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/ActiveMQSecurityManagerImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/ActiveMQSecurityManagerImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/ActiveMQSecurityManagerImpl.java
index ba869ed..def688f 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/ActiveMQSecurityManagerImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/ActiveMQSecurityManagerImpl.java
@@ -52,7 +52,7 @@ public class ActiveMQSecurityManagerImpl implements ActiveMQSecurityManager
{
          User user = configuration.getUser(username);
          return user != null && user.isValid(username, password);
       }
-      else if (username == null && password == null) {
+      else if (password == null) {
          return configuration.getDefaultUser() != null;
       }
       else { // the only possible case here is user == null, password != null

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/516d7df7/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModule.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModule.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModule.java
index 3802d7b..512f02e 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModule.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModule.java
@@ -246,9 +246,7 @@ public class LDAPLoginModule implements LoginModule {
                }
             }
             catch (URISyntaxException e) {
-               if (context != null) {
-                  close(context);
-               }
+               close(context);
                FailedLoginException ex = new FailedLoginException("Error parsing absolute
name as URI.");
                ex.initCause(e);
                throw ex;
@@ -289,9 +287,7 @@ public class LDAPLoginModule implements LoginModule {
          throw ex;
       }
       catch (NamingException e) {
-         if (context != null) {
-            close(context);
-         }
+         close(context);
          FailedLoginException ex = new FailedLoginException("Error contacting LDAP");
          ex.initCause(e);
          throw ex;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/516d7df7/examples/features/standard/jms-bridge/src/main/java/org/apache/activemq/artemis/jms/example/JMSBridgeExample.java
----------------------------------------------------------------------
diff --git a/examples/features/standard/jms-bridge/src/main/java/org/apache/activemq/artemis/jms/example/JMSBridgeExample.java
b/examples/features/standard/jms-bridge/src/main/java/org/apache/activemq/artemis/jms/example/JMSBridgeExample.java
index f15db57..23946b0 100644
--- a/examples/features/standard/jms-bridge/src/main/java/org/apache/activemq/artemis/jms/example/JMSBridgeExample.java
+++ b/examples/features/standard/jms-bridge/src/main/java/org/apache/activemq/artemis/jms/example/JMSBridgeExample.java
@@ -102,9 +102,7 @@ public class JMSBridgeExample {
       }
       finally {
          // Step 12. Be sure to close the resources!
-         if (jmsBridge != null) {
-            jmsBridge.stop();
-         }
+         jmsBridge.stop();
          if (sourceContext != null) {
             sourceContext.close();
          }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/516d7df7/examples/features/standard/security/src/main/java/org/apache/activemq/artemis/jms/example/SecurityExample.java
----------------------------------------------------------------------
diff --git a/examples/features/standard/security/src/main/java/org/apache/activemq/artemis/jms/example/SecurityExample.java
b/examples/features/standard/security/src/main/java/org/apache/activemq/artemis/jms/example/SecurityExample.java
index 88fd1da..90cf72c 100644
--- a/examples/features/standard/security/src/main/java/org/apache/activemq/artemis/jms/example/SecurityExample.java
+++ b/examples/features/standard/security/src/main/java/org/apache/activemq/artemis/jms/example/SecurityExample.java
@@ -60,7 +60,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;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/516d7df7/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsRollbackRedeliveryTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsRollbackRedeliveryTest.java
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsRollbackRedeliveryTest.java
index 5b99ad9..8a64a85 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsRollbackRedeliveryTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsRollbackRedeliveryTest.java
@@ -118,7 +118,7 @@ public class JmsRollbackRedeliveryTest {
             MessageConsumer consumer = session.createConsumer(destination);
             TextMessage msg = (TextMessage) consumer.receive(6000000);
             if (msg != null) {
-               if (msg != null && rolledback.put(msg.getText(), Boolean.TRUE) !=
null) {
+               if (rolledback.put(msg.getText(), Boolean.TRUE) != null) {
                   LOG.info("Received message " + msg.getText() + " (" + received.getAndIncrement()
+ ")" + msg.getJMSMessageID());
                   assertTrue(msg.getJMSRedelivered());
                   assertEquals(2, msg.getLongProperty("JMSXDeliveryCount"));
@@ -155,7 +155,7 @@ public class JmsRollbackRedeliveryTest {
          while (received.get() < nbMessages) {
             TextMessage msg = (TextMessage) consumer.receive(6000000);
             if (msg != null) {
-               if (msg != null && rolledback.put(msg.getText(), Boolean.TRUE) !=
null) {
+               if (rolledback.put(msg.getText(), Boolean.TRUE) != null) {
                   LOG.info("Received message " + msg.getText() + " (" + received.getAndIncrement()
+ ")" + msg.getJMSMessageID());
                   assertTrue(msg.getJMSRedelivered());
                   session.commit();
@@ -190,7 +190,7 @@ public class JmsRollbackRedeliveryTest {
             MessageConsumer consumer = session.createConsumer(destination);
             TextMessage msg = (TextMessage) consumer.receive(6000000);
             if (msg != null) {
-               if (msg != null && rolledback.put(msg.getText(), Boolean.TRUE) !=
null) {
+               if (rolledback.put(msg.getText(), Boolean.TRUE) != null) {
                   LOG.info("Received message " + msg.getText() + " (" + received.getAndIncrement()
+ ")" + msg.getJMSMessageID());
                   assertTrue(msg.getJMSRedelivered());
                   session.commit();

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/516d7df7/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4671Test.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4671Test.java
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4671Test.java
index 562d978..165d5fd 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4671Test.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4671Test.java
@@ -75,9 +75,7 @@ public class AMQ4671Test {
          }
       }
       finally {
-         if (connection != null) {
-            connection.close();
-         }
+         connection.close();
       }
    }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/516d7df7/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4952Test.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4952Test.java
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4952Test.java
index dd4c7b3..0b74979 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4952Test.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4952Test.java
@@ -319,12 +319,10 @@ public class AMQ4952Test {
 
       // network to consumerBroker
 
-      if (networkToPorts != null && networkToPorts.length > 0) {
+      if (networkToPorts.length > 0) {
          StringBuilder builder = new StringBuilder("static:(failover:(tcp://localhost:2006)?maxReconnectAttempts=0)?useExponentialBackOff=false");
          NetworkConnector nc = broker.addNetworkConnector(builder.toString());
-         if (networkProps != null) {
-            IntrospectionSupport.setProperties(nc, networkProps);
-         }
+         IntrospectionSupport.setProperties(nc, networkProps);
          nc.setStaticallyIncludedDestinations(Arrays.<ActiveMQDestination>asList(new
ActiveMQQueue[]{QUEUE_NAME}));
       }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/516d7df7/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/RedeliveryPluginHeaderTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/RedeliveryPluginHeaderTest.java
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/RedeliveryPluginHeaderTest.java
index 62723af..b0e7bd3 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/RedeliveryPluginHeaderTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/RedeliveryPluginHeaderTest.java
@@ -121,9 +121,7 @@ public class RedeliveryPluginHeaderTest extends TestCase {
       }
       finally {
 
-         if (connection != null) {
-            connection.close();
-         }
+         connection.close();
 
          if (broker != null) {
             broker.stop();

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/516d7df7/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/config/ConfigTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/config/ConfigTest.java
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/config/ConfigTest.java
index 9ded99d..f0640b6 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/config/ConfigTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/config/ConfigTest.java
@@ -398,9 +398,7 @@ public class ConfigTest {
          LOG.info("Success");
       }
       finally {
-         if (broker != null) {
-            broker.stop();
-         }
+         broker.stop();
       }
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/516d7df7/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/jndi/ActiveMQInitialContextFactoryTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/jndi/ActiveMQInitialContextFactoryTest.java
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/jndi/ActiveMQInitialContextFactoryTest.java
index 9ebd776..8690472 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/jndi/ActiveMQInitialContextFactoryTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/jndi/ActiveMQInitialContextFactoryTest.java
@@ -39,9 +39,6 @@ public class ActiveMQInitialContextFactoryTest extends JNDITestSupport {
 
       InitialContext context = new InitialContext();
 
-      // make sure context is not null
-      assertTrue("Created context", context != null);
-
       Object topicDestination = context.lookup("MyTopic");
 
       // check if MyTopic is an ActiveMQTopic

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/516d7df7/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/jndi/InitialContextTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/jndi/InitialContextTest.java
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/jndi/InitialContextTest.java
index 5903d3f..575ab88 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/jndi/InitialContextTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/jndi/InitialContextTest.java
@@ -37,7 +37,6 @@ public class InitialContextTest extends TestCase {
 
    public void testInitialContext() throws Exception {
       InitialContext context = new InitialContext();
-      assertTrue("Created context", context != null);
 
       ActiveMQConnectionFactory connectionFactory = (ActiveMQConnectionFactory) context.lookup("ConnectionFactory");
 
@@ -49,7 +48,6 @@ public class InitialContextTest extends TestCase {
 
    public void testInitialContextHasXA() throws Exception {
       InitialContext context = new InitialContext();
-      assertTrue("Created context", context != null);
 
       ActiveMQXAConnectionFactory connectionFactory = (ActiveMQXAConnectionFactory) context.lookup("XAConnectionFactory");
 
@@ -66,7 +64,6 @@ public class InitialContextTest extends TestCase {
       properties.put(Context.PROVIDER_URL, expected);
 
       InitialContext context = new InitialContext(properties);
-      assertTrue("Created context", context != null);
 
       ActiveMQConnectionFactory connectionFactory = (ActiveMQConnectionFactory) context.lookup("ConnectionFactory");
 
@@ -85,7 +82,6 @@ public class InitialContextTest extends TestCase {
       properties.put("redeliveryPolicy.backOffMultiplier", "32");
 
       InitialContext context = new InitialContext(properties);
-      assertTrue("Created context", context != null);
 
       ActiveMQConnectionFactory connectionFactory = (ActiveMQConnectionFactory) context.lookup("ConnectionFactory");
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/516d7df7/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/DivertTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/DivertTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/DivertTest.java
index 806ac83..10c887e 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/DivertTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/DivertTest.java
@@ -187,7 +187,6 @@ public class DivertTest extends ActiveMQTestBase {
          }
 
          int count2 = 0;
-         message = null;
          while ((message = consumer2.receiveImmediate()) != null) {
             message.acknowledge();
             count2++;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/516d7df7/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/JMSServerControlTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/JMSServerControlTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/JMSServerControlTest.java
index a1c770f..1dd3c0a 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/JMSServerControlTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/JMSServerControlTest.java
@@ -370,9 +370,7 @@ public class JMSServerControlTest extends ManagementTestBase {
          Assert.assertNotNull(cons.receive(5000));
       }
       finally {
-         if (connection != null) {
-            connection.close();
-         }
+         connection.close();
       }
    }
 
@@ -415,9 +413,7 @@ public class JMSServerControlTest extends ManagementTestBase {
          Assert.assertNotNull(cons.receive(5000));
       }
       finally {
-         if (connection != null) {
-            connection.close();
-         }
+         connection.close();
       }
    }
 


Mime
View raw message