Copilot commented on code in PR #25518:
URL: https://github.com/apache/pulsar/pull/25518#discussion_r3078581449


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java:
##########
@@ -1395,6 +1395,9 @@ public CompletableFuture<Void> 
setNamespaceBundleAffinityAsync(String bundleRang
         if (StringUtils.isBlank(destinationBroker)) {
             return CompletableFuture.completedFuture(null);
         }
+        String bundleName = 
pulsar().getNamespaceService().getNamespaceBundleFactory()
+                .getBundle(namespaceName.toString(), bundleRange)
+                .toString();

Review Comment:
   `setNamespaceBundleAffinityAsync` now computes `bundleName` synchronously 
via `getNamespaceBundleFactory().getBundle(...)`. If `bundleRange` is 
null/invalid this can throw before a `CompletableFuture` is returned, which can 
turn a bad request into an immediate server-side exception and also violates 
the project guidance that async methods should propagate failures via the 
returned future. Consider validating `bundleRange` up-front and wrapping bundle 
lookup in try/catch to return `FutureUtil.failedFuture(...)`, or defer 
bundleName computation into the async chain (e.g., inside `thenApply`).
   



-- 
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