From: Samuel Lepetit Date: Mon, 21 May 2012 08:39:23 +0000 (+0200) Subject: Bugfix in Process.waitFor and Process.sleep: Throw the expected X-Git-Tag: v3_9_90~569^2~19^2~68 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/25fa04f8ceaf4b43a87d0df425073ec22f7b1d9e Bugfix in Process.waitFor and Process.sleep: Throw the expected exception if failure. --- diff --git a/org/simgrid/msg/Process.java b/org/simgrid/msg/Process.java index 5e1b4e6bac..abdd52ca4b 100644 --- a/org/simgrid/msg/Process.java +++ b/org/simgrid/msg/Process.java @@ -310,7 +310,7 @@ public abstract class Process implements Runnable { * FIXME: Not optimal, maybe we should have two native functions. * @param millis the length of time to sleep in milliseconds. */ - public static void sleep(long millis) { + public static void sleep(long millis) throws HostFailureException { sleep(millis,0); } /** @@ -321,12 +321,12 @@ public abstract class Process implements Runnable { * @param millis the length of time to sleep in milliseconds. * @param nanos additionnal nanoseconds to sleep. */ - public native static void sleep(long millis, int nanos); + public native static void sleep(long millis, int nanos) throws HostFailureException; /** * Makes the current process sleep until time seconds have elapsed. * @param seconds The time the current process must sleep. */ - public native void waitFor(double seconds); + public native void waitFor(double seconds) throws HostFailureException; /** * */ diff --git a/src/jmsg_process.c b/src/jmsg_process.c index 213b345fbc..85c476f279 100644 --- a/src/jmsg_process.c +++ b/src/jmsg_process.c @@ -267,8 +267,9 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_sleep CATCH_ANONYMOUS { return; } - jxbt_check_res("MSG_process_sleep()", rv, MSG_OK, - bprintf("unexpected error , please report this bug")); + if (rv != MSG_OK) { + jmsg_throw_status(env,rv); + } } JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_waitFor(JNIEnv * env, jobject jprocess, @@ -288,7 +289,8 @@ Java_org_simgrid_msg_Process_waitFor(JNIEnv * env, jobject jprocess, return; } if (rv != MSG_OK) { -// smx_ctx_java_stop(smx_ctx_java_self()); + XBT_INFO("Status NOK"); + jmsg_throw_status(env,rv); } }