You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2005/12/28 23:49:15 UTC

DO NOT REPLY [Bug 38067] New: - [net] FTP - WinZip file downloads are corrupted

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38067>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38067

           Summary: [net] FTP - WinZip file downloads are corrupted
           Product: Commons
           Version: 1.4 Final
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Net
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: pcgscrap@comcast.net


function retrieveFile() corrupts winzipped files. error returned on open is: 

error [<file>]: start of central directory not found; Zip file corrupt. Possible
cause: file transfer error.

this occurs for both .zip and tar.gz files I have tested.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 38067] - [net] FTP - WinZip file downloads are corrupted

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38067>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38067





------- Additional Comments From deepannair@gmail.com  2007-03-29 15:02 -------
the files retrieved using FtpClient are corrupted. i am retrieving .gz files, 
and when I try to gunzip them after that I get the following error "invalid 
compressed data--format violated".
If i retrive the same files using a manual ftp command from command line, its 
fine.
I am setting the -b option before ftp as suggested.
 ftp.enterLocalPassiveMode();
ftp.setFileType(FTP.BINARY_FILE_TYPE);



-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 38067] - [net] FTP - WinZip file downloads are corrupted

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38067>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38067





------- Additional Comments From dfs@apache.org  2006-02-27 22:15 -------
(In reply to comment #8)

Please try performing the transfers with the ftp.java example program included
with th source, using the -b option.  No progress has been made on this issue
because a complete working compilable/executable program replicating the problem
has not been provided; only an isolated method.  If the ftp.java example program
produces the same results, then provide an ftp URL for a file on a public ftp
site that we can use to reproduce the problem.  All indications up to this point
are that this is a system environment issue, and not an FTPClient bug.
Too many people are transferring gigabytes of data successfully with FTPClient
on a regular basis.  If FTPClient were randomly corrupting files, they'd be
running into the same issue.  Therefore, the first step for us to be able to 
make progress on this issue is to determine whether or not we are able to
reproduce the problem.  If we can reproduce it, then we know there's something
wrong with FTPClient and can investigate the problem rather quickly.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 38067] - [net] FTP - WinZip file downloads are corrupted

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38067>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38067





------- Additional Comments From tkdkid@pchome.com.tw  2006-03-06 05:12 -------
In org.apache.commons.net.ftp.FTPClient

   private boolean __storeFile(int command, String remote, InputStream local)
    throws IOException
    {
        OutputStream output;
        Socket socket;
        if ((socket = _openDataConnection_(command, remote)) == null)
            return false;
        output = new BufferedOutputStream(socket.getOutputStream(),
                                          getBufferSize()
                                          );
        if (__fileType == ASCII_FILE_TYPE)
            output = new ToNetASCIIOutputStream(output);
        // Treat everything else as binary for now
        try
        {
                             
                Util.copyStream(local, output, 2048,
                              CopyStreamEvent.UNKNOWN_STREAM_SIZE, null,
                                false);
        }
        catch (IOException e)
        {




As the code shows , the block perhaps the killer that made result we want to 
figure out.
I'm not quick sure what happen copystream do to zipfile format ,then keep move 
on the copystream method can see~~~
////////////////////////////////////////////////////////////////////
Util.copyStream(local, output, 2048,
                              CopyStreamEvent.UNKNOWN_STREAM_SIZE, null,
                                false);
////////////////////////////////////////////////////////////////////


 public static final long copyStream(InputStream source, OutputStream dest,
                                        int bufferSize, long streamSize,
                                        CopyStreamListener listener,
                                        boolean flush)
    throws CopyStreamException
    {
        int bytes;
        long total;
        byte[] buffer;

        buffer = new byte[bufferSize];
        total = 0;

        try
        {
            while ((bytes = source.read(buffer)) != -1)
            {
                // Technically, some read(byte[]) methods may return 0 and we 
cannot
                // accept that as an indication of EOF.

                if (bytes == 0)
                {
                    bytes = source.read();
                    if (bytes < 0)
                        break;
                    dest.write(bytes);
                    if(flush)
                      dest.flush();
                    ++total;
                    if (listener != null)
                        listener.bytesTransferred(total, 1, streamSize);
                    continue;
                }

                dest.write(buffer, 0, bytes);
                if(flush)
                  dest.flush();
                total += bytes;
                if (listener != null)
                    listener.bytesTransferred(total, bytes, streamSize);
            }
        }
        catch (IOException e)
        {
            throw new CopyStreamException("IOException caught while copying.",
                                          total, e);
        }

        return total;
    }



////////////////////////
I'm stupid with the IO operators , can anyone tell the property of the method .
thanks



-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 38067] - [net] FTP - WinZip file downloads are corrupted

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38067>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38067





------- Additional Comments From tkdkid@pchome.com.tw  2006-02-27 10:29 -------
(In reply to comment #7)
> Here ya go ... isn't much to it. If ya like I can send the entire class if 
need be.
> 
*******************************************************************************
**
>  public void fetchFile(String sServerFile, String sLocalFile){
>     FileOutputStream fout = null;
>     
>     try{
>       this.setFileTransferMode(this.BINARY_FILE_TYPE);
>       this.enterLocalPassiveMode();
>       fout = new FileOutputStream(sLocalFile);
>       boolean bSuccess = this.retrieveFile(sServerFile, fout);
>       if(FTPReply.isPositiveIntermediate(getReplyCode())){
>         this.completePendingCommand();
>       }
>       if(!FTPReply.isPositiveCompletion(getReplyCode())){
>         System.out.println("retrieveFile() failed: " + getReplyString());
>       }
>     }catch(Exception e){
>       System.out.println(e.getMessage());
>       try{if(fout != null){fout.close();}}
>       catch(Exception f){;}
>     }finally{
>       try{if(fout != null){fout.close();}}
>       catch(Exception g){;}
>     }
>   }



Actually , not only zip file open corrupted aftertrasnfering ,but also other 
type of .wav or movie files . there're no problem to process is text file I 
think .

Perhaps it's I/O occurs the main problem


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 38067] - [net] FTP - WinZip file downloads are corrupted

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38067>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38067





------- Additional Comments From dfs@apache.org  2006-01-03 19:26 -------
The place to start is by providing a working code example that isolates and
reproduces the problem.  Too often problems are reported that are caused by
a mistake in using the API.  Without a code example, it is impossible to
perform a diagnosis.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 38067] - [net] FTP - WinZip file downloads are corrupted

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38067>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38067





------- Additional Comments From pcgscrap@comcast.net  2006-01-03 17:02 -------
Could you please add my work email to get change notices there, it won't allow
me to add it in the CC box. kevin.wilson@comtrol.com

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 38067] - [net] FTP - WinZip file downloads are corrupted

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38067>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38067





------- Additional Comments From pcgscrap@comcast.net  2006-01-03 16:30 -------
It is a linux box but it uses Samba and I can open the source file using winzip
via the network share.

>"Can you open the file with WinZip on the source machine (assuming it runs
>Windows)?"

Yes, I used Filezilla and win2k's built-in ftp to download the file successfully.

>"Can you transfer the file using some other utility and read it correctly with
>WinZip?"

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 38067] - [net] FTP - WinZip file downloads are corrupted

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38067>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38067





------- Additional Comments From scohen@apache.org  2006-02-28 02:33 -------
(In reply to comment #8)
> (In reply to comment #7)
> > Here ya go ... isn't much to it. If ya like I can send the entire class if 
> need be.
> > 
> *******************************************************************************
> **
> >  public void fetchFile(String sServerFile, String sLocalFile){
> >     FileOutputStream fout = null;
...
> >       if(FTPReply.isPositiveIntermediate(getReplyCode())){
> >         this.completePendingCommand();
> >       }


Also, is it necessary to call completePendingCommand() here?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 38067] - [net] FTP - WinZip file downloads are corrupted

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38067>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38067





------- Additional Comments From dfs@apache.org  2006-01-03 19:27 -------
(In reply to comment #4)
> Could you please add my work email to get change notices there, it won't allow
> me to add it in the CC box. kevin.wilson@comtrol.com

I tried, but couldn't.  I think you need to add it to your bugzilla account
before it will be accepted.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 38067] - [net] FTP - WinZip file downloads are corrupted

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38067>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38067





------- Additional Comments From scohen@apache.org  2006-03-07 12:14 -------
Albert - can you please try again explaining what is the problem you think you
see in the existing code that you have pasted in here?  You evidently see
something here that doesn't look right but it's not at all clear to me what that
might be.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 38067] - [net] FTP - WinZip file downloads are corrupted

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38067>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38067


dfs@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO




------- Additional Comments From dfs@apache.org  2005-12-29 00:05 -------
Please provide a working code example that isolates and reproduces the problem.
Keep in mind tht FTPClient has been in use on thousands of production systems
since 1997 and would be useless if it corrupted file transfers.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 38067] - [net] FTP - WinZip file downloads are corrupted

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38067>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38067





------- Additional Comments From scohen@apache.org  2005-12-30 23:21 -------
Just a thought.  There were issues with Ant and WinZip a couple of years ago. 
Go into Bugzilla and search for "WinZip" under Ant.  The bottom line in all
these issues is that Winzip can be a little temperamental at times, and does
some things which possibly aren't standard.  (See, particularly,
http://issues.apache.org/bugzilla/show_bug.cgi?id=23602#c9 )  

However, none of that should matter here, since we're just doing a binary
transfer, not building this zip (we ARE doing a binary transfer, I assume?).

Some things to check:
Can you open the file with WinZip on the source machine (assuming it runs Windows)?

Can you transfer the file using some other utility and read it correctly with
WinZip?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 38067] - [net] FTP - WinZip file downloads are corrupted

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38067>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38067





------- Additional Comments From kevin.wilson@comtrol.com  2006-01-04 17:05 -------
Here ya go ... isn't much to it. If ya like I can send the entire class if need be.

*********************************************************************************
 public void fetchFile(String sServerFile, String sLocalFile){
    FileOutputStream fout = null;
    
    try{
      this.setFileTransferMode(this.BINARY_FILE_TYPE);
      this.enterLocalPassiveMode();
      fout = new FileOutputStream(sLocalFile);
      boolean bSuccess = this.retrieveFile(sServerFile, fout);
      if(FTPReply.isPositiveIntermediate(getReplyCode())){
        this.completePendingCommand();
      }
      if(!FTPReply.isPositiveCompletion(getReplyCode())){
        System.out.println("retrieveFile() failed: " + getReplyString());
      }
    }catch(Exception e){
      System.out.println(e.getMessage());
      try{if(fout != null){fout.close();}}
      catch(Exception f){;}
    }finally{
      try{if(fout != null){fout.close();}}
      catch(Exception g){;}
    }
  }

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 38067] - [net] FTP - WinZip file downloads are corrupted

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38067>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38067





------- Additional Comments From dennisl@apache.org  2007-03-29 15:11 -------
Bugzilla is no longer used for issue tracking here in Commons. Please use JIRA
instead:
  https://issues.apache.org/jira/browse/NET-115

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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