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

Retrofit http client supplier npe fix #1617

Merged

Conversation

bfg
Copy link
Contributor

@bfg bfg commented Feb 27, 2019

This patch addresses issue that resulted in NPE if http client supplier
was specified in Call.Factory builder and concrete http client was not,
because getHttpClient() method was not invoked while constructing
retrofit Call instance.

New, obviously less error prone approach is that http client supplier
gets constructed behind the scenes even if user specifies concrete http
client instance at call factory creation time and http client supplier
is being used exclusively also by Call instance. This way there are no
hard references to http client instance dangling around in case some
component creates a Call instance and never issues newCall() on it.

Fixes #1616.

bfg added 2 commits February 27, 2019 15:48
This patch addresses issue that resulted in NPE if http client supplier
was specified in `Call.Factory` builder and concrete http client was not,
because `getHttpClient()` method was not invoked while constructing
retrofit `Call` instance.

New, obviously less error prone approach is that http client supplier
gets constructed behind the scenes even if user specifies concrete http
client instance at call factory creation time and http client supplier
is being used exclusively also by `Call` instance. This way there are no
hard references to http client instance dangling around in case some
component creates a `Call` instance and never issues `newCall()` on it.

Fixes #1616.
@bfg
Copy link
Contributor Author

bfg commented Feb 27, 2019

@slandelle i'm really sorry for my previous non-functioning PR. This one actually works and it's better tested. I've also used snapshot dependency in my app and it works 😅. If you're going to accept this PR, please don't roll new release yet, i've noticed that there are possible timeout issues as well (possibly introduced with retrofit 2.5.0) and i plan to address them in separate PR.

@slandelle slandelle merged commit bbaa4c3 into AsyncHttpClient:master Feb 28, 2019
@bfg bfg deleted the retrofit_http_client_supplier_npe_fix branch February 28, 2019 08:52
@slandelle slandelle added this to the 2.8.1 milestone May 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Retrofit module: http client supplier is not invoked, resulting in NPE
2 participants