You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2017/02/19 17:09:28 UTC

svn commit: r1783674 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/AuthManager.java

Author: pmouawad
Date: Sun Feb 19 17:09:28 2017
New Revision: 1783674

URL: http://svn.apache.org/viewvc?rev=1783674&view=rev
Log:
Use try with resources

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/AuthManager.java

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/AuthManager.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/AuthManager.java?rev=1783674&r1=1783673&r2=1783674&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/AuthManager.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/AuthManager.java Sun Feb 19 17:09:28 2017
@@ -363,10 +363,9 @@ public class AuthManager extends ConfigT
             throw new IOException("The file you specified cannot be read.");
         }
 
-        BufferedReader reader = null;
         boolean ok = true;
-        try {
-            reader = new BufferedReader(new FileReader(file));
+        try ( FileReader fr = new FileReader(file); 
+                BufferedReader reader = new BufferedReader(fr)){
             String line;
             while ((line = reader.readLine()) != null) {
                 try {
@@ -401,8 +400,6 @@ public class AuthManager extends ConfigT
                     ok = false;
                 }
             }
-        } finally {
-            JOrphanUtils.closeQuietly(reader);
         }
         if (!ok){
             JMeterUtils.reportErrorToUser("One or more errors found when reading the Auth file - see the log file");