make pathHelper final + renamed exists() -> statExistence()

This commit is contained in:
Shikhar Bhushan
2010-03-26 00:49:07 +01:00
parent 53389e6989
commit 25a18c6fd7
2 changed files with 6 additions and 6 deletions

View File

@@ -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);

View File

@@ -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