X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5daf61af49b4b767433387330f7f7d21c63e4e59..0ba0b5da8a4948ab678226c4456f97b9b85a71c6:/src/bindings/java/jmsg_storage.cpp diff --git a/src/bindings/java/jmsg_storage.cpp b/src/bindings/java/jmsg_storage.cpp index e38230cd64..7b5003f6c1 100644 --- a/src/bindings/java/jmsg_storage.cpp +++ b/src/bindings/java/jmsg_storage.cpp @@ -56,7 +56,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getByName(JNIEnv * env, j /* get the C string from the java string */ if (jname == nullptr) { - jxbt_throw_null(env,bprintf("No host can have a null name")); + jxbt_throw_null(env, "No host can have a null name"); return nullptr; } const char *name = env->GetStringUTFChars(jname, 0); @@ -69,7 +69,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getByName(JNIEnv * env, j } env->ReleaseStringUTFChars(jname, name); - if (java_storage_map.find(storage->key) == java_storage_map.end()) { + if (java_storage_map.find(storage) == java_storage_map.end()) { /* Instantiate a new java storage */ jstorage = jstorage_new_instance(env); @@ -93,9 +93,9 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getByName(JNIEnv * env, j /* the native storage data field is set with the global reference to the * java storage returned by this function */ - java_storage_map.insert({storage->key, jstorage}); + java_storage_map.insert({storage, jstorage}); } else - jstorage = java_storage_map.at(storage->key); + jstorage = java_storage_map.at(storage); /* return the global reference to the java storage instance */ return (jobject)jstorage; @@ -215,8 +215,8 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Storage_all(JNIEnv * env, jc for (index = 0; index < count; index++) { storage = xbt_dynar_get_as(table,index,msg_storage_t); - if (java_storage_map.find(storage->key) != java_storage_map.end()) { - jstorage = java_storage_map.at(storage->key); + if (java_storage_map.find(storage) != java_storage_map.end()) { + jstorage = java_storage_map.at(storage); } else { jname = env->NewStringUTF(MSG_storage_get_name(storage)); jstorage = Java_org_simgrid_msg_Storage_getByName(env, cls_arg, jname);