ReleaseStringUTFChars side effects???
843829Jun 12 2003 — edited Jun 20 2003I have this code as part of a C function that does some JNI calls:
const char *returnvalue;
result = (jstring)((*env1)->CallObjectMethod(env1,myjobject,getDescriptionID,JchFlag,JchDEID,JchKey,keysize));
returnvalue =(*env1)->GetStringUTFChars(env1,result,&isCopy);
if(isCopy == JNI_TRUE) (*env1)->ReleaseStringUTFChars(env1,result,returnvalue);
(*env1)->DeleteLocalRef(env1,result);
Now, when I call GetStringsUTFChars, returnvalue is given the proper string. However, when I call the ReleaseUTFChars, for some crazy reason, there is always a 'D' placed as the very first character of my returnvalue string after the call. Anyways, i have no clue why this is going on. Any suggestions?
Example:
before ReleaseStringUTFChars, returnvalue = "Hello"
after ReleaseStringUTFChars, returnvalue = "Dello"