laxpio commented on issue #5694: PositionImpl init throws NullPointerException URL: https://github.com/apache/pulsar/issues/5694#issuecomment-556958133 the readPosition will be null when ledger list is null or can not find the nextValidPosition the code as follow: managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java ``` public void asyncReadEntries(final int numberOfEntriesToRead, final ReadEntriesCallback callback, final Object ctx) { checkArgument(numberOfEntriesToRead > 0); if (isClosed()) { callback.readEntriesFailed(new ManagedLedgerException("Cursor was already closed"), ctx); return; } PENDING_READ_OPS_UPDATER.incrementAndGet(this); OpReadEntry op = OpReadEntry.create(this, PositionImpl.get(readPosition), numberOfEntriesToRead, callback, ctx); ledger.asyncReadEntries(op); } ``` managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpReadEntry.java ``` public static OpReadEntry create(ManagedCursorImpl cursor, PositionImpl readPositionRef, int count, ReadEntriesCallback callback, Object ctx) { OpReadEntry op = RECYCLER.get(); op.readPosition = cursor.ledger.startReadOperationOnLedger(readPositionRef); op.cursor = cursor; op.count = count; op.callback = callback; op.entries = Lists.newArrayList(); op.ctx = ctx; op.nextReadPosition = PositionImpl.get(op.readPosition); return op; } ```
---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
