You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2019/09/03 12:15:50 UTC

[qpid-jms] branch master updated: QPIDJMS-472: Make sure reader is properly closed.

This is an automated email from the ASF dual-hosted git repository.

robbie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-jms.git


The following commit(s) were added to refs/heads/master by this push:
     new c2ac684  QPIDJMS-472: Make sure reader is properly closed.
c2ac684 is described below

commit c2ac6846226fbf13f5690391f4542f357547c652
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Tue Sep 3 09:55:26 2019 +0100

    QPIDJMS-472: Make sure reader is properly closed.
    
    This closes #31
---
 .../src/main/java/org/apache/qpid/jms/util/MetaDataSupport.java       | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/MetaDataSupport.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/MetaDataSupport.java
index 100f451..bfeb83a 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/MetaDataSupport.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/MetaDataSupport.java
@@ -56,8 +56,7 @@ public class MetaDataSupport {
             InputStream in = null;
             String path = MetaDataSupport.class.getPackage().getName().replace(".", "/");
             if ((in = MetaDataSupport.class.getResourceAsStream("/" + path + "/version.txt")) != null) {
-                try {
-                    BufferedReader reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.US_ASCII));
+                try (BufferedReader reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.US_ASCII))) {
                     version = reader.readLine();
                     Pattern pattern = Pattern.compile("(\\d+)\\.(\\d+).*");
                     Matcher m = pattern.matcher(version);
@@ -65,7 +64,6 @@ public class MetaDataSupport {
                         major = Integer.parseInt(m.group(1));
                         minor = Integer.parseInt(m.group(2));
                     }
-                    reader.close();
                 } catch(Throwable err) {
                     LOG.trace("Problem generating fallback version details", err);
                 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org