@Signature public Memory stat(Environment env, String path) throws SftpException { try { SftpATTRS attrs = getWrappedObject().stat(path); return ArrayMemory.ofNullableBean(env, attrs); } catch (SftpException e) { if ("2: No such file".equals(e.toString())) { return Memory.NULL; } throw e; } }
@Signature public Memory lstat(Environment env, String path) throws SftpException { try { SftpATTRS attrs = getWrappedObject().lstat(path); return ArrayMemory.ofNullableBean(env, attrs); } catch (SftpException e) { if ("2: No such file".equals(e.toString())) { return Memory.NULL; } throw e; } }
if ("2: No such file".equals(e.toString())) { return null;
public void flush() throws java.io.IOException{ if(isClosed){ throw new IOException("stream already closed"); } if(!init){ try{ while(writecount>ackcount){ if(!checkStatus(null, header)){ break; } ackcount++; } } catch(SftpException e){ throw new IOException(e.toString()); } } }
public void flush() throws java.io.IOException { if (isClosed) { throw new IOException("stream already closed"); } if (!init) { try { while (writecount > ackcount) { if (!checkStatus(null, header)) { break; } ackcount++; } } catch (SftpException e) { throw new IOException(e.toString()); } } }
public void flush() throws java.io.IOException{ if(isClosed){ throw new IOException("stream already closed"); } if(!init){ try{ while(writecount>ackcount){ if(!checkStatus(null, header)){ break; } ackcount++; } } catch(SftpException e){ throw new IOException(e.toString()); } } }
public void flush() throws java.io.IOException{ if(isClosed){ throw new IOException("stream already closed"); } if(!init){ try{ while(writecount>ackcount){ if(!checkStatus(null, header)){ break; } ackcount++; } } catch(SftpException e){ throw new IOException(e.toString()); } } }
public void flush() throws java.io.IOException{ if(isClosed){ throw new IOException("stream already closed"); } if(!init){ try{ while(writecount>ackcount){ if(!checkStatus(null, header)){ break; } ackcount++; } } catch(SftpException e){ throw new IOException(e.toString()); } } }
public static String test(final SshNode workerNode, final AskUserForPw askUserForPw) { try { Session sshSession = SshPool.getSshSession(workerNode, askUserForPw); ChannelSftp sftpTest = (ChannelSftp) sshSession.openChannel("sftp"); sftpTest.connect(); sftpTest.cd(workerNode.getDirectory()); sftpTest.disconnect(); sshSession.disconnect(); } catch (JSchException e) { return e.toString(); } catch (SftpException e) { return e.toString(); } return null; }
protected static void doSingleSftpransfer(Session session, File localFile, String remoteFilePath) throws IOException, JSchException { ChannelSftp channel = openSftpChannel(session); try { channel.connect(); try { sendFileToRemote(channel, localFile, remoteFilePath); } catch (SftpException e) { throw new JSchException(e.toString()); } } finally { if (channel != null) { channel.disconnect(); } } }
private void doSingleTransfer() throws JSchException { final ChannelSftp channel = openSftpChannel(); try { channel.connect(); try { sendFileToRemote(channel, localFile, remotePath); } catch (final SftpException e) { throw new JSchException("Could not send '" + localFile + "' to '" + remotePath + "' - " + e.toString(), e); } } finally { if (channel != null) { channel.disconnect(); } } }
throw new IOException("error: "+e.toString());
return 0; } catch (SftpException e) { throw new IOException("error: " + e.toString());
throw new IOException("error: "+e.toString());
throw new IOException("error: "+e.toString());
/** * Carry out the transfer. * @throws IOException on i/o errors * @throws JSchException on errors detected by scp */ @Override public void execute() throws IOException, JSchException { final ChannelSftp channel = openSftpChannel(); try { channel.connect(); try { final SftpATTRS attrs = channel.stat(remoteFile); if (attrs.isDir() && !remoteFile.endsWith("/")) { remoteFile += "/"; } } catch (final SftpException ee) { // Ignored } getDir(channel, remoteFile, localFile); } catch (final SftpException e) { throw new JSchException("Could not get '" + remoteFile + "' to '" + localFile + "' - " + e.toString(), e); } finally { if (channel != null) { channel.disconnect(); } } log("done\n"); }
logger.warning(e.toString()); } finally {
} catch (final SftpException e) { throw new JSchException("Could not CD to '" + remotePath + "' - " + e.toString(), e);