I have been trying to download a file from the ftp server, barring it none of the other files or the directories have been assigned any access rights. Now when I try and download this file from the browser with the filepath appended to the url I face no problem. Whereas when I try to download it via the Java code I face access related exception. The reason I understand is that since the code makes connection with the server first and then checks for directory rights(which are false in this case) I'm unable to download the file.
Could anyone help me understand what procedure the browser might be making use that it is allowed to download the file even though the parent directories of this file have no rights? Or if anybody can suggest an alternative approach then nothing like it.
I have attempted to download th file by making use of the following approach:
The slash i missed out was a typo and I have tried the url with the type specification i.e type=d and without it (i.e the actual password embedded url) and none work with both approach. Surprisingly when I try and download the file by making use of the same url I face no hassles i face in downloading the file.
URL : URL redacted, though it looks correct JCE
The exception I encounter is:
posted 8 years ago
With approach two I face the following exception:
java.net.UnknownHostException: ftp:/URL REDACTED/
Exception in thread "main" java.lang.NullPointerException
Java Result: 1
There's something weird about that FTP server. If I log in using your credentials, I can't CD to the download directory:
I don't know why it works with a browser.
By the way, it looks like your URL above goes to live data. I am going to remove it so you aren't exposing your data.
As for why you are getting a UnknownHostException: with approach #2, I can't tell you since you aren't showing us the URL you are using.
You should probably set up a test environment with bogus data so you can do realistic testing without exposing real data.