harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r420929 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/lang/String.java test/java/tests/api/java/lang/StringTest.java
Date Tue, 11 Jul 2006 17:12:31 GMT
Author: tellison
Date: Tue Jul 11 10:12:30 2006
New Revision: 420929

URL: http://svn.apache.org/viewvc?rev=420929&view=rev
Log:
Fix for HARMONY-791 ([classlib][lang] unexpected NegativeArraySizeException for java.lang.String(int[],
2, Integer.MAX_VALUE))

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/String.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/StringTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/String.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/String.java?rev=420929&r1=420928&r2=420929&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/String.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/String.java
Tue Jul 11 10:12:30 2006
@@ -498,7 +498,7 @@
         super();
         if (codePoints == null)
             throw new NullPointerException();
-        if (offset < 0 || count < 0 || (offset + count) > codePoints.length)
+        if (offset < 0 || count < 0 || (long)offset + (long)count > codePoints.length)
             throw new IndexOutOfBoundsException();
         this.offset = 0;
         this.value = new char[count * 2];

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/StringTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/StringTest.java?rev=420929&r1=420928&r2=420929&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/StringTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/StringTest.java
Tue Jul 11 10:12:30 2006
@@ -151,6 +151,19 @@
 	}
 
 	/**
+	 * @tests java.lang.String#String(int[], int, int)
+	 */
+	public void test_Constructor$III() {
+		// Test for method java.lang.String(int [], int, int)
+		try {
+			new String(new int[0], 2, Integer.MAX_VALUE);
+			fail("Did not throw exception");
+		} catch (IndexOutOfBoundsException e) {
+			//expected
+		}
+	}
+
+	/**
 	 * @tests java.lang.String#String(java.lang.String)
 	 */
 	public void test_ConstructorLjava_lang_String() {



Mime
View raw message