Skip to content

ListenableFuture#addListener with null executor throws NPE #1369

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

Closed
joedj opened this issue Mar 21, 2017 · 1 comment
Closed

ListenableFuture#addListener with null executor throws NPE #1369

joedj opened this issue Mar 21, 2017 · 1 comment
Labels
Milestone

Comments

@joedj
Copy link
Contributor

joedj commented Mar 21, 2017

ListenableFuture#addListener javadoc says:

* Executor can be <code>null</code>, in that case executor will be executed
* in the thread where completion happens.

However, this doesn't work with the NettyResponseFuture implementation:

java.lang.NullPointerException
at java.util.concurrent.CompletableFuture.screenExecutor(CompletableFuture.java:415)
at java.util.concurrent.CompletableFuture.whenCompleteAsync(CompletableFuture.java:2142)
at org.asynchttpclient.netty.NettyResponseFuture.addListener(NettyResponseFuture.java:257)

I'm happy to submit a pull request for this issue, if you can indicate how you want it fixed (i.e. update the documentation to reflect current behavour, or change behaviour to match documentation).

@slandelle
Copy link
Contributor

Hi @joedj

Thanks for reporting! I guess it would be better to try to implement what the doc says. But if it turns out to be difficult, let's update the doc.
And sure, PR welcome :)

@joedj joedj changed the title ListenableFuture#addCallbacks with null executor throws NPE ListenableFuture#addListener with null executor throws NPE Mar 27, 2017
joedj pushed a commit to joedj/async-http-client that referenced this issue Mar 27, 2017
@slandelle slandelle added this to the 2.0.31 milestone Mar 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants