You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by mi...@apache.org on 2018/10/10 16:17:31 UTC

[1/2] activemq-artemis git commit: This closes #2358

Repository: activemq-artemis
Updated Branches:
  refs/heads/master 0d665b532 -> ae738c426


This closes #2358


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

Branch: refs/heads/master
Commit: ae738c4260d9169494b691f6add619c1859e7278
Parents: 0d665b5 b2af19d
Author: Michael Andre Pearce <mi...@me.com>
Authored: Wed Oct 10 17:17:31 2018 +0100
Committer: Michael Andre Pearce <mi...@me.com>
Committed: Wed Oct 10 17:17:31 2018 +0100

----------------------------------------------------------------------
 .../artemis/core/server/impl/AddressInfo.java   | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------



[2/2] activemq-artemis git commit: NO-JIRA Fix NPE seen in test case logs

Posted by mi...@apache.org.
NO-JIRA Fix NPE seen in test case logs



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

Branch: refs/heads/master
Commit: b2af19db2d2651690458665e81e73151ef39fca7
Parents: 0d665b5
Author: Michael André Pearce <mi...@me.com>
Authored: Wed Oct 10 07:56:56 2018 +0100
Committer: Michael Andre Pearce <mi...@me.com>
Committed: Wed Oct 10 17:17:31 2018 +0100

----------------------------------------------------------------------
 .../artemis/core/server/impl/AddressInfo.java   | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b2af19db/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java
index 0cf9452..db2c67a 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java
@@ -32,6 +32,7 @@ public class AddressInfo {
 
    private boolean autoCreated = false;
 
+   private static final EnumSet<RoutingType> EMPTY_ROUTING_TYPES = EnumSet.noneOf(RoutingType.class);
    private EnumSet<RoutingType> routingTypes;
    private RoutingType firstSeen;
 
@@ -91,26 +92,25 @@ public class AddressInfo {
    }
 
    public EnumSet<RoutingType> getRoutingTypes() {
-      return routingTypes;
+      return routingTypes == null ? EMPTY_ROUTING_TYPES : routingTypes;
    }
 
-   public AddressInfo setRoutingTypes(EnumSet<RoutingType> routingTypes) {
+   public AddressInfo setRoutingTypes(final EnumSet<RoutingType> routingTypes) {
       this.routingTypes = routingTypes;
-      if (!routingTypes.isEmpty()) {
-         this.firstSeen = this.routingTypes.iterator().next();
+      if (routingTypes != null && !routingTypes.isEmpty()) {
+         this.firstSeen = routingTypes.iterator().next();
+      } else {
+         this.firstSeen = null;
       }
       return this;
    }
 
-   public AddressInfo addRoutingType(RoutingType routingType) {
+   public AddressInfo addRoutingType(final RoutingType routingType) {
       if (routingType != null) {
-         if (routingTypes == null) {
+         if (routingTypes == null || routingTypes.isEmpty()) {
             routingTypes = EnumSet.of(routingType);
             firstSeen = routingType;
          } else {
-            if (routingTypes.isEmpty()) {
-               firstSeen = routingType;
-            }
             routingTypes.add(routingType);
          }
       }
@@ -127,7 +127,7 @@ public class AddressInfo {
       buff.append("Address [name=" + name);
       buff.append(", id=" + id);
       buff.append(", routingTypes={");
-      for (RoutingType routingType : routingTypes) {
+      for (RoutingType routingType : getRoutingTypes()) {
          buff.append(routingType.toString() + ",");
       }
       // delete hanging comma