aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2018-03-07 14:39:39 +0900
committerDavid Pursehouse <david.pursehouse@gmail.com>2018-03-07 14:39:39 +0900
commitee4dd50b3f5caa0536d2635df80ad4067d2cf4c9 (patch)
tree2e96b65e04398d35bb1c659da74d676eb1498221 /org.eclipse.jgit
parent3195d2fb9b37e0910781a90e0bdf356fb98627bc (diff)
downloadjgit-ee4dd50b3f5caa0536d2635df80ad4067d2cf4c9.tar.gz
jgit-ee4dd50b3f5caa0536d2635df80ad4067d2cf4c9.zip
JschConfigSessionFactory: Open FileInputStream in try-with-resource
Change-Id: I0f8f4629c93ed747f2f604538fccc52da3974b2e 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/JschConfigSessionFactory.java9
1 files changed, 2 insertions, 7 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java
index c38182741d..2a222fbc7b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java
@@ -362,13 +362,8 @@ public abstract class JschConfigSessionFactory extends SshSessionFactory {
if (home == null)
return;
final File known_hosts = new File(new File(home, ".ssh"), "known_hosts"); //$NON-NLS-1$ //$NON-NLS-2$
- try {
- final FileInputStream in = new FileInputStream(known_hosts);
- try {
- sch.setKnownHosts(in);
- } finally {
- in.close();
- }
+ try (FileInputStream in = new FileInputStream(known_hosts)) {
+ sch.setKnownHosts(in);
} catch (FileNotFoundException none) {
// Oh well. They don't have a known hosts in home.
} catch (IOException err) {