posted 16 years ago
Finally! I now know the direction you are transferring files. And with FTP the direction of transfer is critical.
Your original post has me confused. You claim that both Java source files (text) and class files (binary) were corrupted during the FTP. That is not possible from a single FTP task. Let me explain.
1) If you ftp as binary, then text files keep the CR-LF line ending characters. And in an editor on Linux you will see funny characters at the end of each line. But binary files are transferred as-is, meaning the class files could not have been corrupted.
2) If you ftp as text, the the Java source files will transfer correctly, with CR-LF chars being changed to LF. No funny characters at end-of-line in the editor. But that same CR-LF to LF conversion can corrupt binary files, meaning your class files are now corrupt.
Therefore, either the source files of the class files get corrupted in a single ftp transfer. But not both.
FixCrLf can further corrupt binary files. Consider a binary file on Windows with some LF chars and some CR-LF combinations. After a text mode ftp to Linux, all of the CR-LF combos will be turned to LF. Running FixCrLf then takes all LF chars and converts them to CR-LF, leaving no free-standing LF chars (as there were in the original binary). So the binary is still screwed up. In short, after a text-mode FTP, binary files are hopelessly corrupt and cannot be fixed. The only solution is to re-transfer the file in binary mode.
(Sorry, I was a teacher in a former life and occasionally that teacher repossesses my body...)