use getResponseBodyAsStream for potential large response#42
Closed
fengxx wants to merge 1 commit intojenkinsci:masterfrom
Closed
use getResponseBodyAsStream for potential large response#42fengxx wants to merge 1 commit intojenkinsci:masterfrom
fengxx wants to merge 1 commit intojenkinsci:masterfrom
Conversation
kwin
reviewed
Apr 7, 2017
| private <T> T getResponse(String path, Class<T> clazz) throws IOException { | ||
| GetMethod httpget = new GetMethod(this.baseURL + path); | ||
| HttpClient client = getHttpClient(getMethodHost(httpget)); | ||
| try { |
There was a problem hiding this comment.
I would recommend to use the CloseableResponse with try-with-resources (http://stackoverflow.com/questions/21574478/what-is-the-difference-between-closeablehttpclient-and-httpclient-in-apache-http), that way you correctly release the connection even in case of errors
kwin
reviewed
Apr 7, 2017
| input.close(); | ||
| return object; | ||
| } catch (BitbucketRequestException | FileNotFoundException e) { | ||
| LOGGER.log(Level.SEVERE, "Request failed for url:" + path, e); |
kwin
reviewed
Apr 7, 2017
| LOGGER.log(Level.SEVERE, "Request failed for url:" + path, e); | ||
| throw e; | ||
| } catch (IOException e) { | ||
| LOGGER.log(Level.SEVERE, "Communication error for url: " + path, e); |
Member
|
superseded by #53 |
fengxx
pushed a commit
to fengxx/bitbucket-branch-source-plugin
that referenced
this pull request
Mar 13, 2018
Switched from SCMTrigger.SCMTriggerCause to BranchIndexingCause
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Got lots of warning
It seems that bitbucket server didn't include contentLength in response, although it is ok to ignore the warning, I think rewrite getRequest & parse using stream api may benefit readability and performance.
Note: BitbucketCloudApiClient is kept intact because too much hack in deserialization .