Fix resource leak#8337
Merged
leventov merged 2 commits intoapache:masterfrom Aug 20, 2019
asdf2014:fix_resource_leak
Merged
Conversation
leventov
requested changes
Aug 19, 2019
Member
leventov
left a comment
There was a problem hiding this comment.
Great, thanks! How did you find all these leaks?
| } | ||
| finally { | ||
| if (channelStream != null) { | ||
| try { |
Member
There was a problem hiding this comment.
This block is essentially CloseQuietly.close().
| } | ||
| finally { | ||
| if (channelStream != null) { | ||
| try { |
| @@ -214,7 +214,9 @@ private ImmutableSortedMap<String, ImmutableList<String>> readMap(final String m | |||
| actualPath = this.getClass().getClassLoader().getResource("defaultWhiteListMap.json").getFile(); | |||
| LOGGER.info("using default whiteList map located at [%s]", actualPath); | |||
| InputStream byteContent = this.getClass().getClassLoader().getResourceAsStream("defaultWhiteListMap.json"); | |||
Member
There was a problem hiding this comment.
Simpler
defaultWhiteListMapUrl = this.getClass().getClassLoader().getResource("defaultWhiteListMap.json");
actualPath = defaultWhiteListMapUrl.getFile();
LOGGER.info(...);
fileContent = Resources.toString(defaultWhiteListMapUrl, StandardCharsets.UTF_8);| new FileInputStream(trustStorePath), | ||
| trustStorePasswordProvider == null ? null : trustStorePasswordProvider.getPassword().toCharArray() | ||
| ); | ||
| try (final FileInputStream trustStoreFileStream = new FileInputStream(trustStorePath)) { |
Member
There was a problem hiding this comment.
While at this PR, please replace usages of FileInputStream/FileOutputStream in the places that you have touched with Files.newInputStream/Files.newOutputStream when possible. See this comment: #6677 (comment).
Member
Author
Fokko
approved these changes
Aug 20, 2019
leventov
approved these changes
Aug 20, 2019
gianm
pushed a commit
to implydata/druid-public
that referenced
this pull request
Aug 20, 2019
* Fix resource leak * Patch comments
gianm
added a commit
that referenced
this pull request
Aug 21, 2019
* Docusaurus build framework + ingestion doc refresh. * stick to npm instead of yarn * fix typos * restore some _bin * Adjustments. * detect and fix redirect anchors * update anchor lint * Web-console: remove specific column filters (#8343) * add clear filter * update tool kit * remove usless check * auto run * add % * Fix resource leak (#8337) * Fix resource leak * Patch comments * Enable Spotbugs NP_NONNULL_RETURN_VIOLATION (#8234) * Fixes from PR review. * Fix more anchors. * Preamble nix. * Fix more anchors, headers * clean up placeholder page * add to website lint to travis config * better broken link checking * travis fix * Fixed more broken links * better redirects * unfancy catch * fix LGTM error * link fixes * fix md issues * Addl fixes
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.


Description
Fix resource leak
This PR has: