OSDN Git Service

Fix crash occuring when using Recognizer
authorJohn Eckerdal <john.eckerdal@sonyericsson.com>
Mon, 3 Jan 2011 12:19:27 +0000 (13:19 +0100)
committerJohan Redestig <johan.redestig@sonyericsson.com>
Mon, 3 Jan 2011 12:19:27 +0000 (13:19 +0100)
The SR_RecognizerResultGetKeyList should return [Ljava/lang/String,
however the code as written before the change will actually return
[[Ljava/lang/String

This "worked" before, probably by accident, but since
dvmFindArrayClassForElement has been rewritten to no longer used a
cached arrayClass. The dvmFindArrayClassForElement actually prepends
the [ and it should not be in SR_RecognizerResultGetKeyList.

Change-Id: Ida74600f224d8a7f9906c51b1881dcb9451cc289

srec_jni/android_speech_srec_Recognizer.cpp

index abaf883..e0cd0f6 100644 (file)
@@ -503,7 +503,7 @@ static JNIEXPORT jobjectArray JNICALL Java_android_speech_srec_Recognizer_SR_1Re
     }
 
     // create String[] of keys
-    jclass stringClass = env->FindClass("[Ljava/lang/String;");
+    jclass stringClass = env->FindClass("java/lang/String");
     if (!stringClass) return NULL;
     jobjectArray array = env->NewObjectArray(listSize, stringClass, NULL);
     if (!array) return NULL;