summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2010-04-12 10:29:14 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-04-12 10:29:14 -0700
commita4f2f93f298b44b7817bd6e7631b13ce08adeb04 (patch)
tree86d495997f35aaf405a6c249ea7576977118a509
parent3e136a83aa21a186cec5451655842e7bb9f47231 (diff)
parentd9d4093169787d2a52d0e392933f77ec08ff1045 (diff)
downloadlibcore-a4f2f93f298b44b7817bd6e7631b13ce08adeb04.zip
libcore-a4f2f93f298b44b7817bd6e7631b13ce08adeb04.tar.gz
libcore-a4f2f93f298b44b7817bd6e7631b13ce08adeb04.tar.bz2
Merge "Throw the same exceptions as the RI from String methods." into dalvik-dev
-rw-r--r--luni/src/main/java/java/lang/String.java11
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);