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:
The `ex instanceof NotFoundException` is always falsem, because the broker
only returns the 500 error when the ledger does non exist.
##########
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:
The `ex instanceof NotFoundException` is always false, because the broker
only returns the 500 error when the ledger does non exist.
--
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]