summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2018-03-05 16:23:08 +0900
committerDavid Pursehouse <david.pursehouse@gmail.com>2018-03-05 16:23:08 +0900
commit50cebd85a832d82349ce4850735b5ba0aee3e98d (patch)
treea3ab6063c62a03dc72d6bad61d9e9c70645a4bbe /org.eclipse.jgit.test
parent20b750d2f5d46bcd77a70b9181e3c246ed16dfa1 (diff)
downloadjgit-50cebd85a832d82349ce4850735b5ba0aee3e98d.tar.gz
jgit-50cebd85a832d82349ce4850735b5ba0aee3e98d.zip
DirCacheCGitCompatabilityTest: Open BufferedReader in try-with-resource
Change-Id: I0494eb475954927743174941a7d6c06d8431f57f Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java14
1 files changed, 4 insertions, 10 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java
index 92ce4e178b..96538da6d0 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java
@@ -234,32 +234,26 @@ public class DirCacheCGitCompatabilityTest extends LocalDiskRepositoryTestCase {
private static Map<String, CGitIndexRecord> readLsFiles() throws Exception {
final LinkedHashMap<String, CGitIndexRecord> r = new LinkedHashMap<>();
- final BufferedReader br = new BufferedReader(new InputStreamReader(
- new FileInputStream(pathOf("gitgit.lsfiles")), "UTF-8"));
- try {
+ try (BufferedReader br = new BufferedReader(new InputStreamReader(
+ new FileInputStream(pathOf("gitgit.lsfiles")), "UTF-8"))) {
String line;
while ((line = br.readLine()) != null) {
final CGitIndexRecord cr = new CGitIndexRecord(line);
r.put(cr.path, cr);
}
- } finally {
- br.close();
}
return r;
}
private static Map<String, CGitLsTreeRecord> readLsTree() throws Exception {
final LinkedHashMap<String, CGitLsTreeRecord> r = new LinkedHashMap<>();
- final BufferedReader br = new BufferedReader(new InputStreamReader(
- new FileInputStream(pathOf("gitgit.lstree")), "UTF-8"));
- try {
+ try (BufferedReader br = new BufferedReader(new InputStreamReader(
+ new FileInputStream(pathOf("gitgit.lstree")), "UTF-8"))) {
String line;
while ((line = br.readLine()) != null) {
final CGitLsTreeRecord cr = new CGitLsTreeRecord(line);
r.put(cr.path, cr);
}
- } finally {
- br.close();
}
return r;
}