Fix issue 5505
@@ -121,7 +121,12 @@ public class TopicStats {
}
} else {
for (String subscription : stats.subscriptions.keySet()) {
+ if (this.subscriptions.get(subscription) != null) {
this.subscriptions.get(subscription).add(stats.subscriptions.get(subscription));
+ } else {
+ SubscriptionStats subscriptionStats = new SubscriptionStats();
+ this.subscriptions.put(subscription, subscriptionStats.add(stats.subscriptions.get(subscription)));
+ }
}
}
if (this.replication.size() != stats.replication.size()) {
@@ -131,7 +136,12 @@ public class TopicStats {
}
} else {
for (String repl : stats.replication.keySet()) {
+ if (this.replication.get(repl) != null) {
this.replication.get(repl).add(stats.replication.get(repl));
+ } else {
+ ReplicatorStats replStats = new ReplicatorStats();
+ this.replication.put(repl, replStats.add(stats.replication.get(repl)));
+ }
}
}
return this;
