Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
API improvement in s4u
[simgrid.git] / src / bindings / java / jmsg_as.cpp
index cb796c4..09d996d 100644 (file)
@@ -126,11 +126,13 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getHosts(JNIEnv * env, jo
   simgrid::s4u::NetZone* as = jnetzone_get_native(env, jas);
 
   jclass cls = jxbt_get_class(env, "org/simgrid/msg/Host");
-  std::vector<sg_host_t>* table = as->hosts();
   if (!cls)
     return nullptr;
 
-  jtable = env->NewObjectArray(static_cast<jsize>(table->size()), cls, nullptr);
+  std::vector<sg_host_t> table;
+  as->hosts(&table);
+
+  jtable = env->NewObjectArray(static_cast<jsize>(table.size()), cls, nullptr);
 
   if (!jtable) {
     jxbt_throw_jni(env, "Hosts table allocation failed");
@@ -138,7 +140,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getHosts(JNIEnv * env, jo
   }
 
   int index = 0;
-  for (auto host : *table) {
+  for (auto host : table) {
     jhost = static_cast<jobject>(host->extension(JAVA_HOST_LEVEL));
     if (!jhost) {
       jname = env->NewStringUTF(host->cname());