From 88151ed6208db74ac32e3e23a6288565bedbfe9c Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Mon, 5 Mar 2018 16:23:50 +0900 Subject: [PATCH] RebaseCommandTest: Open BufferedReader in try-with-resource Change-Id: If8d77431edfdaec4a49a3c4ffe66a99e6d31c682 Signed-off-by: David Pursehouse --- .../tst/org/eclipse/jgit/api/RebaseCommandTest.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java index 3f43c6b1b..cbccc2392 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java @@ -2103,9 +2103,8 @@ public class RebaseCommandTest extends RepositoryTestCase { private int countPicks() throws IOException { int count = 0; File todoFile = getTodoFile(); - BufferedReader br = new BufferedReader(new InputStreamReader( - new FileInputStream(todoFile), "UTF-8")); - try { + try (BufferedReader br = new BufferedReader(new InputStreamReader( + new FileInputStream(todoFile), "UTF-8"))) { String line = br.readLine(); while (line != null) { int firstBlank = line.indexOf(' '); @@ -2123,8 +2122,6 @@ public class RebaseCommandTest extends RepositoryTestCase { line = br.readLine(); } return count; - } finally { - br.close(); } }