From ab808cef24b43451dbd78988a002ac71d17c03eb Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 14 Jun 2012 21:07:46 +0200 Subject: [PATCH] Fix JNI overflow --- Osmand-kernel/osmand/src/java_wrap.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Osmand-kernel/osmand/src/java_wrap.cpp b/Osmand-kernel/osmand/src/java_wrap.cpp index 4c1f46e338..a21d5bd35f 100644 --- a/Osmand-kernel/osmand/src/java_wrap.cpp +++ b/Osmand-kernel/osmand/src/java_wrap.cpp @@ -449,6 +449,7 @@ extern "C" JNIEXPORT jobjectArray JNICALL Java_net_osmand_NativeLibrary_loadRout RoutingIndex ind; ind.filePointer = filepointer; ind.name = getString(ienv, regName); + jclass jclIntArray = ienv->FindClass("[I"); std::vector result; SearchQuery q(left, right, top, bottom); @@ -457,7 +458,6 @@ extern "C" JNIEXPORT jobjectArray JNICALL Java_net_osmand_NativeLibrary_loadRout for (jint i = 0; i < result.size(); i++) { if (result[i] != NULL) { jobject robj = ienv->NewObject(jclass_RouteDataObject, jmethod_RouteDataObject_init, reg); - ienv->NewLocalRef(robj); ienv->SetLongField(robj, jfield_RouteDataObject_id, result[i]->id); jintArray types = ienv->NewIntArray(result[i]->types.size()); @@ -490,7 +490,7 @@ extern "C" JNIEXPORT jobjectArray JNICALL Java_net_osmand_NativeLibrary_loadRout ienv->DeleteLocalRef(restrictions); - jobjectArray pointTypes = ienv->NewObjectArray(result[i]->pointTypes.size(), ienv->FindClass("[I"), NULL); + jobjectArray pointTypes = ienv->NewObjectArray(result[i]->pointTypes.size(), jclIntArray, NULL); for(jint k = 0; k < result[i]->pointTypes.size(); k++ ) { std::vector ts = result[i]->pointTypes[k]; if (ts.size() > 0) {