Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Create ApacheHttpClient2.java#58

Open
OyaAIProd wants to merge 1 commit into
masterOyaAIProd/JavaFF:masterfrom
rhkiswani-patch-6OyaAIProd/JavaFF:rhkiswani-patch-6Copy head branch name to clipboard
Open

Create ApacheHttpClient2.java#58
OyaAIProd wants to merge 1 commit into
masterOyaAIProd/JavaFF:masterfrom
rhkiswani-patch-6OyaAIProd/JavaFF:rhkiswani-patch-6Copy head branch name to clipboard

Conversation

@OyaAIProd
Copy link
Copy Markdown
Owner

No description provided.

if (json == null){
throw new HttpClientException(SmartException.NULL_VAL, "Json Object");
}
CloseableHttpClient c = HttpClientBuilder.create().build();
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Recommendation generated by Amazon CodeGuru Reviewer

Problem
This line of code might contain a resource leak. Resource leaks can cause your system to slow down or crash.

Fix
Consider closing the following resource: c. Currently, there are execution paths that do not contain closure statements. Either a) close c in a try-finally block or b) close the resource by declaring c in a try-with-resources block.

More info
View resource management guidelines at oracle.com (external link).

}

private CloseableHttpClient prepareRequest(HttpRequestBase method, Map<String, String> params) throws UnsupportedEncodingException {
CloseableHttpClient c = HttpClientBuilder.create().build();
Copy link
Copy Markdown
Owner Author

@OyaAIProd OyaAIProd Dec 13, 2019

Choose a reason for hiding this comment

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

Problem
This line of code contains a resource that might not be closed properly. Resource leaks can cause your system to slow down or crash.

Fix
Consider closing the following resource: c. The resource is returned at line: 119. There are other execution paths that neither close the resource nor return it, e.g., when exception is thrown by BasicNameValuePair constructor, and if-branch is taken at line 109. Either a) close c in a try-finally block or b) close the resource by declaring c in a try-with-resources block.

More info
View resource management guidelines at oracle.com (external link).

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.

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.