Skip to content

Commit

Permalink
#73 fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Jun 15, 2018
1 parent eaf1f0a commit b59be25
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/com/jcabi/ssh/Ssh.java
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,11 @@ public static String escape(final String arg) {
types = IOException.class
)
protected Session session() throws IOException {
final File file = File.createTempFile("jcabi-ssh", ".key");
try {
JSch.setConfig("StrictHostKeyChecking", "no");
JSch.setLogger(new JschLogger());
final JSch jsch = new JSch();
final File file = File.createTempFile("jcabi-ssh", ".key");
file.deleteOnExit();
new LengthOf(
new TeeInput(
this.key.replaceAll("\r", "")
Expand Down Expand Up @@ -277,10 +276,11 @@ protected Session session() throws IOException {
);
session.setServerAliveCountMax(Tv.MILLION);
session.connect();
Files.deleteIfExists(file.toPath());
return session;
} catch (final JSchException ex) {
throw new IOException(ex);
} finally {
Files.deleteIfExists(file.toPath());
}
}
}

0 comments on commit b59be25

Please sign in to comment.