harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r1005651 - /harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/lang/String.java
Date Thu, 07 Oct 2010 22:03:08 GMT
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;



Mime
View raw message