You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by lh...@apache.org on 2022/09/28 08:32:15 UTC

[pulsar] branch master updated: [improve][broker] Add a message to a NullPointerException created in ManagedLedgerImpl (#17293)

This is an automated email from the ASF dual-hosted git repository.

lhotari pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new dfd4882d0c1 [improve][broker] Add a message to a NullPointerException created in ManagedLedgerImpl (#17293)
dfd4882d0c1 is described below

commit dfd4882d0c18ffc09945ad5beb26dae136933441
Author: Lari Hotari <lh...@users.noreply.github.com>
AuthorDate: Wed Sep 28 11:32:07 2022 +0300

    [improve][broker] Add a message to a NullPointerException created in ManagedLedgerImpl (#17293)
    
    - a NPE with no description is confusing
---
 .../main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java b/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
index 71bc8cad6f0..a03d38096e1 100644
--- a/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
+++ b/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
@@ -3475,7 +3475,7 @@ public class ManagedLedgerImpl implements ManagedLedger, CreateCallback {
         while (!isValidPosition(nextPosition)) {
             Long nextLedgerId = ledgers.ceilingKey(nextPosition.getLedgerId() + 1);
             if (nextLedgerId == null) {
-                throw new NullPointerException();
+                throw new NullPointerException("nextLedgerId is null. No valid next position after " + position);
             }
             nextPosition = PositionImpl.get(nextLedgerId, 0);
         }