#90 - only update cwd state if stat succeeds

This commit is contained in:
shikhar
2013-08-11 17:16:40 -04:00
parent 3418df7a56
commit e6c4f6ae69

View File

@@ -40,10 +40,11 @@ public class StatefulSFTPClient
public synchronized void cd(String dirname)
throws IOException {
cwd = cwdify(dirname);
final String targetCwd = cwdify(dirname);
if (statExistence(cwd) == null) {
throw new SFTPException(cwd + ": does not exist");
}
cwd = targetCwd;
log.debug("CWD = {}", cwd);
}