# HG changeset patch # User sherman # Date 1418249465 28800 # Node ID 8d98ed07bc286c34ddfec9f47830cf7cd6c0efad # Parent 03e0e38915720fb5781317947d7c24fa814e9431 8046219: (str spec) String(byte[], int, int, Charset) should be clearer when IndexOutOfBoundsException is thrown Summary: to update the java doc to clarify the existing behavior Reviewed-by: lancea diff -r 03e0e3891572 -r 8d98ed07bc28 jdk/src/java.base/share/classes/java/lang/String.java --- a/jdk/src/java.base/share/classes/java/lang/String.java Wed Dec 10 18:31:24 2014 +0100 +++ b/jdk/src/java.base/share/classes/java/lang/String.java Wed Dec 10 14:11:05 2014 -0800 @@ -184,8 +184,8 @@ * The length * * @throws IndexOutOfBoundsException - * If the {@code offset} and {@code count} arguments index - * characters outside the bounds of the {@code value} array + * If {@code offset} is negative, {@code count} is negative, or + * {@code offset} is greater than {@code value.length - count} */ public String(char value[], int offset, int count) { if (offset < 0) { @@ -224,8 +224,8 @@ * codePoints} * * @throws IndexOutOfBoundsException - * If the {@code offset} and {@code count} arguments index - * characters outside the bounds of the {@code codePoints} array + * If {@code offset} is negative, {@code count} is negative, or + * {@code offset} is greater than {@code codePoints.length - count} * * @since 1.5 */ @@ -297,7 +297,8 @@ * The length * * @throws IndexOutOfBoundsException - * If the {@code offset} or {@code count} argument is invalid + * If {@code offset} is negative, {@code count} is negative, or + * {@code offset} is greater than {@code ascii.length - count} * * @see #String(byte[], int) * @see #String(byte[], int, int, java.lang.String) @@ -401,8 +402,8 @@ * If the named charset is not supported * * @throws IndexOutOfBoundsException - * If the {@code offset} and {@code length} arguments index - * characters outside the bounds of the {@code bytes} array + * If {@code offset} is negative, {@code length} is negative, or + * {@code offset} is greater than {@code bytes.length - length} * * @since 1.1 */ @@ -439,8 +440,8 @@ * decode the {@code bytes} * * @throws IndexOutOfBoundsException - * If the {@code offset} and {@code length} arguments index - * characters outside the bounds of the {@code bytes} array + * If {@code offset} is negative, {@code length} is negative, or + * {@code offset} is greater than {@code bytes.length - length} * * @since 1.6 */ @@ -524,8 +525,8 @@ * The number of bytes to decode * * @throws IndexOutOfBoundsException - * If the {@code offset} and the {@code length} arguments index - * characters outside the bounds of the {@code bytes} array + * If {@code offset} is negative, {@code length} is negative, or + * {@code offset} is greater than {@code bytes.length - length} * * @since 1.1 */