nodece commented on code in PR #21919:
URL: https://github.com/apache/pulsar/pull/21919#discussion_r1457300168


##########
pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/TopicsImpl.java:
##########
@@ -987,21 +987,7 @@ public CompletableFuture<Void> truncateAsync(String topic) 
{
 
     @Override
     public CompletableFuture<Message<byte[]>> getMessageByIdAsync(String 
topic, long ledgerId, long entryId) {
-        CompletableFuture<Message<byte[]>> future = new CompletableFuture<>();
-        getRemoteMessageById(topic, ledgerId, entryId).handle((r, ex) -> {
-            if (ex != null) {
-                if (ex instanceof NotFoundException) {
-                    log.warn("Exception '{}' occurred while trying to get 
message.", ex.getMessage());
-                    future.complete(r);
-                } else {
-                    future.completeExceptionally(ex);
-                }
-                return null;
-            }
-            future.complete(r);
-            return null;
-        });
-        return future;
+        return getRemoteMessageById(topic, ledgerId, entryId);

Review Comment:
   There is a minor change that the `handle` is removed, which is used to 
recover the `NotFoundException`, but the `ex instanceof NotFoundException` is 
always false, so always throw 500.
   
   Right now, when the ledger does not exist, this API throws the 400 error 
instead of the 500.



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