Return-Path: Delivered-To: apmail-commons-issues-archive@locus.apache.org Received: (qmail 72696 invoked from network); 14 Dec 2007 13:56:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 14 Dec 2007 13:56:16 -0000 Received: (qmail 24603 invoked by uid 500); 14 Dec 2007 13:56:02 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 24523 invoked by uid 500); 14 Dec 2007 13:56:01 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 24506 invoked by uid 99); 14 Dec 2007 13:56:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Dec 2007 05:56:01 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Dec 2007 13:55:39 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 0A91B71420B for ; Fri, 14 Dec 2007 05:55:43 -0800 (PST) Message-ID: <29406397.1197640543004.JavaMail.jira@brutus> Date: Fri, 14 Dec 2007 05:55:43 -0800 (PST) From: "Dmitriy Komarov (JIRA)" To: issues@commons.apache.org Subject: [jira] Created: (NET-176) Incorrect downloading binary files from FTP MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org 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.