mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-06 23:30:55 +03:00
make pathHelper final + renamed exists() -> statExistence()
This commit is contained in:
@@ -33,7 +33,7 @@ public class SFTPClient {
|
||||
|
||||
private final SFTPEngine sftp;
|
||||
private final SFTPFileTransfer xfer;
|
||||
private PathHelper pathHelper;
|
||||
private final PathHelper pathHelper;
|
||||
|
||||
public SFTPClient(SessionFactory ssh)
|
||||
throws IOException {
|
||||
@@ -91,7 +91,7 @@ public class SFTPClient {
|
||||
final Stack<String> dirsToMake = new Stack<String>();
|
||||
for (PathComponents current = pathHelper.getComponents(path); ; current = pathHelper
|
||||
.getComponents(current.getParent())) {
|
||||
final FileAttributes attrs = exists(current.getPath());
|
||||
final FileAttributes attrs = statExistence(current.getPath());
|
||||
if (attrs == null) {
|
||||
dirsToMake.push(current.getPath());
|
||||
} else if (attrs.getType() != FileMode.Type.DIRECTORY) {
|
||||
@@ -105,7 +105,7 @@ public class SFTPClient {
|
||||
}
|
||||
}
|
||||
|
||||
public FileAttributes exists(String path)
|
||||
public FileAttributes statExistence(String path)
|
||||
throws IOException {
|
||||
try {
|
||||
return sftp.stat(path);
|
||||
|
||||
@@ -40,7 +40,7 @@ public class StatefulSFTPClient
|
||||
public synchronized void cd(String dirname)
|
||||
throws IOException {
|
||||
cwd = cwdify(dirname);
|
||||
if (exists(cwd) == null) {
|
||||
if (statExistence(cwd) == null) {
|
||||
throw new SFTPException(cwd + ": does not exist");
|
||||
}
|
||||
log.info("CWD = " + cwd);
|
||||
@@ -109,9 +109,9 @@ public class StatefulSFTPClient
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileAttributes exists(String path)
|
||||
public FileAttributes statExistence(String path)
|
||||
throws IOException {
|
||||
return super.exists(cwdify(path));
|
||||
return super.statExistence(cwdify(path));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user