Browse Source

NetRC: Open BufferedReader in try-with-resource

Change-Id: Ie0688b0ce19f657834a23438f112569a86491b3b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-5.0
David Pursehouse 7 years ago
parent
commit
fe6c97bc4c
  1. 11
      org.eclipse.jgit/src/org/eclipse/jgit/transport/NetRC.java

11
org.eclipse.jgit/src/org/eclipse/jgit/transport/NetRC.java

@ -211,9 +211,7 @@ public class NetRC {
this.hosts.clear();
this.lastModified = this.netrc.lastModified();
BufferedReader r = null;
try {
r = new BufferedReader(new FileReader(netrc));
try (BufferedReader r = new BufferedReader(new FileReader(netrc))) {
String line = null;
NetRCEntry entry = new NetRCEntry();
@ -315,13 +313,6 @@ public class NetRC {
hosts.put(entry.machine, entry);
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
try {
if (r != null)
r.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
}

Loading…
Cancel
Save