You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by gu...@apache.org on 2020/09/08 06:15:30 UTC
[pulsar-manager] branch master updated: complement the missing
conditional statement (#329)
This is an automated email from the ASF dual-hosted git repository.
guangning pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-manager.git
The following commit(s) were added to refs/heads/master by this push:
new 2dab20c complement the missing conditional statement (#329)
2dab20c is described below
commit 2dab20c4a5a3c3e67b0679ac22f6c94de341fb5d
Author: Jiechuan Chen <65...@qq.com>
AuthorDate: Tue Sep 8 14:15:22 2020 +0800
complement the missing conditional statement (#329)
---
.../service/impl/NamespacesServiceImpl.java | 31 ++++++++++++----------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/src/main/java/org/apache/pulsar/manager/service/impl/NamespacesServiceImpl.java b/src/main/java/org/apache/pulsar/manager/service/impl/NamespacesServiceImpl.java
index f5d1eea..f9d6e8c 100644
--- a/src/main/java/org/apache/pulsar/manager/service/impl/NamespacesServiceImpl.java
+++ b/src/main/java/org/apache/pulsar/manager/service/impl/NamespacesServiceImpl.java
@@ -100,21 +100,24 @@ public class NamespacesServiceImpl implements NamespacesService {
}
for (String tenantNamespace : namespacesList) {
- String namespace = tenantNamespace.split("/")[1];
- Map<String, Object> topicsEntity = Maps.newHashMap();
- Map<String, Object> topics = topicsService.getTopicsList(
- 0, 0, tenant, namespace, requestHost);
- topicsEntity.put("topics", topics.get("total"));
- topicsEntity.put("namespace", namespace);
- if (topicStatsEntityMap.get(namespace) != null) {
- TopicStatsEntity topicStatsEntity = topicStatsEntityMap.get(namespace);
- topicsEntity.put("inMsg", topicStatsEntity.getMsgRateIn());
- topicsEntity.put("outMsg", topicStatsEntity.getMsgRateOut());
- topicsEntity.put("inBytes", topicStatsEntity.getMsgThroughputIn());
- topicsEntity.put("outBytes", topicStatsEntity.getMsgThroughputOut());
- topicsEntity.put("storageSize", topicStatsEntity.getStorageSize());
+ String[] path = tenantNamespace.split("/");
+ if (path.length > 1) {
+ String namespace = path[1];
+ Map<String, Object> topicsEntity = Maps.newHashMap();
+ Map<String, Object> topics = topicsService.getTopicsList(
+ 0, 0, tenant, namespace, requestHost);
+ topicsEntity.put("topics", topics.get("total"));
+ topicsEntity.put("namespace", namespace);
+ if (topicStatsEntityMap.get(namespace) != null) {
+ TopicStatsEntity topicStatsEntity = topicStatsEntityMap.get(namespace);
+ topicsEntity.put("inMsg", topicStatsEntity.getMsgRateIn());
+ topicsEntity.put("outMsg", topicStatsEntity.getMsgRateOut());
+ topicsEntity.put("inBytes", topicStatsEntity.getMsgThroughputIn());
+ topicsEntity.put("outBytes", topicStatsEntity.getMsgThroughputOut());
+ topicsEntity.put("storageSize", topicStatsEntity.getStorageSize());
+ }
+ namespacesArray.add(topicsEntity);
}
- namespacesArray.add(topicsEntity);
}
namespacesMap.put("isPage", false);
namespacesMap.put("total", namespacesList.size());