activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject activemq-artemis git commit: NO-JIRA: Trivial fix for Artemis class, reported by coverity.com
Date Fri, 05 May 2017 19:00:54 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master a5ea22e8a -> c253aa65b


NO-JIRA: Trivial fix for Artemis class, reported by coverity.com


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

Branch: refs/heads/master
Commit: c253aa65bffe1299bc9c20b3ed6cf6ebda736f2b
Parents: a5ea22e
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Fri May 5 14:55:44 2017 -0400
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Fri May 5 14:55:57 2017 -0400

----------------------------------------------------------------------
 .../org/apache/activemq/artemis/cli/Artemis.java    | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c253aa65/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/Artemis.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/Artemis.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/Artemis.java
index dfa6c91..d52507d 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/Artemis.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/Artemis.java
@@ -179,13 +179,17 @@ public class Artemis {
    }
 
    private static long copy(InputStream in, OutputStream out) throws Exception {
-      byte[] buffer = new byte[1024];
-      int len = in.read(buffer);
-      while (len != -1) {
-         out.write(buffer, 0, len);
-         len = in.read(buffer);
+      try {
+         byte[] buffer = new byte[1024];
+         int len = in.read(buffer);
+         while (len != -1) {
+            out.write(buffer, 0, len);
+            len = in.read(buffer);
+         }
+         return len;
+      } finally {
+         in.close();
       }
-      return len;
    }
 
 }


Mime
View raw message