Skip to content

[#7589] fix (clients): check null before adding request headers in HTTPClient #7601

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

Merged
merged 8 commits into from
Jul 11, 2025

Conversation

georgereuben
Copy link
Contributor

@georgereuben georgereuben commented Jul 7, 2025

What changes were proposed in this pull request?

Added a null check for empty headers before adding request headers in HTTPClient.

Closes: #7589

Does this PR introduce any user-facing change?

No

How was this patch tested?

Added a unit test.

@georgereuben georgereuben marked this pull request as draft July 7, 2025 10:19
@georgereuben georgereuben marked this pull request as ready for review July 7, 2025 10:22
@georgereuben georgereuben changed the title [#7589] fix (clients) : check null before adding request headers in HTTPClient [#7589] fix (clients): check null before adding request headers in HTTPClient Jul 7, 2025
@justinmclean
Copy link
Member

It looks like the test case you added is failing. Is the test correct?

@georgereuben
Copy link
Contributor Author

It looks like the test case you added is failing. Is the test correct?

Hi @justinmclean, This was due to mock server path collision between testGetSuccess() and testNullHeadersDoNotCauseNPE(). I've changed test data from "test" to "hank" to ensure consistency across all test methods that share the same mock server path (GET_success)

Copy link
Member

@justinmclean justinmclean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this

@justinmclean justinmclean merged commit 83ad1af into apache:main Jul 11, 2025
30 checks passed
vishnu-chalil pushed a commit to vishnu-chalil/gravitino that referenced this pull request Jul 14, 2025
… in HTTPClient (apache#7601)

### What changes were proposed in this pull request?

Added a null check for empty headers before adding request headers in
HTTPClient.

Closes: [apache#7589](apache#7589)

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

Added a unit test.
hdygxsj pushed a commit to hdygxsj/gravitino that referenced this pull request Jul 15, 2025
… in HTTPClient (apache#7601)

### What changes were proposed in this pull request?

Added a null check for empty headers before adding request headers in
HTTPClient.

Closes: [apache#7589](apache#7589)

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

Added a unit test.
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.

[Improvement] Fix possible NPE in HTTPClient.java
2 participants