while downloading some class files and jsp files from remote server i am getting some special character at the end of each line and i can see it this in text editor for jsp files and java decompiler is unable to open my class files. what to do to remove those unwanted characters.
Did you use the ftp task to get the files? Did you remember to set the binary mode attribute?
Also what OS are you transferring files from and to. If you do not have binary mode set, when files are transferred from Linux to Windows, a CR char is added before every LF char. And in the other direction, every CR-LF combo is changed to only LF.
You need to FTP class files with the binary option set. Using FixCrLf can further corrupt binary files. [ July 17, 2008: Message edited by: Peter Johnson ]
Please post the ant task you are using to download the files from FTP. Based on the FTP task documentation, the binary mode is set to "yes" by default.
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...)