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]

BufferedWriter.write bounds checks


These checks are redundant because they will be done by the underlying 
getChars() call in the String case, and automatically by the language in 
the char[] case.

regards

Bryce.

    * java/io/BufferedWriter (write (String, int, int)): Remove redundant
    bounds checks.
    (write (char[], int, int)): Likewise.

Index: java/io/BufferedWriter.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/BufferedWriter.java,v
retrieving revision 1.6
diff -u -r1.6 BufferedWriter.java
--- BufferedWriter.java 2001/10/18 23:43:59     1.6
+++ BufferedWriter.java 2001/10/23 06:02:29
@@ -160,9 +160,6 @@
    */
   public void write (char[] buf, int offset, int len) throws IOException
   {
-    if (offset < 0 || len < 0 || offset + len > buf.length)
-      throw new ArrayIndexOutOfBoundsException ();
-
     synchronized (lock)
       {
        if (buffer == null)
@@ -199,9 +196,6 @@
    */
   public void write (String str, int offset, int len) throws IOException
   {
-    if (offset < 0 || len < 0 || offset + len > str.length())
-      throw new ArrayIndexOutOfBoundsException ();
-
     synchronized (lock)
       {
        if (buffer == null)



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