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

HttpClient NPE bug when add queryparam #462

Closed
symphony-hong opened this issue Mar 2, 2021 · 4 comments · Fixed by #463
Closed

HttpClient NPE bug when add queryparam #462

symphony-hong opened this issue Mar 2, 2021 · 4 comments · Fixed by #463
Labels
[type] bug Something isn't working
Milestone

Comments

@symphony-hong
Copy link
Contributor

Bug Report

When we try to add a query param to a HttpClient instance, a NPE will be thrown because the queryParams in RequestConfig was initialised with null and same for headers, cookies and formParams.
Ref

Steps to Reproduce:

Reproduce with the unittest:

final HttpClient httpClient = HttpClient.builder(this::mockedApiClientBuilder)
      .basePath("https://localhost:8080")
      .header("Connection", "Keep-Alive")
      .header("Keep-Alive", "timeout=5, max=1000")
      .cookie("foo", "bar")
      .build();

httpClient.queryParam("test", "test");

Expected Result:

The query param is added successfully.
Same for headers, cookies, formParams

Actual Result:

java.lang.NullPointerException
	at com.symphony.bdk.http.api.HttpClient$RequestConfig.appendQueryParam(HttpClient.java:394)
	at com.symphony.bdk.http.api.HttpClient.queryParam(HttpClient.java:182)
	at com.symphony.bdk.http.api.HttpClientTest.usage(HttpClientTest.java:22)

Environment:

symphony-bdk-2.1.0

@thibauult thibauult added the [type] bug Something isn't working label Mar 2, 2021
@thibauult thibauult added this to the 2.1.1 milestone Mar 2, 2021
thibauult added a commit to thibauult/symphony-bdk-java that referenced this issue Mar 2, 2021
@thibauult thibauult linked a pull request Mar 2, 2021 that will close this issue
5 tasks
@thibauult
Copy link
Member

@symphony-hong PR created #463

thibauult added a commit to thibauult/symphony-bdk-java that referenced this issue Mar 2, 2021
thibauult added a commit to thibauult/symphony-bdk-java that referenced this issue Mar 2, 2021
thibauult added a commit that referenced this issue Mar 2, 2021
* #462 Fixed HttpClient NPE when adding query param

* #462 Updated fix version (2.1.1)

* #462 build.yml is also applied to *-rc branches
@thibauult
Copy link
Member

Release 2.1.1 should be available soon in Maven Central.

@symphony-youri
Copy link
Contributor

Do we need to merge into master too?

@thibauult
Copy link
Member

Already backported onto main : 723a4a7

@thibauult thibauult added [status] waiting-for-feedback We need additional information before we can continue and removed [status] waiting-for-feedback We need additional information before we can continue labels Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[type] bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants