Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asyncAddEntry fails with NPE with LedgerHandler created with createLedgerAdv #243

Closed
eolivelli opened this issue Jul 14, 2017 · 3 comments
Closed

Comments

@eolivelli
Copy link
Contributor

eolivelli commented Jul 14, 2017

It turns out on 4.5 that "asyncAddEntry" fails with NPE with LedgerHandler created with createLedgerAdv

This is a simple code to reproduce the error

LedgerHandle lh = bkc.createLedgerAdv(1, 1, 1, digestType, ledgerPassword);
lh.addEntry(data);

This is the error, it is due to the fact that the entryId has not been assigned

java.lang.NullPointerException
	at org.apache.bookkeeper.client.PendingAddOp.initiate(PendingAddOp.java:195)
	at org.apache.bookkeeper.client.LedgerHandleAdv$2.safeRun(LedgerHandleAdv.java:216)

I have marked the issue as blocker because it concerns the main function of BK, that is "addEntry"

@eolivelli
Copy link
Contributor Author

The signature of asyncAddEntry is wrong, it does not throw BKException as it is an async function

public void asyncAddEntry(final long entryId, final byte[] data, final int offset, final int length,
            final AddCallback cb, final Object ctx) throws BKException

Maybe we can fix this error too

@eolivelli eolivelli self-assigned this Jul 14, 2017
@sijie
Copy link
Member

sijie commented Jul 14, 2017

@eolivelli can you share the code that cause the NPE?

@eolivelli
Copy link
Contributor Author

@sijie I have modified the description, the new testcase in PR #244 demostrates the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants