Skip to content
Snippets Groups Projects
Commit ccd5d114 authored by Jan Kožusznik's avatar Jan Kožusznik
Browse files

improve constructor

parent 5f6de754
Branches
Tags
No related merge requests found
......@@ -34,6 +34,10 @@ public class ScpClient implements Closeable {
private JSch jsch = new JSch();
private Session session;
public ScpClient(String hostName, String username, byte[] privateKeyFile) throws JSchException {
init(hostName, username, new ByteIdentity(jsch, privateKeyFile));
}
public ScpClient(String hostName, String username, Identity privateKeyFile) throws JSchException {
super();
init(hostName, username, privateKeyFile);
......@@ -292,8 +296,9 @@ public class ScpClient implements Closeable {
@Override
public void close() {
if (session.isConnected()) {
if ( session != null && session.isConnected()) {
session.disconnect();
session = null;
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment