mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-08 08:10:55 +03:00
Fix bunch of warnings
This commit is contained in:
@@ -28,7 +28,6 @@ import net.schmizz.sshj.connection.channel.forwarded.RemotePortForwarder.Forward
|
||||
import net.schmizz.sshj.connection.channel.forwarded.X11Forwarder;
|
||||
import net.schmizz.sshj.connection.channel.forwarded.X11Forwarder.X11Channel;
|
||||
import net.schmizz.sshj.sftp.SFTPClient;
|
||||
import net.schmizz.sshj.sftp.SFTPEngine;
|
||||
import net.schmizz.sshj.sftp.StatefulSFTPClient;
|
||||
import net.schmizz.sshj.transport.Transport;
|
||||
import net.schmizz.sshj.transport.TransportException;
|
||||
@@ -733,7 +732,7 @@ public class SSHClient
|
||||
throws IOException {
|
||||
checkConnected();
|
||||
checkAuthenticated();
|
||||
return new SFTPClient(new SFTPEngine(this).init());
|
||||
return new SFTPClient(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -746,7 +745,7 @@ public class SSHClient
|
||||
throws IOException {
|
||||
checkConnected();
|
||||
checkAuthenticated();
|
||||
return new StatefulSFTPClient(new SFTPEngine(this).init());
|
||||
return new StatefulSFTPClient(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package net.schmizz.sshj.sftp;
|
||||
|
||||
import net.schmizz.sshj.connection.channel.direct.SessionFactory;
|
||||
import net.schmizz.sshj.xfer.FilePermission;
|
||||
import net.schmizz.sshj.xfer.LocalDestFile;
|
||||
import net.schmizz.sshj.xfer.LocalSourceFile;
|
||||
@@ -39,6 +40,13 @@ public class SFTPClient
|
||||
this.xfer = new SFTPFileTransfer(engine);
|
||||
}
|
||||
|
||||
public SFTPClient(SessionFactory sessionFactory) throws IOException {
|
||||
this.engine = new SFTPEngine(sessionFactory);
|
||||
this.engine.init();
|
||||
log = engine.getLoggerFactory().getLogger(getClass());
|
||||
this.xfer = new SFTPFileTransfer(engine);
|
||||
}
|
||||
|
||||
public SFTPEngine getSFTPEngine() {
|
||||
return engine;
|
||||
}
|
||||
@@ -232,7 +240,7 @@ public class SFTPClient
|
||||
throws IOException {
|
||||
xfer.download(source, dest);
|
||||
}
|
||||
|
||||
|
||||
public void get(String source, String dest, long byteOffset)
|
||||
throws IOException {
|
||||
xfer.download(source, dest, byteOffset);
|
||||
@@ -252,7 +260,7 @@ public class SFTPClient
|
||||
throws IOException {
|
||||
xfer.download(source, dest);
|
||||
}
|
||||
|
||||
|
||||
public void get(String source, LocalDestFile dest, long byteOffset)
|
||||
throws IOException {
|
||||
xfer.download(source, dest, byteOffset);
|
||||
@@ -262,7 +270,7 @@ public class SFTPClient
|
||||
throws IOException {
|
||||
xfer.upload(source, dest);
|
||||
}
|
||||
|
||||
|
||||
public void put(LocalSourceFile source, String dest, long byteOffset)
|
||||
throws IOException {
|
||||
xfer.upload(source, dest, byteOffset);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package net.schmizz.sshj.sftp;
|
||||
|
||||
import net.schmizz.sshj.connection.channel.direct.SessionFactory;
|
||||
import net.schmizz.sshj.xfer.LocalDestFile;
|
||||
import net.schmizz.sshj.xfer.LocalSourceFile;
|
||||
|
||||
@@ -34,6 +35,12 @@ public class StatefulSFTPClient
|
||||
log.debug("Start dir = {}", cwd);
|
||||
}
|
||||
|
||||
public StatefulSFTPClient(SessionFactory sessionFactory) throws IOException {
|
||||
super(sessionFactory);
|
||||
this.cwd = getSFTPEngine().canonicalize(".");
|
||||
log.debug("Start dir = {}", cwd);
|
||||
}
|
||||
|
||||
private synchronized String cwdify(String path) {
|
||||
return engine.getPathHelper().adjustForParent(cwd, path);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user