Community
Participate
Working Groups
I was using 1.0.0.v20061110 with ftp and when I transfer big files, the file is not fully transfered. A few bytes at the end are missing... I tried different FTP hosts -- with the same result.... It feels like a close or flush is missing at the end of the transfer.....
Forgot to mention: transfer is in direction to the ftp site. (the file on the ftp host is corrupt)
How big is the file? JVM version etc.?
Also, do you see any errors logged? What does the FTP Console View look like?
Finally, how did you upload? Drag&drop (from where?), Copy&paste or other?
The problem occurs for binary files transfered between Unix and Windows. It actually transfers binary files in text mode and therefore converts line endings. A Transfer from Windows to Unix shortens the file. I figured out the problem: setFileTransferMode was called instead of setFileType. In FTPService.upload is the following code: if (isBinary) ftpClient.setFileTransferMode(FTP.BINARY_FILE_TYPE); else ftpClient.setFileTransferMode(FTP.ASCII_FILE_TYPE); The problem is that, setFileTransferMode takes one of the following constants FTP.STREAM_TRANSFER_MODE FTP.BLOCK_TRANSFER_MODE FTP.COMPRESSED_TRANSFER_MODE To set the file type use if (isBinary) ftpClient.setFileType(FTP.BINARY_FILE_TYPE); else ftpClient.setFileType(FTP.ASCII_FILE_TYPE); That actually fixes the problem for me. This is a good example why enumerations introduces in java 1.5 are a good idea and why int constants are really really bad It's so easy to get it wrong and the compiler does not complain if you use the wrong constants.... BTW. in case of doubt the file transfer should always be binary. I would make it a property of the FTP client or preference entry if line endings should be converted or not..... setFileType (like setFileTransferMode) returns a false if the call failed. Maybe this should be checked too.....
Created attachment 53714 [details] patch that fixes the problem Note: there are 4 wrong calls to setFileTransferMode
This is a showstopper I think!
Applied the patch, and respun RSE 1.0. The fix can be downloaded from http://download.eclipse.org/dsdp/tm/downloads/drops/R-1.0-200611121600/ for verification. This is a great bug Michael -- you not only discovered the issue and documented it, but also fixed it and provided a patch over the weekend. Thanks!
Verified with 1.0 against FileZilla, Closing.