diff options
author | David Pursehouse <david.pursehouse@gmail.com> | 2018-03-07 14:39:39 +0900 |
---|---|---|
committer | David Pursehouse <david.pursehouse@gmail.com> | 2018-03-07 14:39:39 +0900 |
commit | ee4dd50b3f5caa0536d2635df80ad4067d2cf4c9 (patch) | |
tree | 2e96b65e04398d35bb1c659da74d676eb1498221 /org.eclipse.jgit | |
parent | 3195d2fb9b37e0910781a90e0bdf356fb98627bc (diff) | |
download | jgit-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.java | 9 |
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) { |