Browse Source

RebaseCommandTest: Open BufferedReader in try-with-resource

Change-Id: If8d77431edfdaec4a49a3c4ffe66a99e6d31c682
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-4.11
David Pursehouse 7 years ago
parent
commit
88151ed620
  1. 7
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java

7
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();
}
}

Loading…
Cancel
Save