Technoboy- commented on code in PR #20652:
URL: https://github.com/apache/pulsar/pull/20652#discussion_r1243028264


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/NonPersistentTopics.java:
##########
@@ -449,35 +448,39 @@ public void getListFromBundle(
                         bundleRange);
                 asyncResponse.resume(Response.noContent().build());
             } else {
-                NamespaceBundle nsBundle;
-                try {
-                    nsBundle = validateNamespaceBundleOwnership(namespaceName, 
policies.bundles,
-                        bundleRange, true, true);
-                } catch (WebApplicationException wae) {
-                    asyncResponse.resume(wae);
-                    return;
-                }
-                try {
-                    ConcurrentOpenHashMap<String, 
ConcurrentOpenHashMap<String, Topic>> bundleTopics =
-                            
pulsar().getBrokerService().getMultiLayerTopicsMap().get(namespaceName.toString());
-                    if (bundleTopics == null || bundleTopics.isEmpty()) {
-                        asyncResponse.resume(Collections.emptyList());
-                        return;
-                    }
-                    final List<String> topicList = new ArrayList<>();
-                    String bundleKey = namespaceName.toString() + "/" + 
nsBundle.getBundleRange();
-                    ConcurrentOpenHashMap<String, Topic> topicMap = 
bundleTopics.get(bundleKey);
-                    if (topicMap != null) {
-                        topicList.addAll(topicMap.keys().stream()
-                                .filter(name -> 
!TopicName.get(name).isPersistent())
-                                .collect(Collectors.toList()));
-                    }
-                    asyncResponse.resume(topicList);
-                } catch (Exception e) {
-                    log.error("[{}] Failed to list topics on namespace bundle 
{}/{}", clientAppId(),
-                            namespaceName, bundleRange, e);
-                    asyncResponse.resume(new RestException(e));
-                }
+                validateNamespaceBundleOwnershipAsync(namespaceName, 
policies.bundles, bundleRange, true, true)
+                        .thenAccept(nsBundle -> {
+                            try {
+                                ConcurrentOpenHashMap<String, 
ConcurrentOpenHashMap<String, Topic>> bundleTopics =
+                                        pulsar().getBrokerService()
+                                                
.getMultiLayerTopicsMap().get(namespaceName.toString());
+                                if (bundleTopics == null || 
bundleTopics.isEmpty()) {
+                                    
asyncResponse.resume(Collections.emptyList());
+                                    return;
+                                }
+                                final List<String> topicList = new 
ArrayList<>();
+                                String bundleKey = namespaceName.toString() + 
"/" + nsBundle.getBundleRange();
+                                ConcurrentOpenHashMap<String, Topic> topicMap 
= bundleTopics.get(bundleKey);
+                                if (topicMap != null) {
+                                    topicList.addAll(topicMap.keys().stream()
+                                            .filter(name -> 
!TopicName.get(name).isPersistent())
+                                            .collect(Collectors.toList()));
+                                }
+                                asyncResponse.resume(topicList);
+                            } catch (Exception e) {
+                                log.error("[{}] Failed to list topics on 
namespace bundle {}/{}", clientAppId(),

Review Comment:
   We can remove `try/catch` block



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to