OSDN Git Service

Correct the reported index.
authorDan Bornstein <danfuzz@android.com>
Wed, 16 Mar 2011 18:23:57 +0000 (11:23 -0700)
committerDan Bornstein <danfuzz@android.com>
Wed, 16 Mar 2011 18:23:57 +0000 (11:23 -0700)
When asked to copy an incompatible reference, System.arraycopy() would
complain about the nth element it was to copy, and not the absolute
index of that element.

Change-Id: I0f4a159b96fbedf083c3add57d2e20ee750d70fe

vm/native/java_lang_System.c

index 5402a7b..72ace57 100644 (file)
@@ -285,7 +285,7 @@ static void Dalvik_java_lang_System_arraycopy(const u4* args, JValue* pResult)
             if (copyCount != length) {
                 dvmThrowExceptionFmt(gDvm.exArrayStoreException,
                     "source[%d] of type %s cannot be stored in destination array of type %s",
-                    copyCount, srcObj[copyCount]->clazz->descriptor,
+                    srcPos + copyCount, srcObj[copyCount]->clazz->descriptor,
                     dstClass->descriptor);
                 RETURN_VOID();
             }