You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/02/27 13:51:44 UTC

[GitHub] [pulsar] lordcheng10 opened a new pull request #14481: fix npe in ManagedLedgerImpl

lordcheng10 opened a new pull request #14481:
URL: https://github.com/apache/pulsar/pull/14481


   ### Motivation
   fix npe in ManagedLedgerImpl
   
   
   ### Documentation
   
   Check the box below or label this PR directly (if you have committer privilege).
   
   Need to update docs? 
   
   - [ ] `doc-required` 
     
     (If you need help on updating docs, create a doc issue)
     
   - [x] `no-need-doc` 
     
     (Please explain why)
     
   - [ ] `doc` 
     
     (If this PR contains doc changes)
   
   
   


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] lordcheng10 commented on a change in pull request #14481: fix npe in ManagedLedgerImpl

Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on a change in pull request #14481:
URL: https://github.com/apache/pulsar/pull/14481#discussion_r815530453



##########
File path: managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
##########
@@ -3252,9 +3252,11 @@ public PositionImpl getPositionAfterN(final PositionImpl startPosition, long n,
                     totalEntriesInCurrentLedger = 0;
                 }
             } else {
-                totalEntriesInCurrentLedger = ledgers.get(currentLedgerId).getEntries();
+                totalEntriesInCurrentLedger = ledgers.get(currentLedgerId) != null

Review comment:
       Done




-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] eolivelli merged pull request #14481: fix npe in ManagedLedgerImpl

Posted by GitBox <gi...@apache.org>.
eolivelli merged pull request #14481:
URL: https://github.com/apache/pulsar/pull/14481


   


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] lordcheng10 commented on a change in pull request #14481: fix npe in ManagedLedgerImpl

Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on a change in pull request #14481:
URL: https://github.com/apache/pulsar/pull/14481#discussion_r815530453



##########
File path: managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
##########
@@ -3252,9 +3252,11 @@ public PositionImpl getPositionAfterN(final PositionImpl startPosition, long n,
                     totalEntriesInCurrentLedger = 0;
                 }
             } else {
-                totalEntriesInCurrentLedger = ledgers.get(currentLedgerId).getEntries();
+                totalEntriesInCurrentLedger = ledgers.get(currentLedgerId) != null

Review comment:
       Fixed




-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] eolivelli commented on a change in pull request #14481: fix npe in ManagedLedgerImpl

Posted by GitBox <gi...@apache.org>.
eolivelli commented on a change in pull request #14481:
URL: https://github.com/apache/pulsar/pull/14481#discussion_r815489860



##########
File path: managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
##########
@@ -3252,9 +3252,11 @@ public PositionImpl getPositionAfterN(final PositionImpl startPosition, long n,
                     totalEntriesInCurrentLedger = 0;
                 }
             } else {
-                totalEntriesInCurrentLedger = ledgers.get(currentLedgerId).getEntries();
+                totalEntriesInCurrentLedger = ledgers.get(currentLedgerId) != null

Review comment:
       We have to to the 'get' call only once, otherwise the second time you can get a null.
   
   




-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Shoothzj commented on a change in pull request #14481: fix npe in ManagedLedgerImpl

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on a change in pull request #14481:
URL: https://github.com/apache/pulsar/pull/14481#discussion_r815528238



##########
File path: managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
##########
@@ -3252,9 +3252,11 @@ public PositionImpl getPositionAfterN(final PositionImpl startPosition, long n,
                     totalEntriesInCurrentLedger = 0;
                 }
             } else {
-                totalEntriesInCurrentLedger = ledgers.get(currentLedgerId).getEntries();
+                totalEntriesInCurrentLedger = ledgers.get(currentLedgerId) != null

Review comment:
       +1




-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org