DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=34778>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=34778


[EMAIL PROTECTED] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |INVALID




------- Additional Comments From [EMAIL PROTECTED]  2006-08-30 14:39 -------
I think the problem here may be that you are not calling
completePendingCommand().   The call to pwd() executed internally by FTPClient
does not retrieve the correct return code otherwise, and returns null. Here is
an example:

FTPClient client = new FTPClient();
                client.addProtocolCommandListener(new PrintCommandListener(new
PrintWriter(System.out)));
                
                client.connect("127.0.0.1");
                client.login("rory", "rory");
                
                for (FTPFile file : client.listFiles()) {
                        System.out.printf("%s %s [%d bytes]\n" 
,(file.isDirectory() ? "[D]" : "   "),
file.getName(), file.getSize());
                }
                
                client.enterLocalPassiveMode();
                client.setFileType(FTPClient.BINARY_FILE_TYPE);
                client.retrieveFile("A.pdf", new 
FileOutputStream("c:\\temp\\A.pdf"));
                
                // Upload a file
                InputStream fis = new FileInputStream("c:\\temp\\B.pdf");
                OutputStream os = client.storeFileStream("B.pdf");
                
                byte buf[] = new byte[8192];
                while (fis.read(buf) != -1) {
                        os.write(buf);
                }
                fis.close();
                os.close();
                client.completePendingCommand();
                
                client.changeWorkingDirectory("Dir1");
                for (FTPFile file : client.listFiles()) {
                        System.out.printf("%s %s [%d bytes]\n" 
,(file.isDirectory() ? "[D]" : "   "),
file.getName(), file.getSize());
                }
                
                System.out.println(client.printWorkingDirectory());

                client.changeToParentDirectory();
                client.changeWorkingDirectory("/D2");
                System.out.println(client.printWorkingDirectory());
                
                client.logout();
                client.disconnect();

If you comment out the call to completePendingCommand() above, it will print
"null" for the directory name.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to