DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18214>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18214 Call to BufferedReader.read in Replace Task reads wrong number of bytes Summary: Call to BufferedReader.read in Replace Task reads wrong number of bytes Product: Ant Version: 1.3 Platform: PC OS/Version: Linux Status: NEW Severity: Critical Priority: Other Component: Core tasks AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] On line 293 of org.apache.tools.ant.taskdefs.Replace, the total length of the file is always passed into the read method of the BufferedReader. That works fine if the underlying read implementation manages to read the whole file at once, but you get an IndexOutOfBoundsException if it takes multiple reads to get all contents of the file. I think the solution is to pass in fileLength - totread as the third argument to the read method, but there might be an off by one error with that (I'm not sure). That solutions seems to work for me. Note that I found this bug in the source for version 1.3 of Ant. I do not know if it exists in later versions. Also, this is fairly hard to reproduce (except on my machine), since it is dependent on a lot of underlying VM/OS/hardware stuff.