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!

array length differs on java side and the native side

843829Feb 3 2004 — edited Feb 4 2004
Hi,
I am passing a hashed byte array to a native code in "C". When i check the length of the byte array in the java side using bArray.length,i get a value of 16.
In the native code i get a value of 17!!! How can this be possible.
My native code is as follows.
BYTE *pbBuffer;
JNIEXPORT void JNICALL Java_Testapp_certificateKey
(JNIEnv * jEnv, jobject obj, jstring jcert,jbyteArray testByteArray){

jsize byteArraySize=(*jEnv)->GetArrayLength(jEnv,testByteArray);
jbyte * pMin=(jbyte *)(*jEnv)->GetByteArrayElements(jEnv,testByteArray,0);
pbBuffer= (BYTE*)malloc(byteArraySize);
pbBuffer=(BYTE *)pMin;
dwBufferLen=strlen((BYTE *)pbBuffer);
wsprintf(msg,"Signature length %d found.\n",dwBufferLen);
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 3 2004
Added on Feb 3 2004
4 comments
369 views