This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Patch: FYI: BufferedWriter fix


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.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]