Browse Source

TransportSftp: Open BufferedReader in try-with-resource

Change-Id: Iab94cce80c11a5edeaf8f377001408cc53707c04
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-4.11
David Pursehouse 7 years ago
parent
commit
99c187a5da
  1. 7
      org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportSftp.java

7
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, private Ref readRef(final TreeMap<String, Ref> avail,
final String path, final String name) throws TransportException { final String path, final String name) throws TransportException {
final String line; final String line;
try { try (BufferedReader br = openReader(path)) {
final BufferedReader br = openReader(path);
try {
line = br.readLine(); line = br.readLine();
} finally {
br.close();
}
} catch (FileNotFoundException noRef) { } catch (FileNotFoundException noRef) {
return null; return null;
} catch (IOException err) { } catch (IOException err) {

Loading…
Cancel
Save