You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by mi...@apache.org on 2018/01/23 17:08:47 UTC

[2/2] activemq-artemis git commit: ARTEMIS-1414 potential PrintStream leak

ARTEMIS-1414 potential PrintStream leak


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/c98cb8a6
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/c98cb8a6
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/c98cb8a6

Branch: refs/heads/master
Commit: c98cb8a60c48fdda0180f622c231a4f3a8ddcecf
Parents: 8666cb6
Author: Justin Bertram <jb...@apache.org>
Authored: Tue Jan 23 09:51:11 2018 -0600
Committer: Michael Pearce <mi...@me.com>
Committed: Tue Jan 23 17:08:20 2018 +0000

----------------------------------------------------------------------
 .../apache/activemq/artemis/maven/ArtemisCreatePlugin.java  | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c98cb8a6/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCreatePlugin.java
----------------------------------------------------------------------
diff --git a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCreatePlugin.java b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCreatePlugin.java
index 2e16c86..9bbb2a1 100644
--- a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCreatePlugin.java
+++ b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCreatePlugin.java
@@ -237,11 +237,10 @@ public class ArtemisCreatePlugin extends ArtemisAbstractPlugin {
          throw new MojoExecutionException(e.getMessage(), e);
       }
 
-      PrintStream commandLineStream = new PrintStream(outputStream);
-      commandLineStream.println("# These are the commands used to create " + instance.getName());
-      commandLineStream.println(getCommandline(listCommands));
+      try (PrintStream commandLineStream = new PrintStream(outputStream)) {
+         commandLineStream.println("# These are the commands used to create " + instance.getName());
+         commandLineStream.println(getCommandline(listCommands));
 
-      try {
          Artemis.execute(home, null, listCommands);
 
          if (configuration != null) {
@@ -266,8 +265,6 @@ public class ArtemisCreatePlugin extends ArtemisAbstractPlugin {
             }
          }
 
-         commandLineStream.close();
-
          FileUtil.makeExec(commandLine);
 
          getLog().info("###################################################################################################");