try {
channel = getExecChannel();
channel.setCommand(cmd);
sendFile(channel, localFile, remoteTargetName, mode);
channel.disconnect();
} catch (JSchException e) {
if (channel != null) {
channel.disconnect();
}
throw (IOException) new IOException("Error during SCP transfer." + e.getMessage())