ilang opened a new pull request, #757: URL: https://github.com/apache/commons-vfs/pull/757
## Summary When `getParent()` returns `null` (root-level FTP path with `userDirIsRoot=true`), `setFTPFile()` blindly assumed the directory exists by creating an `FTPFile` with `DIRECTORY_TYPE` without contacting the server. This caused `exists()` to return `true` even after the FTP connection was lost, while non-root folders correctly reported the failure via `FileSystemException`. ## Fix Use CWD (Change Working Directory) to verify the directory actually exists on the server. CWD is a lightweight control-channel command with no data transfer, unlike LIST which would transfer the entire directory contents. ## Changes - `FtpClient`: add `changeDirectory()` default method - `FTPClientWrapper`: implement `changeDirectory()` via `FTPClient.changeWorkingDirectory()` - `FtpFileObject.setFTPFile()`: replace blind `DIRECTORY_TYPE` assumption with `verifyRootDirectory()` using CWD - `FtpRootExistsOnDisconnectTest`: regression test — fails without fix, passes with fix ## Test plan - [x] New test `FtpRootExistsOnDisconnectTest` verifies exists() detects connection drops on root-level folders - [x] Full VFS2 test suite passes (3203 tests, 0 failures — only 2 pre-existing HTTP timeout failures unrelated to this change) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
