Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge remote-tracking branch 'upstream/master' into issue95
[simgrid.git] / src / bindings / java / jmsg_as.cpp
index d9fddbd..b040fd9 100644 (file)
@@ -1,6 +1,6 @@
 /* Java bindings of the NetZones.                                           */
 
-/* Copyright (c) 2007-2020. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2021. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -102,17 +102,15 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_As_getProperty(JNIEnv *env, jobje
     jxbt_throw_notbound(env, "as", jas);
     return nullptr;
   }
-  const char *name = env->GetStringUTFChars(static_cast<jstring>(jname), 0);
+  jstring_wrapper name(env, static_cast<jstring>(jname));
 
-  const char* property = MSG_zone_get_property_value(as, name);
+  const char* property = sg_zone_get_property_value(as, name);
   if (not property) {
     return nullptr;
   }
 
   jobject jproperty = env->NewStringUTF(property);
 
-  env->ReleaseStringUTFChars(static_cast<jstring>(jname), name);
-
   return jproperty;
 }