eolivelli commented on a change in pull request #244: Issue#243 - asyncAddEntry
fails with NPE with LedgerHandlerAdv
URL: https://github.com/apache/bookkeeper/pull/244#discussion_r127641396
##########
File path:
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerHandle.java
##########
@@ -720,8 +720,7 @@ public void asyncAddEntry(final byte[] data, final
AddCallback cb,
* @param ctx
* some control object
*/
- public void asyncAddEntry(final long entryId, final byte[] data, final
AddCallback cb, final Object ctx)
- throws BKException {
+ public void asyncAddEntry(final long entryId, final byte[] data, final
AddCallback cb, final Object ctx) {
Review comment:
@sijie the check with entryId <= 0 was to detect that no entryId was set, I
have changed the code with the best way I have found, that is to check if
entryId == LedgerHandler.INVALID_ENTRY_ID (-1)
the BKException will never be thrown as the callback will to be called with
an error code
in LedgerHandlerAdv there is such a check as @sijie told in asyncAddEntry
this is the code:
```
if ((entryId <= this.lastAddConfirmed) || pendingAddOps.contains(op)) {
LOG.error("Trying to re-add duplicate entryid:{}", entryId);
cb.addComplete(BKException.Code.DuplicateEntryIdException,
LedgerHandleAdv.this, entryId, ctx);
return;
}
```
I noticed also that in LedgerHandlerAdv we missed the ByteBuf variant of the
API asyncAddEntry with entryId, we should create a new issue for this
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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