Changeset 217 for branches/branch-1.2/zoo-kernel/service_internal_java.c
- Timestamp:
- May 31, 2011, 3:30:49 AM (13 years ago)
- Location:
- branches/branch-1.2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/branch-1.2
-
branches/branch-1.2/zoo-kernel/service_internal_java.c
r68 r217 2 2 * Author : Gérald FENOY 3 3 * 4 * Copyright (c) 2009-201 0GeoLabs SARL4 * Copyright (c) 2009-2011 GeoLabs SARL 5 5 * 6 6 * Permission is hereby granted, free of charge, to any person obtaining a copy … … 118 118 119 119 pValue=(*env)->CallStaticIntMethod(env,cls,pmid,arg1,arg2,arg3); 120 if (pValue != NULL){120 if (pValue != (jint)NULL){ 121 121 res=pValue; 122 122 m=mapsFromHashMap(env,arg1,scHashMapClass); … … 233 233 jobject scObject,scObject1; 234 234 if(scHashMapClass==NULL){ 235 #ifdef DEBUG 235 236 fprintf(stderr,"Unable to load java.util.HashMap\n"); 237 #endif 236 238 return NULL; 237 239 } … … 239 241 containsKey_mid = (*env)->GetMethodID(env, scHashMapClass, "containsKey", "(Ljava/lang/Object;)Z"); 240 242 get_mid = (*env)->GetMethodID(env, scHashMapClass, "get", "(Ljava/lang/Object;)Ljava/lang/Object;"); 243 241 244 if(containsKey_mid==0){ 245 #ifdef DEBUG 242 246 fprintf(stderr,"unable to load containsKey from HashMap object (%d) \n",entrySet_mid); 247 #endif 248 return NULL; 243 249 } 244 250 if(get_mid==0){ 251 #ifdef DEBUG 245 252 fprintf(stderr,"unable to load get from HashMap object (%d) \n",entrySet_mid); 253 #endif 254 return NULL; 246 255 } 247 256 if(entrySet_mid==0){ 257 #ifdef DEBUG 248 258 fprintf(stderr,"unable to load entrySet from HashMap object (%d) \n",entrySet_mid); 259 #endif 249 260 return NULL; 250 261 } … … 296 307 if((*env)->CallBooleanMethod(env,imap,containsKey_mid,(*env)->NewStringUTF(env,"size"))){ 297 308 jobject sizeV=(*env)->CallObjectMethod(env, imap, get_mid,(*env)->NewStringUTF(env,"size")); 298 jstringsizeVS=(*env)->GetStringUTFChars(env, sizeV, NULL);309 const char* sizeVS=(*env)->GetStringUTFChars(env, sizeV, NULL); 299 310 size=atoi(sizeVS); 300 311 fprintf(stderr,"SIZE : %s\n",sizeVS); 312 (*env)->ReleaseStringUTFChars(env, sizeV, sizeVS); 301 313 } 302 314 … … 306 318 jobject jv=(*env)->CallObjectMethod(env,tmp1,getValue_mid); 307 319 308 jstringjkd=(*env)->GetStringUTFChars(env, jk, NULL);320 const char* jkd=(*env)->GetStringUTFChars(env, jk, NULL); 309 321 if(size>=0 && strcmp(jkd,"value")==0){ 310 fprintf(stderr,"%s\n",jkd);311 322 jobject value=(*env)->GetByteArrayElements(env, jv, NULL); 312 323 if(res==NULL){ … … 315 326 addToMap(res,jkd,""); 316 327 } 317 fprintf(stderr,"/%s\n",jkd);318 328 map* tmpR=getMap(res,"value"); 319 329 free(tmpR->value); … … 321 331 memmove(tmpR->value,value,size*sizeof(char)); 322 332 tmpR->value[size]=0; 323 fprintf(stderr,"/%s\n",jkd); 333 char tmp[128]; 334 sprintf(tmp,"%d",size); 335 addToMap(res,"size",tmp); 324 336 } 325 337 else{ 326 jstringjvd=(*env)->GetStringUTFChars(env, jv, NULL);338 const char* jvd=(*env)->GetStringUTFChars(env, jv, NULL); 327 339 if(res==NULL){ 328 340 res=createMap(jkd,jvd); … … 330 342 addToMap(res,jkd,jvd); 331 343 } 332 (*env)->ReleaseString Chars(env, jv, jvd);344 (*env)->ReleaseStringUTFChars(env, jv, jvd); 333 345 } 334 346 335 #ifdef DEBUG 336 fprintf(stderr,"%s %s\n",jkd,jvd); 337 #endif 338 339 (*env)->ReleaseStringChars(env, jk, jkd); 347 (*env)->ReleaseStringUTFChars(env, jk, jkd); 340 348 341 349 }
Note: See TracChangeset
for help on using the changeset viewer.