harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r419923 - in /incubator/harmony/enhanced/classlib/trunk/modules/nio/src: main/java/java/nio/ test/java/common/org/apache/harmony/tests/java/nio/
Date Fri, 07 Jul 2006 17:00:01 GMT
Author: tellison
Date: Fri Jul  7 10:00:01 2006
New Revision: 419923

URL: http://svn.apache.org/viewvc?rev=419923&view=rev
Log:
Fix for HARMONY-801 ([classlib][nio] java.nio.ByteBuffer.put(byte[], int off, Integer.MAX_VALUE)
throws java.nio.BufferUnderflowException instead of IndexOutOfBoundsException)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteCharArrayBuffer.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteDirectByteBuffer.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteDoubleArrayBuffer.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteFloatArrayBuffer.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteHeapByteBuffer.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteIntArrayBuffer.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteLongArrayBuffer.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteShortArrayBuffer.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/common/org/apache/harmony/tests/java/nio/ByteBufferTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteCharArrayBuffer.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteCharArrayBuffer.java?rev=419923&r1=419922&r2=419923&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteCharArrayBuffer.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteCharArrayBuffer.java
Fri Jul  7 10:00:01 2006
@@ -101,7 +101,7 @@
 	}
 
     public CharBuffer put(char[] src, int off, int len) {
-        if (off < 0 || len < 0 || len + off > src.length) {
+        if (off < 0 || len < 0 || (long)len + (long)off > src.length) {
             throw new IndexOutOfBoundsException();
         }
         if (len > remaining()) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteDirectByteBuffer.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteDirectByteBuffer.java?rev=419923&r1=419922&r2=419923&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteDirectByteBuffer.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteDirectByteBuffer.java
Fri Jul  7 10:00:01 2006
@@ -101,7 +101,7 @@
      * @see java.nio.ByteBuffer#put(byte[], int, int)
      */
     public ByteBuffer put(byte[] src, int off, int len) {
-        if (off < 0 || len < 0 || off + len > src.length) {
+        if (off < 0 || len < 0 || (long)off + (long)len > src.length) {
             throw new IndexOutOfBoundsException();
         }
         if (len > remaining()) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteDoubleArrayBuffer.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteDoubleArrayBuffer.java?rev=419923&r1=419922&r2=419923&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteDoubleArrayBuffer.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteDoubleArrayBuffer.java
Fri Jul  7 10:00:01 2006
@@ -104,7 +104,7 @@
 	}
 
     public DoubleBuffer put(double[] src, int off, int len) {
-        if (off < 0 || len < 0 || off + len < 0 || off + len > src.length) {
+        if (off < 0 || len < 0 || (long)off + (long)len > src.length) {
 			throw new IndexOutOfBoundsException();
 		}
         if (len > remaining()) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteFloatArrayBuffer.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteFloatArrayBuffer.java?rev=419923&r1=419922&r2=419923&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteFloatArrayBuffer.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteFloatArrayBuffer.java
Fri Jul  7 10:00:01 2006
@@ -104,7 +104,7 @@
 	}
 
     public FloatBuffer put(float[] src, int off, int len) {
-        if (off < 0 || len < 0 || off + len > src.length) {
+        if (off < 0 || len < 0 || (long)off + (long)len > src.length) {
             throw new IndexOutOfBoundsException();
         }
         if (len > remaining()) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteHeapByteBuffer.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteHeapByteBuffer.java?rev=419923&r1=419922&r2=419923&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteHeapByteBuffer.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteHeapByteBuffer.java
Fri Jul  7 10:00:01 2006
@@ -109,7 +109,7 @@
      * @see java.nio.ByteBuffer#put(byte[], int, int)
      */
     public ByteBuffer put(byte[] src, int off, int len) {
-        if (off < 0 || len < 0 || off + len > src.length) {
+        if (off < 0 || len < 0 || (long)off + (long)len > src.length) {
             throw new IndexOutOfBoundsException();
         }
         if (len > remaining()) {
@@ -151,7 +151,7 @@
 	}
 
 	public ByteBuffer putInt(int index, int value) {
-		if (index < 0 || index + 4 > limit) {
+		if (index < 0 || (long)index + 4 > limit) {
 			throw new IndexOutOfBoundsException();
 		}
 		store(index, value);
@@ -159,7 +159,7 @@
 	}
 
 	public ByteBuffer putLong(int index, long value) {
-		if (index < 0 || index + 8 > limit) {
+		if (index < 0 || (long)index + 8 > limit) {
 			throw new IndexOutOfBoundsException();
 		}
 		store(index, value);
@@ -177,7 +177,7 @@
 	}
 
 	public ByteBuffer putShort(int index, short value) {
-		if (index < 0 || index + 2 > limit) {
+		if (index < 0 || (long)index + 2 > limit) {
 			throw new IndexOutOfBoundsException();
 		}
 		store(index, value);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteIntArrayBuffer.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteIntArrayBuffer.java?rev=419923&r1=419922&r2=419923&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteIntArrayBuffer.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteIntArrayBuffer.java
Fri Jul  7 10:00:01 2006
@@ -101,7 +101,7 @@
 	}
 
     public IntBuffer put(int[] src, int off, int len) {
-        if (off < 0 || len < 0 || off + len > src.length) {
+        if (off < 0 || len < 0 || (long)off + (long)len > src.length) {
             throw new IndexOutOfBoundsException();
         }
         if (len > remaining()) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteLongArrayBuffer.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteLongArrayBuffer.java?rev=419923&r1=419922&r2=419923&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteLongArrayBuffer.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteLongArrayBuffer.java
Fri Jul  7 10:00:01 2006
@@ -101,7 +101,7 @@
 	}
 
     public LongBuffer put(long[] src, int off, int len) {
-        if (off < 0 || len < 0 || off + len > src.length) {
+        if (off < 0 || len < 0 || (long)off + (long)len > src.length) {
             throw new IndexOutOfBoundsException();
         }
         if (len > remaining()) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteShortArrayBuffer.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteShortArrayBuffer.java?rev=419923&r1=419922&r2=419923&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteShortArrayBuffer.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadWriteShortArrayBuffer.java
Fri Jul  7 10:00:01 2006
@@ -104,7 +104,7 @@
 	}
 
     public ShortBuffer put(short[] src, int off, int len) {
-        if (off < 0 || len < 0 || off + len > src.length) {
+        if (off < 0 || len < 0 || (long)off + (long)len > src.length) {
             throw new IndexOutOfBoundsException();
         }
         if (len > remaining()) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/common/org/apache/harmony/tests/java/nio/ByteBufferTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/common/org/apache/harmony/tests/java/nio/ByteBufferTest.java?rev=419923&r1=419922&r2=419923&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/common/org/apache/harmony/tests/java/nio/ByteBufferTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/common/org/apache/harmony/tests/java/nio/ByteBufferTest.java
Fri Jul  7 10:00:01 2006
@@ -569,6 +569,14 @@
         } catch (IndexOutOfBoundsException e) {
             // expected
         }
+
+        try {
+            buf.put(array, 2, Integer.MAX_VALUE);
+            fail("Should throw Exception"); //$NON-NLS-1$
+        } catch (IndexOutOfBoundsException e) {
+            // expected
+        }
+        
         assertEquals(buf.position(), 0);
 
         loadTestData2(array, 0, array.length);



Mime
View raw message