You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2018/10/11 19:08:12 UTC
[4/9] activemq-artemis git commit: NO-JIRA Fix NPE seen in test case
logs
NO-JIRA Fix NPE seen in test case logs
(cherry picked from commit b2af19db2d2651690458665e81e73151ef39fca7)
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/5e415a81
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/5e415a81
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/5e415a81
Branch: refs/heads/2.6.x
Commit: 5e415a817c691120cbaecf0fbfd0ff0f834dcdaa
Parents: 8e1c216
Author: Michael André Pearce <mi...@me.com>
Authored: Wed Oct 10 07:56:56 2018 +0100
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu Oct 11 15:01:42 2018 -0400
----------------------------------------------------------------------
.../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/5e415a81/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