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