diff options
author | Pekka Enberg <penberg@kernel.org> | 2012-03-15 22:13:03 +0200 |
---|---|---|
committer | Pekka Enberg <penberg@kernel.org> | 2012-10-15 13:13:08 +0300 |
commit | a1e2fbeff01860fc2c7ad5c8a0a6982e5ca14b95 (patch) | |
tree | 5b1e9caf86b6991da25fa456f0e8f07a71199307 | |
parent | a6c8cc78aa8a7480519458c4f0aed648a3459599 (diff) | |
download | classpath-a1e2fbeff01860fc2c7ad5c8a0a6982e5ca14b95.tar.gz |
Fix java/lang/String.codePoint{At|Before} exception types
OpenJDK throws StringIndexOutOfBoundsException and so should we.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | java/lang/String.java | 4 |
2 files changed, 10 insertions, 0 deletions
@@ -1,3 +1,9 @@ +2012-03-15 Pekka Enberg <penberg@kernel.org> + + * java/lang/String.java: + (codePointAt(int))): Fix exception type. + (codePointBefore(int)): Fix exception type. + 2011-07-20 Ivan Maidanski <ivmai@mail.ru> * native/jni/java-util/java_util_VMTimeZone.c: diff --git a/java/lang/String.java b/java/lang/String.java index 45c0daff6..eb713ce2a 100644 --- a/java/lang/String.java +++ b/java/lang/String.java @@ -705,6 +705,8 @@ public final class String */ public synchronized int codePointAt(int index) { + if (index < 0 || index >= count) + throw new StringIndexOutOfBoundsException(index); // Use the CharSequence overload as we get better range checking // this way. return Character.codePointAt(this, index); @@ -722,6 +724,8 @@ public final class String */ public synchronized int codePointBefore(int index) { + if (index < 0 || index >= count) + throw new StringIndexOutOfBoundsException(index); // Use the CharSequence overload as we get better range checking // this way. return Character.codePointBefore(this, index); |