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 { private int countPicks() throws IOException {
int count = 0; int count = 0;
File todoFile = getTodoFile(); File todoFile = getTodoFile();
BufferedReader br = new BufferedReader(new InputStreamReader( try (BufferedReader br = new BufferedReader(new InputStreamReader(
new FileInputStream(todoFile), "UTF-8")); new FileInputStream(todoFile), "UTF-8"))) {
try {
String line = br.readLine(); String line = br.readLine();
while (line != null) { while (line != null) {
int firstBlank = line.indexOf(' '); int firstBlank = line.indexOf(' ');
@ -2123,8 +2122,6 @@ public class RebaseCommandTest extends RepositoryTestCase {
line = br.readLine(); line = br.readLine();
} }
return count; return count;
} finally {
br.close();
} }
} }

Loading…
Cancel
Save