jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject svn commit: r1766199 - /jmeter/trunk/test/src/org/apache/jmeter/save/TestSaveService.java
Date Sat, 22 Oct 2016 14:39:55 GMT
Author: fschumacher
Date: Sat Oct 22 14:39:55 2016
New Revision: 1766199

URL: http://svn.apache.org/viewvc?rev=1766199&view=rev
Log:
Use try-with syntax.

Bugzilla Id: 60222

Modified:
    jmeter/trunk/test/src/org/apache/jmeter/save/TestSaveService.java

Modified: jmeter/trunk/test/src/org/apache/jmeter/save/TestSaveService.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/save/TestSaveService.java?rev=1766199&r1=1766198&r2=1766199&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/save/TestSaveService.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/save/TestSaveService.java Sat Oct 22 14:39:55
2016
@@ -155,14 +155,8 @@ public class TestSaveService extends JMe
             if (saveOut) {
                 final File outFile = findTestFile("testfiles/" + fileName + ".out");
                 System.out.println("Write " + outFile);
-                FileOutputStream outf = null;
-                try {
-                    outf = new FileOutputStream(outFile);
+                try (FileOutputStream outf = new FileOutputStream(outFile)) {
                     outf.write(out.toByteArray());
-                } finally {
-                    if(outf != null) {
-                        outf.close();
-                    }
                 }
                 System.out.println("Wrote " + outFile);
             }



Mime
View raw message