summaryrefslogtreecommitdiff
path: root/src/java_lang_System.cc
diff options
context:
space:
mode:
author Elliott Hughes <enh@google.com> 2011-10-02 12:13:39 -0700
committer Elliott Hughes <enh@google.com> 2011-10-02 12:13:39 -0700
commit5cb5ad27944efb08d4556b3c0d362302e37e832b (patch)
tree63334f19072ca2ba7179973f0ce62101ee89605d /src/java_lang_System.cc
parentd6fe38d96b6116bd53cf2cb14734af8d69e08661 (diff)
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
Diffstat (limited to 'src/java_lang_System.cc')
-rw-r--r--src/java_lang_System.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/java_lang_System.cc b/src/java_lang_System.cc
index 42bae22c40..4a6e8db955 100644
--- a/src/java_lang_System.cc
+++ b/src/java_lang_System.cc
@@ -106,7 +106,8 @@ namespace {
void ThrowArrayStoreException_NotAnArray(const char* identifier, Object* array) {
std::string actualType(PrettyTypeOf(array));
- Thread::Current()->ThrowNewException("Ljava/lang/ArrayStoreException;", "%s is not an array: %s", identifier, actualType.c_str());
+ Thread::Current()->ThrowNewExceptionF("Ljava/lang/ArrayStoreException;",
+ "%s is not an array: %s", identifier, actualType.c_str());
}
void System_arraycopy(JNIEnv* env, jclass, jobject javaSrc, jint srcPos, jobject javaDst, jint dstPos, jint length) {
@@ -140,7 +141,7 @@ void System_arraycopy(JNIEnv* env, jclass, jobject javaSrc, jint srcPos, jobject
// Bounds checking.
if (srcPos < 0 || dstPos < 0 || length < 0 || srcPos > srcArray->GetLength() - length || dstPos > dstArray->GetLength() - length) {
- self->ThrowNewException("Ljava/lang/ArrayIndexOutOfBoundsException;",
+ self->ThrowNewExceptionF("Ljava/lang/ArrayIndexOutOfBoundsException;",
"src.length=%d srcPos=%d dst.length=%d dstPos=%d length=%d",
srcArray->GetLength(), srcPos, dstArray->GetLength(), dstPos, length);
return;
@@ -155,7 +156,7 @@ void System_arraycopy(JNIEnv* env, jclass, jobject javaSrc, jint srcPos, jobject
if (srcComponentType->IsPrimitive() != dstComponentType->IsPrimitive() || srcComponentType != dstComponentType) {
std::string srcType(PrettyTypeOf(srcArray));
std::string dstType(PrettyTypeOf(dstArray));
- self->ThrowNewException("Ljava/lang/ArrayStoreException;",
+ self->ThrowNewExceptionF("Ljava/lang/ArrayStoreException;",
"Incompatible types: src=%s, dst=%s", srcType.c_str(), dstType.c_str());
return;
}
@@ -231,7 +232,7 @@ void System_arraycopy(JNIEnv* env, jclass, jobject javaSrc, jint srcPos, jobject
if (copyCount != length) {
std::string actualSrcType(PrettyTypeOf(srcObj[copyCount]));
std::string dstType(PrettyTypeOf(dstArray));
- self->ThrowNewException("Ljava/lang/ArrayStoreException;",
+ self->ThrowNewExceptionF("Ljava/lang/ArrayStoreException;",
"source[%d] of type %s cannot be stored in destination array of type %s",
srcPos + copyCount, actualSrcType.c_str(), dstType.c_str());
return;