Repository: commons-release-plugin Updated Branches: refs/heads/master 46ed2ce15 -> 7a3be9d5e
Fix file handle leak. Project: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/commit/b7b204cc Tree: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/tree/b7b204cc Diff: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/diff/b7b204cc Branch: refs/heads/master Commit: b7b204cc21639062135fd14417d8eda567b70d89 Parents: ceecf0e Author: Gary Gregory <[email protected]> Authored: Wed May 16 15:22:45 2018 -0600 Committer: Gary Gregory <[email protected]> Committed: Wed May 16 15:22:45 2018 -0600 ---------------------------------------------------------------------- .../release/plugin/mojos/CommonsDistributionDetachmentMojo.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/b7b204cc/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java index e67bbe5..6892386 100644 --- a/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java +++ b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java @@ -176,9 +176,8 @@ public class CommonsDistributionDetachmentMojo extends AbstractMojo { * @throws MojoExecutionException if we cant write the file due to an {@link IOException}. */ private void logAllArtifactsInPropertiesFile() throws MojoExecutionException { - try { - File sha1PropertiesFile = new File(workingDirectory, "sha1.properties"); - FileOutputStream fileWriter = new FileOutputStream(sha1PropertiesFile); + File sha1PropertiesFile = new File(workingDirectory, "sha1.properties"); + try (FileOutputStream fileWriter = new FileOutputStream(sha1PropertiesFile)) { artifactSha1s.store(fileWriter, "release sha1s"); } catch (IOException e) { throw new MojoExecutionException("Failure to write sha1's", e);
