Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ReleaseStringUTFChars side effects???

843829Jun 12 2003 — edited Jun 20 2003
I 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"

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 18 2003
Added on Jun 12 2003
1 comment
201 views