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. 9
      org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportSftp.java

9
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) {

Loading…
Cancel
Save