}
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Host_getByName(JNIEnv * env, jclass cls, jstring jname) {
- msg_host_t host; /* native host */
- jobject jhost; /* global reference to the java host instance returned */
/* get the C string from the java string */
if (jname == nullptr) {
}
const char *name = env->GetStringUTFChars(jname, 0);
/* get the host by name (the hosts are created during the grid resolution) */
- host = MSG_host_by_name(name);
+ msg_host_t host = MSG_host_by_name(name);
if (!host) { /* invalid name */
jxbt_throw_host_not_found(env, name);
if (!host->extension(JAVA_HOST_LEVEL)) { /* native host not associated yet with java host */
/* Instantiate a new java host */
- jhost = jhost_new_instance(env);
+ jobject jhost = jhost_new_instance(env);
if (!jhost) {
jxbt_throw_jni(env, "java host instantiation failed");
const char *value_java = env->GetStringUTFChars((jstring) jvalue, 0);
char *value = xbt_strdup(value_java);
- MSG_host_set_property_value(host, name, value, xbt_free_f);
+ MSG_host_set_property_value(host, name, value);
env->ReleaseStringUTFChars((jstring) jvalue, value_java);
env->ReleaseStringUTFChars((jstring) jname, name);