This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
BufferedWriter.write bounds checks
- To: java-patches at gcc dot gnu dot org
- Subject: BufferedWriter.write bounds checks
- From: Bryce McKinlay <bryce at waitaki dot otago dot ac dot nz>
- Date: Tue, 23 Oct 2001 19:05:57 +1300
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)