About CallByteMethodA Function
Hi you all:
I have some problem about CallByteMethodA function.
This is what my java code looks like:
public void setDS_INFO_mac(byte[] mac) {
for( int i = 0; i < mac.length; ++i ) {
this.ds_info.mac = mac;
}
}
This is what my c code looks like:
jobject objref;
jclass cls = NULL;
jfieldID fid = NULL;
jmethodID mid = NULL;
jbyte dsMac[6];
jbyteArray returnArray = 0;
...
/* code not pertaining to this question snipped. */
mid = env->GetMethodID(cls, "setDS_INFO_mac", "([B)V" );
for( int j = 0; j < 6; ++j ) {
dsMac[j] = search_Info.ds_info.mac[j];
}
returnArray = env->NewByteArray(6);
if( returnArray != NULL ) {
env->SetByteArrayRegion(returnArray, 0, 6, (jbyte*)dsMac);
env->CallByteMethodA(objref, mid, (jvalue*)returnArray);
env->DeleteLocalRef(returnArray);
}
This is not working.
and, some about run time exception as follows:
Exception in thread "main" java.lang.NullPointerException
at CFGINFO.setDS_INFO_mac(DSCIStructure.java:97)
at DSCIJNInterface.dsc_EnumSearch(Native Method)
at MainApp.searching(MainApp.java:105)
at MainApp.main(MainApp.java:46)
Any idea what I'm doing wrong?

