diff -r a3f03999ed62 -r 7e1bb9268b8a jdk/src/java.base/share/classes/java/lang/StringIndexOutOfBoundsException.java --- a/jdk/src/java.base/share/classes/java/lang/StringIndexOutOfBoundsException.java Tue Oct 06 18:39:26 2015 -0700 +++ b/jdk/src/java.base/share/classes/java/lang/StringIndexOutOfBoundsException.java Wed Oct 07 15:22:43 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,44 +26,61 @@ package java.lang; /** - * Thrown by {@code String} methods to indicate that an index - * is either negative or greater than the size of the string. For - * some methods such as the charAt method, this exception also is - * thrown when the index is equal to the size of the string. + * Thrown by {@code String} methods to indicate that an index is either negative + * or greater than the size of the string. For some methods such as the + * {@link String#charAt charAt} method, this exception also is thrown when the + * index is equal to the size of the string. * - * @author unascribed - * @see java.lang.String#charAt(int) - * @since 1.0 + * @see java.lang.String#charAt(int) + * @since 1.0 */ -public -class StringIndexOutOfBoundsException extends IndexOutOfBoundsException { +public class StringIndexOutOfBoundsException extends IndexOutOfBoundsException { private static final long serialVersionUID = -6762910422159637258L; /** - * Constructs a {@code StringIndexOutOfBoundsException} with no - * detail message. + * Constructs a {@code StringIndexOutOfBoundsException} with no detail + * message. */ public StringIndexOutOfBoundsException() { super(); } /** - * Constructs a {@code StringIndexOutOfBoundsException} with - * the specified detail message. + * Constructs a {@code StringIndexOutOfBoundsException} with the specified + * detail message. * - * @param s the detail message. + * @param s the detail message. */ public StringIndexOutOfBoundsException(String s) { super(s); } /** - * Constructs a new {@code StringIndexOutOfBoundsException} - * class with an argument indicating the illegal index. + * Constructs a new {@code StringIndexOutOfBoundsException} class with an + * argument indicating the illegal index. * - * @param index the illegal index. + *

The index is included in this exception's detail message. The + * exact presentation format of the detail message is unspecified. + * + * @param index the illegal index. */ public StringIndexOutOfBoundsException(int index) { super("String index out of range: " + index); } + + /** + * Constructs a new {@code StringIndexOutOfBoundsException} class with + * arguments indicating two out of bound values. + * + *

The out of bound values are included in this exception's detail + * message. The exact presentation format of the detail message is + * unspecified. + * + * @param a the first out of bound value. + * @param b the second out of bound value. + * @since 9 + */ + public StringIndexOutOfBoundsException(int a, int b) { + super("String indexed access out of bounds: " + a + ", " + b); + } }