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

Apache Client Bug Fix #694

Closed
wants to merge 3 commits into from
Closed

Apache Client Bug Fix #694

wants to merge 3 commits into from

Conversation

jorg3lopez
Copy link
Contributor

Apache Client Bug Fix

This PR addresses the issues caused by updating Apache client 5 from version 5.2.1 to 5.2.2. The main issues were incompatibility from the org.apache.hc.core5.http.header import and the client would throw an invalid proxy error whenever a post request was executed.

Changes

  • org.apache.hc.core5.http.header import has been deleted
  • new code that deals with the header management has been employed.
  • downgrade to version 5.2.1
  • convertMapToHeader(Map<String, String> headerMap) helper method has been deleted along with test case

Issue

#689

Checklist

  • Build and all tests pass

downgrade from v5.2.2 -> v5.2.1
deleted header import
deleted helper method convertMapToHeader(Map<String, String> headerMap)
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@@ -11,8 +11,8 @@ java {

dependencies {
//client
implementation 'org.apache.httpcomponents.client5:httpclient5:5.2.2'
implementation 'org.apache.httpcomponents.client5:httpclient5-fluent:5.2.2'
implementation 'org.apache.httpcomponents.client5:httpclient5:5.2.1'
Copy link
Member

Choose a reason for hiding this comment

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

If we changed our code, do we need to also downgrade? Or can we keep the latest version?

Copy link
Contributor Author

@jorg3lopez jorg3lopez Dec 1, 2023

Choose a reason for hiding this comment

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

Edit: I misinterpreted the question the first time. The answer is Yes. The reason is that there were two bugs. One which involved the incompatibility of the import, which blew the POST request when executed. And two, the invalid proxy error that the client throws. The invalid proxy error was discovered after I fixed the issue with the import.

Copy link
Member

@halprin halprin Dec 1, 2023

Choose a reason for hiding this comment

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

Oh, I see.

I'm a little confused about the header issue. What exactly is wrong with the headers? Maybe I could pair with you on this?

"name": "dogCow",
"first": "last"
]
def bhArr = [
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be worth commenting these tests and having an item to uncomment them in the devex/opex backlog in the future when we get bumped to a bug free version?

Copy link
Contributor

Choose a reason for hiding this comment

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

@jcrichlake I think that's a good idea

Copy link
Contributor Author

@jorg3lopez jorg3lopez Dec 1, 2023

Choose a reason for hiding this comment

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

Good thought. Since the org.apache.hc.core5.http.Header is not supported in the 5.3.x version, we will not be utilizing the convertMapToHeader(Map<String, String> headerMap) helper function. This unit test was designed to test the functionality of the helper function. Once the helper function gets deleted, there is no need for this test case.

Copy link
Contributor

Choose a reason for hiding this comment

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

Gotcha, thanks for clarifying

Copy link
Contributor

@jcrichlake jcrichlake left a comment

Choose a reason for hiding this comment

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

Looks good to me

Copy link
Member

@halprin halprin left a comment

Choose a reason for hiding this comment

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

I actually just looked. 5.2.3 was just released on November 28th. The bug report for Apache says it was fixed in this version. Can we just upgrade to that to fix the bug?

@jorg3lopez
Copy link
Contributor Author

Version 5.2.3 is out and the Header import works with it.

@jorg3lopez jorg3lopez closed this Dec 1, 2023
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.

5 participants