my dog learned polymorphism*
The moose likes Beginning Java and the fly likes FTP Client Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "FTP Client Problem" Watch "FTP Client Problem" New topic

FTP Client Problem

Peter Phung
Ranch Hand

Joined: Dec 06, 2001
Posts: 138
I'm writing a FTPClient application, but i keep getting this exception:
at archivetool.FTPClientDialog.getFile(
at archivetool.FTPClientDialog.access$100(
at archivetool.FTPClientDialog$
the strange thing about this is that the application stops running at line 579, as can be seen above, which is in the middle of a method which performs the same get operation twice. The application performs the operation correctly the first time but not the second time.
Here's my code:

Please can someone help me with this

Pete<br />"Reality is an illusion <br />brought on by a lack of <br />drink, drugs and smut"
Mark Herschberg

Joined: Dec 04, 2000
Posts: 6037
I didn't go through the code thoroughly, but I have two comments.
First, you're referencing an external object, client. It may make sense, but it also means something could be happening outside the method which is effecting it.
Second, consider using the Linlyn code, If you use this, be warned, the basic code creates a byte array, and when the array gets filled, it creates a new one, twice the size, and copies thje contents from one to another. In this way, it's very inefficient. If you have any knowledge about the size of the data, you can make it much more efficent with only a few minutes of work.
Peter Phung
Ranch Hand

Joined: Dec 06, 2001
Posts: 138
Unfortunately my work requires me to use only packages and classes released by sun.
I've posted all of the methods which use client below :

I've spent ages going over the code but i cant find the problem.
Please can someone help
Peter Phung
Ranch Hand

Joined: Dec 06, 2001
Posts: 138
Any help would be apreciated
It is sorta covered in the JavaRanch Style Guide.
subject: FTP Client Problem
Similar Threads
FTPProtocolException:STOR and FTPProtocolException:LIST??
Problem with FTPClient??
writing to a file
Failed uploading file to FTP with simple java program
FTP Client