diff options
-rw-r--r-- | luni/src/main/java/java/lang/String.java | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/luni/src/main/java/java/lang/String.java b/luni/src/main/java/java/lang/String.java index 0e0381c..cb39e25 100644 --- a/luni/src/main/java/java/lang/String.java +++ b/luni/src/main/java/java/lang/String.java @@ -649,9 +649,8 @@ public final class String implements Serializable, Comparable<String>, if (codePoints == null) { throw new NullPointerException(); } - if (offset < 0 || count < 0 - || (long) offset + (long) count > codePoints.length) { - throw new IndexOutOfBoundsException(); + if (offset < 0 || count < 0 || (long) offset + (long) count > codePoints.length) { + throw new StringIndexOutOfBoundsException(); } this.offset = 0; this.value = new char[count * 2]; @@ -2196,7 +2195,7 @@ public final class String implements Serializable, Comparable<String>, */ public int codePointAt(int index) { if (index < 0 || index >= count) { - throw new IndexOutOfBoundsException(); + throw new StringIndexOutOfBoundsException(); } int s = index + offset; return Character.codePointAt(value, s, offset + count); @@ -2217,7 +2216,7 @@ public final class String implements Serializable, Comparable<String>, */ public int codePointBefore(int index) { if (index < 1 || index > count) { - throw new IndexOutOfBoundsException(); + throw new StringIndexOutOfBoundsException(); } int s = index + offset; return Character.codePointBefore(value, s); @@ -2241,7 +2240,7 @@ public final class String implements Serializable, Comparable<String>, */ public int codePointCount(int beginIndex, int endIndex) { if (beginIndex < 0 || endIndex > count || beginIndex > endIndex) { - throw new IndexOutOfBoundsException(); + throw new StringIndexOutOfBoundsException(); } int s = beginIndex + offset; return Character.codePointCount(value, s, endIndex - beginIndex); |