This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: Patch: FYI: BufferedWriter fix
- To: tromey at redhat dot com
- Subject: Re: Patch: FYI: BufferedWriter fix
- From: Bryce McKinlay <bryce at waitaki dot otago dot ac dot nz>
- Date: Fri, 19 Oct 2001 12:50:41 +1300
- CC: Java Patch List <java-patches at gcc dot gnu dot org>
- References: <87heswijnt.fsf@creche.redhat.com>
Tom Tromey wrote:
>@@ -199,7 +199,7 @@
> */
> public void write (String str, int offset, int len) throws IOException
> {
>- if (offset < 0 || len < 0 || offset + len < str.length())
>+ if (offset < 0 || len < 0 || offset + len > str.length())
> throw new ArrayIndexOutOfBoundsException ();
>
> synchronized (lock)
>
I think we can get rid of those checks all together. I can't see a
situation where the exception won't be thrown either automatically by
Java or by the underlying String.getChars() call.
regards
Bryce.