IllegalArgumentException expects a string.

Review URL: http://codereview.chromium.org//8277007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@402 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
ngeoffray@google.com 2011-10-13 16:19:06 +00:00
parent 145154cf2b
commit 9e03f7c985
3 changed files with 11 additions and 7 deletions

View file

@ -29,7 +29,7 @@ class ArrayFactory {
length = 0;
isFixed = false;
} else if (length < 0) {
throw new IllegalArgumentException(length);
throw new IllegalArgumentException("negative length $length");
}
// TODO(floitsch): make array creation more efficient. Currently we allocate
// a new TypeToken at every allocation. Either we can optimize them away,
@ -71,7 +71,7 @@ class ListFactory {
length = 0;
isFixed = false;
} else if (length < 0) {
throw new IllegalArgumentException(length);
throw new IllegalArgumentException("negative length $length");
}
// TODO(floitsch): make array creation more efficient. Currently we allocate
// a new TypeToken at every allocation. Either we can optimize them away,
@ -159,7 +159,7 @@ class ObjectArray<T> implements Array<T> native "Array" {
return;
}
if (length < 0) {
throw const IllegalArgumentException();
throw new IllegalArgumentException("negative length $length");
}
Arrays.copy(from, startFrom, this, start, length);
}
@ -173,7 +173,7 @@ class ObjectArray<T> implements Array<T> native "Array" {
return;
}
if (length < 0) {
throw const IllegalArgumentException();
throw new IllegalArgumentException("negative length $length");
}
if (start < 0 || start >= this.length) {
throw new IndexOutOfRangeException(start);

View file

@ -93,7 +93,9 @@ class ObjectArray<T> implements Array<T> {
native "ObjectArray_copyFromObjectArray";
void setRange(int start, int length, List<T> from, [int startFrom = 0]) {
if (length < 0) throw new IllegalArgumentException(length);
if (length < 0) {
throw new IllegalArgumentException("negative length $length");
}
copyFrom(from, start, startFrom, count);
}

View file

@ -10,7 +10,9 @@ class GrowableObjectArray<T> implements Array<T> {
}
void setRange(int start, int length, List<T> from, [int startFrom = 0]) {
if (length < 0) throw new IllegalArgumentException(length);
if (length < 0) {
throw new IllegalArgumentException("negative length $length");
}
Arrays.copy(from, startFrom, this, start, length);
}
@ -19,7 +21,7 @@ class GrowableObjectArray<T> implements Array<T> {
return;
}
if (length < 0) {
throw const IllegalArgumentException();
throw new IllegalArgumentException("negative length $length");
}
if (start < 0 || start >= this.length) {
throw new IndexOutOfRangeException(start);