RFR (XS) 8221307 : String.substring() OOB exception on start index reports improper information

Ivan Gerasimov ivan.gerasimov at oracle.com
Thu Aug 8 00:17:49 UTC 2019


The exception thrown by substring(int) may look confusing.
For example it produces "String index out of range: -1" when the index 
is length+1.

It is proposed to make the error message more clear, similar to what we 
have for substring(int, int).

BUGURL: https://bugs.openjdk.java.net/browse/JDK-8221307
WEBREV: http://cr.openjdk.java.net/~igerasim/8221307/00/webrev/

Would you please help review?

With kind regards,
Ivan Gerasimov

More information about the core-libs-dev mailing list