RFR (XS) 8221307 : String.substring() OOB exception on start index reports improper information
Roger.Riggs at oracle.com
Thu Aug 8 13:50:41 UTC 2019
To be consistent with other checks of the index, can you use the
checkIndex(index, length) method?
The message it produces would be appropriate for both cases.
While you are there can you add a space after the comma
in lines 3680 and 3691.
Is there an appropriate test? There should be.
On 8/7/19 8:17 PM, Ivan Gerasimov wrote:
> 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?
More information about the core-libs-dev