commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rory Winston (JIRA)" <j...@apache.org>
Subject [jira] Closed: (NET-176) Incorrect downloading binary files from FTP
Date Sun, 17 Feb 2008 23:58:34 GMT

     [ https://issues.apache.org/jira/browse/NET-176?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Rory Winston closed NET-176.
----------------------------

    Resolution: Cannot Reproduce

> Incorrect downloading binary files from FTP
> -------------------------------------------
>
>                 Key: NET-176
>                 URL: https://issues.apache.org/jira/browse/NET-176
>             Project: Commons Net
>          Issue Type: Bug
>    Affects Versions: 1.4
>         Environment: WinXP SP2, JDK 1.5, Commons.Net 1.4.
> Remote FTP Server (ProFTPd, Linux).
>            Reporter: Dmitriy Komarov
>
> When I am trying to download some archive files (.zip), they are stored sometimes on
my PC wrong (damaged).
> Works _always_ good with Gene6 FTP Server (local) on WinXP SP2.
> Works _always_ bad with ProFTPd (remote!!!) on Linux.
> Example of code, based on Commons.Net:
> FTPClient c = new FTPClient();
> c.connect(host);
> c.enterRemotePassiveMode();
> c.setFileType(FTP.BINARY_FILE_TYPE);
> c.login(user, pass);
> c.changeWorkingDirectory(dir);
> FileOutputStream fos = new FileOutputStream(outFile);
> c.retrieveFile(fileName, fos);
> fos.close();
> c.disconnect();
> Example of code, successfuly working (not based on Commons.Net, just standart JDK modules):
> URL ur = new URL("ftp://" + user+ ":" + pass + "@" + host + "/" + dir + "/" + fileName);
> URLConnection urlc = ur.openConnection();
> BufferedInputStream bis = new BufferedInputStream(urlc.getInputStream());
> BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(outFile));
> int by;
> while ((by = bis.read()) != -1)
>            bos.write(by);
> bis.close();
> bos.close();

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message