aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2018-03-05 17:13:20 +0900
committerDavid Pursehouse <david.pursehouse@gmail.com>2018-03-05 17:13:20 +0900
commit99c187a5da1651c404f550cf449a65eaaf390b75 (patch)
treeeae155f81e051490d00be1e1286c0ecff6bf6670 /org.eclipse.jgit
parent18f2cfc7d1927a36fe96efe8fb6c68a9bdb22a8b (diff)
downloadjgit-99c187a5da1651c404f550cf449a65eaaf390b75.tar.gz
jgit-99c187a5da1651c404f550cf449a65eaaf390b75.zip
TransportSftp: Open BufferedReader in try-with-resource
Change-Id: Iab94cce80c11a5edeaf8f377001408cc53707c04 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportSftp.java9
1 files changed, 2 insertions, 7 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportSftp.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportSftp.java
index 306c6c452c..09cd67b515 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportSftp.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportSftp.java
@@ -427,13 +427,8 @@ public class TransportSftp extends SshTransport implements WalkTransport {
private Ref readRef(final TreeMap<String, Ref> avail,
final String path, final String name) throws TransportException {
final String line;
- try {
- final BufferedReader br = openReader(path);
- try {
- line = br.readLine();
- } finally {
- br.close();
- }
+ try (BufferedReader br = openReader(path)) {
+ line = br.readLine();
} catch (FileNotFoundException noRef) {
return null;
} catch (IOException err) {