From: Elliott Hughes Date: Sat, 4 Dec 2010 00:37:54 +0000 (-0800) Subject: Make the inlined String.charAt throw detailed exceptions. X-Git-Tag: android-x86-4.0-r1~245^2~4 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=56f10be996d9766cb1b90e7c072e6f077d3e1d80;p=android-x86%2Fdalvik.git Make the inlined String.charAt throw detailed exceptions. Part of my general push for better exceptions. I'll add a unit test to libcore, but until we lose the dexopt brain damage, we won't be able to see it (dexopt can't optimize JUnit tests, so we get no coverage of inline natives on our continuous builds; http://b/3003994). Change-Id: I3af757751534747fa4b3cc725b0914a8f7b3d45d --- diff --git a/vm/InlineNative.c b/vm/InlineNative.c index 9db97baed..c426d4d8c 100644 --- a/vm/InlineNative.c +++ b/vm/InlineNative.c @@ -137,7 +137,8 @@ static bool javaLangString_charAt(u4 arg0, u4 arg1, u4 arg2, u4 arg3, //LOGI("String.charAt this=0x%08x index=%d\n", arg0, arg1); count = dvmGetFieldInt((Object*) arg0, STRING_FIELDOFF_COUNT); if ((s4) arg1 < 0 || (s4) arg1 >= count) { - dvmThrowException("Ljava/lang/StringIndexOutOfBoundsException;", NULL); + dvmThrowExceptionFmt("Ljava/lang/StringIndexOutOfBoundsException;", + "index=%d length=%d", arg1, count); return false; } else { offset = dvmGetFieldInt((Object*) arg0, STRING_FIELDOFF_OFFSET);