commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Susanne Lefvert <lefv...@mcs.anl.gov>
Subject Re: FTPSClient error when downloading zip files on windows
Date Tue, 05 Dec 2006 22:42:01 GMT

Never mind, I think I figured it out. I have to set the binary flag  
after the enterlocalpassivemode call....



On Dec 5, 2006, at 3:37 PM, Susanne Lefvert wrote:

>
> An additional note: this happens even if I disable ssl (ie  
> reconfigure the ftp server and use FTPClient).
>
> Susanne
>
>
> On Dec 5, 2006, at 2:36 PM, Susanne Lefvert wrote:
>
>> Hello!
>>
>> I'm having problems downloading zip files using the FTPSClient  
>> with the apache ftp server. It works fine on Mac clients but not  
>> windows clients.
>>
>> Here's the test code (replace *** with your info):
>>
>> public class testFTP{
>>     private FTPSClient ftps;
>>
>>     public testFTP(){
>> 	try{
>> 	    String host = "***";
>> 	    int port = ***;
>> 	    String zipname = "CompleteProject.zip";
>> 	
>> 	    ftps = new FTPSClient(true);
>> 	    ftps.connect(host,port);
>> 	    System.out.println(ftps.getReplyString());
>> 	    ftps.setFileType(FTP.BINARY_FILE_TYPE);
>> 	    ftps.login("***", "***");
>> 	    System.out.println("Remote system is " + ftps.getSystemName());
>> 	
>>             ftps.enterLocalPassiveMode();
>> 	
>> 	    FileOutputStream output=new FileOutputStream(new File(zipname));
>> 	    boolean result = ftps.retrieveFile(zipname,output);
>> 	
>> 	    if (!result) {
>> 		System.out.println("Error retrieving file");
>> 	    }
>> 	
>> 	    ftps.disconnect();
>> 	}
>>
>> 	catch(Exception e){
>> 	    System.out.println("An error occured");
>> 	}
>>     }
>>
>>     public static void main(String args[]){
>> 	testFTP f= new testFTP();
>>     }
>> }
>>
>>
>> Here's the error I'm getting when trying to unzip the result from  
>> the test code above:
>>
>> $ unzip CompleteProject.zip
>> Archive:  CompleteProject.zip
>> warning [CompleteProject.zip]:  49109 extra bytes at beginning or  
>> within zipfile
>>   (attempting to process anyway)
>> file #1:  bad zipfile offset (local header sig):  49109
>>   (attempting to re-compensate)
>>   inflating: CompleteProject.eaf
>>   error:  invalid compressed data to inflate
>> file #2:  bad zipfile offset (local header sig):  2036
>>   (attempting to re-compensate)
>> file #2:  bad zipfile offset (local header sig):  2036
>> file #3:  bad zipfile offset (local header sig):  7225427
>> file #4:  bad zipfile offset (local header sig):  13119171
>> file #5:  bad zipfile offset (local header sig):  13312603
>>   inflating: CompleteProject_MetaData.xml
>>
>>
>> Any hints appreciated!
>>
>> Thanks,
>>
>> Susanne
>>
>>
>>
>> On Oct 4, 2006, at 4:50 PM, Rory Winston wrote:
>>
>>> Hi Susanne
>>>
>>> TLS support is in the works, but has not made it into an official  
>>> release yet. If you are using JDK 5.0, you can try out a snapshot  
>>> of the new release here:
>>>
>>> http://people.apache.org/~rwinston/commons-net-2.0/
>>>
>>> An example of usage is here:
>>>
>>> http://svn.apache.org/viewvc/jakarta/commons/proper/net/branches/ 
>>> JDK_1_5_BRANCH/src/main/java/examples/FTPSExample.java?view=markup
>>>
>>> Cheers
>>> Rory
>>>
>>>
>>> Susanne Lefvert wrote:
>>>>
>>>> Hi there,
>>>>
>>>> Do you know if there are any examples out there where the  
>>>> commons ftp client has been extended to support TLS. I need to  
>>>> connect to an ftp server that requires SSL and I'm looking for a  
>>>> ftp client library that I can use in my application. The apache  
>>>> commons ftp client looks really good, it's just missing the TLS  
>>>> piece. Any hints  greatly appreciated.
>>>>
>>>> Thanks,
>>>>
>>>> Susanne
>>>>
>>>> ------------------------------------------------------------------- 
>>>> --
>>>> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: commons-dev- 
>>>> help@jakarta.apache.org
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> -------------------------------------------------------------------- 
>>> -
>>> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>>>
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message