jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject svn commit: r1714498 - /jmeter/trunk/src/core/org/apache/jmeter/save/SaveService.java
Date Sun, 15 Nov 2015 20:49:57 GMT
Author: fschumacher
Date: Sun Nov 15 20:49:56 2015
New Revision: 1714498

URL: http://svn.apache.org/viewvc?rev=1714498&view=rev
Log:
Followup to r1714469. Close BufferedReader on all possible paths.
Plus space-police.

Bugzilla Id: 57981

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/save/SaveService.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/save/SaveService.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/save/SaveService.java?rev=1714498&r1=1714497&r2=1714498&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/save/SaveService.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/save/SaveService.java Sun Nov 15 20:49:56 2015
@@ -22,6 +22,7 @@ import java.io.BufferedInputStream;
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
@@ -224,18 +225,16 @@ public class SaveService {
     private static String getChecksumForPropertiesFile()
             throws NoSuchAlgorithmException, IOException {
         MessageDigest md = MessageDigest.getInstance("SHA1");
-        try (BufferedReader reader = 
-                new BufferedReader(
-                        new InputStreamReader(
-                                new FileInputStream(JMeterUtils.getJMeterHome()
-                                        + JMeterUtils.getPropDefault(SAVESERVICE_PROPERTIES,
-                                                SAVESERVICE_PROPERTIES_FILE))))
-                ) {
+        try (FileReader fileReader = new FileReader(
+                    JMeterUtils.getJMeterHome()
+                    + JMeterUtils.getPropDefault(SAVESERVICE_PROPERTIES,
+                    SAVESERVICE_PROPERTIES_FILE));
+                BufferedReader reader = new BufferedReader(fileReader)) {
             String line = null;
             while ((line = reader.readLine()) != null) {
                 md.update(line.getBytes());
             }
-        } 
+        }
         return JOrphanUtils.baToHexString(md.digest());
     }
     private static void initProps() {



Mime
View raw message