Re: [tcljava-dev] Bug in FileCmd.java
Brought to you by:
mdejong
From: Mo D. <su...@ba...> - 2001-12-10 14:29:41
|
On Fri, 7 Dec 2001 16:24:04 -0800 "Raffaele Sena" <ra...@ar...> wrote: > I just found a small bug in FileCmd.java (small, but very bad ): > > Don't know why, but the copy loop in copyRenameFile() is wrong and doesn't > work at all. The "offset" parameters in reader.read and writer.write are > referred to the offset in the buffer NOT in the file. So in this case the > value should always be 0 (write at the beginning of the buffer) or you get > an IndexOutOfBound exception. > > Here is the fix: First off, you will need to post patched in unidiff format (pass -u to diff). You might want to add the following to your ~/.cvsrc file. % cat ~/.cvsrc cvs -q -z3 diff -uN update -P It would also be great if you could attach a test case for this problem. The IO subsystem is in the middle of a rewrite just now so every test case helps. > Also, since "file copy" can be used to copy big binary files, > wouldn't something that works with bytes be better than chars > (just to avoid the possibility that Java would do something > strange with character encoding). Encodings don't work at all just now. The IO subsystem rewrite should take care of this, and it will change a bunch of things. cheers Mo |