Fix exception throwing to support no detail message.
(The empty string as a detail message is distinct from a NULL detail message,
and is treated differently by Throwable.printStackTrace.)
Change-Id: I8c65deac9f18c5782dcf6e72e4c37e6dd4174fe9
diff --git a/src/object.cc b/src/object.cc
index f8c9624..4a6e649 100644
--- a/src/object.cc
+++ b/src/object.cc
@@ -1225,13 +1225,13 @@
}
bool Array::ThrowArrayIndexOutOfBoundsException(int32_t index) const {
- Thread::Current()->ThrowNewException("Ljava/lang/ArrayIndexOutOfBoundsException;",
+ Thread::Current()->ThrowNewExceptionF("Ljava/lang/ArrayIndexOutOfBoundsException;",
"length=%i; index=%i", length_, index);
return false;
}
bool Array::ThrowArrayStoreException(Object* object) const {
- Thread::Current()->ThrowNewException("Ljava/lang/ArrayStoreException;",
+ Thread::Current()->ThrowNewExceptionF("Ljava/lang/ArrayStoreException;",
"Can't store an element of type %s into an array of type %s",
PrettyTypeOf(object).c_str(), PrettyTypeOf(this).c_str());
return false;
@@ -1296,7 +1296,7 @@
// bounds check itself.
if (index < 0 || index >= count_) {
Thread* self = Thread::Current();
- self->ThrowNewException("Ljava/lang/StringIndexOutOfBoundsException;",
+ self->ThrowNewExceptionF("Ljava/lang/StringIndexOutOfBoundsException;",
"length=%i; index=%i", count_, index);
return 0;
}