You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by hi...@apache.org on 2010/10/08 00:03:08 UTC
svn commit: r1005651 -
/harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/lang/String.java
Author: hindessm
Date: Thu Oct 7 22:03:07 2010
New Revision: 1005651
URL: http://svn.apache.org/viewvc?rev=1005651&view=rev
Log:
Remove another explicit NPE. I'm not re-ordering the bounds checking
here as it turns out:
String s = new String((int[])null, -1, 0);
and:
String s = new String((int[])null, 0, -1);
on the RI throw IndexOutOfBoundsException not NullPointerException.
So the behaviour before did not match the RI.
Modified:
harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/lang/String.java
Modified: harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/lang/String.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/lang/String.java?rev=1005651&r1=1005650&r2=1005651&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/lang/String.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/lang/String.java Thu Oct 7 22:03:07 2010
@@ -492,11 +492,7 @@ public final class String implements Ser
*/
public String(int[] codePoints, int offset, int count) {
super();
- if (codePoints == null) {
- throw new NullPointerException();
- }
- if (offset < 0 || count < 0
- || (long) offset + (long) count > codePoints.length) {
+ if (offset < 0 || count < 0 || offset > codePoints.length - count) {
throw new IndexOutOfBoundsException();
}
this.offset = 0;