Better exception messages.

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@231331 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary D. Gregory 2005-08-10 21:22:11 +00:00
parent 1c57bb797d
commit 030267a91b
1 changed files with 2 additions and 2 deletions

View File

@ -556,10 +556,10 @@ public class StrBuilder implements Cloneable {
return this; return this;
} }
if (startIndex < 0 || startIndex > chars.length) { if (startIndex < 0 || startIndex > chars.length) {
throw new StringIndexOutOfBoundsException("startIndex must be valid"); throw new StringIndexOutOfBoundsException("Invalid startIndex: " + length);
} }
if (length < 0 || (startIndex + length) > chars.length) { if (length < 0 || (startIndex + length) > chars.length) {
throw new StringIndexOutOfBoundsException("length must be valid"); throw new StringIndexOutOfBoundsException("Invalid length: " + length);
} }
if (length > 0) { if (length > 0) {
int len = length(); int len = length();