Hi,

perhaps a stupid question, but why isn't String::substring(int) calling substring(beginIndex, length())? That'd ensure consistent error
messages, but otherwise preserve semantics.

/Claes

On 2019-08-08 02:17, Ivan Gerasimov wrote:
Hello!

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?

Reply via email to