]> source.dussan.org Git - jgit.git/commitdiff
DescribeCommandTest: Open FileWriter in try-with-resource 32/118732/1
authorDavid Pursehouse <david.pursehouse@gmail.com>
Tue, 6 Mar 2018 00:49:16 +0000 (09:49 +0900)
committerDavid Pursehouse <david.pursehouse@gmail.com>
Tue, 6 Mar 2018 00:49:16 +0000 (09:49 +0900)
Change-Id: Ida79bdae652faa88fbdb1b81e7e10b5019ff2c16
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/DescribeCommandTest.java

index d78a3284026e1a46d2885b6c5414aecab8801689..79da2da7ea466b2c4e374a1b76492bffacc6e434 100644 (file)
@@ -297,9 +297,9 @@ public class DescribeCommandTest extends RepositoryTestCase {
        }
 
        private static void touch(File f, String contents) throws Exception {
-               FileWriter w = new FileWriter(f);
-               w.write(contents);
-               w.close();
+               try (FileWriter w = new FileWriter(f)) {
+                       w.write(contents);
+               }
        }
 
        private String describe(ObjectId c1, boolean longDesc)