Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
java: kill obscure NativeException
authorMartin Quinson <martin.quinson@loria.fr>
Fri, 27 Jan 2017 17:44:29 +0000 (18:44 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Fri, 27 Jan 2017 18:30:56 +0000 (19:30 +0100)
44 files changed:
ChangeLog
examples/java/app/centralizedmutex/Main.java
examples/java/app/masterworker/Main.java
examples/java/app/pingpong/Main.java
examples/java/app/pingpong/PingPongTask.java
examples/java/app/pingpong/Receiver.java
examples/java/app/pingpong/Sender.java
examples/java/app/tokenring/Main.java
examples/java/app/tokenring/RelayRunner.java
examples/java/async/dsend/Main.java
examples/java/async/yield/Main.java
examples/java/async/yield/Yielder.java
examples/java/cloud/migration/Test.java
examples/java/cloud/migration/TestHostOnOff.java
examples/java/energy/consumption/EnergyConsumer.java
examples/java/energy/consumption/Main.java
examples/java/energy/pstate/Main.java
examples/java/energy/pstate/PstateRunner.java
examples/java/energy/vm/EnergyVMRunner.java
examples/java/energy/vm/Main.java
examples/java/process/kill/Main.java
examples/java/process/migration/Main.java
examples/java/process/startkilltime/Main.java
examples/java/task/priority/Main.java
examples/java/trace/pingpong/Main.java
examples/java/trace/pingpong/PingPongTask.java
examples/java/trace/pingpong/Receiver.java
examples/java/trace/pingpong/Sender.java
src/bindings/java/jmsg.cpp
src/bindings/java/jmsg_as.cpp
src/bindings/java/jmsg_comm.cpp
src/bindings/java/jmsg_host.cpp
src/bindings/java/jmsg_process.cpp
src/bindings/java/jmsg_storage.cpp
src/bindings/java/jmsg_synchro.cpp
src/bindings/java/jmsg_task.cpp
src/bindings/java/jmsg_vm.cpp
src/bindings/java/jxbt_utilities.cpp
src/bindings/java/jxbt_utilities.h
src/bindings/java/org/simgrid/msg/NativeException.java [deleted file]
src/bindings/java/org/simgrid/msg/Process.java
src/bindings/java/org/simgrid/msg/Storage.java
src/bindings/java/org/simgrid/msg/Task.java
tools/cmake/DefinePackages.cmake

index 59e328e..62bfffb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,9 @@ SimGrid (3.15) UNRELEASED; urgency=low
 
  Java
  - Ensure that an actor can kill itself with Process::exit()
+ - Kill the obscure NativeException. Nobody want to survive the issues
+   it denotes, so use JniException that is a RuntimeException (not to
+   be catched explicitely).
 
  -- target_date=March 20 2017 -- Da SimGrid team <simgrid-devel@lists.gforge.inria.fr>
 
index 32a584d..24da241 100644 (file)
@@ -7,14 +7,13 @@
 package app.centralizedmutex;
 
 import org.simgrid.msg.Msg;
-import org.simgrid.msg.NativeException;
 
 class Main {
   private Main() {
     throw new IllegalAccessError("Utility class");
   }
 
-  public static void main(String[] args) throws NativeException {
+  public static void main(String[] args) {
     Msg.init(args);
 
     String platf  = args.length > 1 ? args[0] : "../platforms/small_platform.xml";
index c1e905c..d252ee4 100644 (file)
@@ -9,7 +9,6 @@ package app.masterworker;
 import java.io.File;
 
 import org.simgrid.msg.Msg;
-import org.simgrid.msg.NativeException;
 
 class Main {
   public static final int TASK_COMP_SIZE = 10000000;
@@ -18,7 +17,7 @@ class Main {
     throw new IllegalAccessError("Utility class");
   }
 
-  public static void main(String[] args) throws NativeException {
+  public static void main(String[] args) {
     /* initialize the MSG simulation. Must be done before anything else (even logging). */
     Msg.init(args);
 
index d69dcec..ed8f2a7 100644 (file)
@@ -5,16 +5,15 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 package app.pingpong;
-import org.simgrid.msg.Msg;
 import org.simgrid.msg.HostNotFoundException;
-import org.simgrid.msg.NativeException;
+import org.simgrid.msg.Msg;
  
 class Main {
   private Main() {
     throw new IllegalAccessError("Utility class");
   }
 
-  public static void main(String[] args) throws HostNotFoundException, NativeException{
+  public static void main(String[] args) throws HostNotFoundException {
     Msg.init(args);
     if(args.length < 1) {
       Msg.info("Usage   : Main platform_file");
index f4a556f..c415127 100644 (file)
@@ -6,16 +6,15 @@
 
 package app.pingpong;
 import org.simgrid.msg.Task;
-import org.simgrid.msg.NativeException;
 
 public class PingPongTask extends Task {
   private double timeVal;
 
-  public PingPongTask() throws NativeException {
+  public PingPongTask() {
     this.timeVal = 0;
   }
 
-  public PingPongTask(String name, double computeDuration, double messageSize) throws NativeException {
+  public PingPongTask(String name, double computeDuration, double messageSize) {
     super(name,computeDuration,messageSize);
   }
 
index 2617455..85c5acb 100644 (file)
@@ -5,17 +5,16 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 package app.pingpong;
+import org.simgrid.msg.HostNotFoundException;
 import org.simgrid.msg.Msg;
-import org.simgrid.msg.Task;
-import org.simgrid.msg.Process;
 import org.simgrid.msg.MsgException;
-import org.simgrid.msg.NativeException;
-import org.simgrid.msg.HostNotFoundException;
+import org.simgrid.msg.Process;
+import org.simgrid.msg.Task;
 
 public class Receiver extends Process {
   private static final double COMM_SIZE_BW = 100000000;
-  public Receiver(String hostname, String name, String[]args) throws HostNotFoundException, NativeException{
-    super(hostname,name,args);
+  public Receiver(String hostname, String name, String[]args) throws HostNotFoundException {
+    super(hostname, name, args);
   }
 
   public void main(String[] args) throws MsgException {
index 5f00d6f..d352069 100644 (file)
@@ -5,17 +5,16 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 package app.pingpong;
-import org.simgrid.msg.Msg;
 import org.simgrid.msg.Host;
-import org.simgrid.msg.Process;
-import org.simgrid.msg.MsgException;
-import org.simgrid.msg.NativeException;
 import org.simgrid.msg.HostNotFoundException;
+import org.simgrid.msg.Msg;
+import org.simgrid.msg.MsgException;
+import org.simgrid.msg.Process;
 
 public class Sender extends Process {
   private static final double COMM_SIZE_LAT = 1;
 
-  public Sender(String hostname, String name, String[] args) throws HostNotFoundException, NativeException {
+  public Sender(String hostname, String name, String[] args) throws HostNotFoundException {
     super(hostname,name,args);
   }
 
index 2448865..754dad0 100644 (file)
@@ -7,7 +7,6 @@ package app.tokenring;
 import org.simgrid.msg.Host;
 import org.simgrid.msg.HostNotFoundException;
 import org.simgrid.msg.Msg;
-import org.simgrid.msg.NativeException;
 import org.simgrid.msg.Process;
 
 class Main {
@@ -16,7 +15,7 @@ class Main {
                throw new IllegalAccessError("Utility class");
        }
 
-       public static void main(String[] args) throws HostNotFoundException, NativeException {
+       public static void main(String[] args) throws HostNotFoundException {
                Msg.init(args);
                
                String platform = "../platforms/small_platform.xml";
index 9704c7c..f3b43ba 100644 (file)
@@ -4,18 +4,17 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 package app.tokenring;
+import org.simgrid.msg.Host;
 import org.simgrid.msg.Msg;
-import org.simgrid.msg.Task;
-import org.simgrid.msg.Process;
 import org.simgrid.msg.MsgException;
-import org.simgrid.msg.NativeException;
-import org.simgrid.msg.Host;
+import org.simgrid.msg.Process;
+import org.simgrid.msg.Task;
 
 public class RelayRunner extends Process {
 
        private static final int TASK_COMM_SIZE = 1000000; /* The token is 1MB long*/
 
-       public RelayRunner(Host host, String name, String[]args) throws NativeException {
+       public RelayRunner(Host host, String name, String[]args) {
                super(host,name,args);
        }
 
index f244276..0822c42 100644 (file)
@@ -12,10 +12,9 @@ package async.dsend;
  *  and has nothing to do at the end as with Task.isend() where it must do a Comm.wait().
  */
 
-import org.simgrid.msg.Msg;
 import org.simgrid.msg.Host;
-import org.simgrid.msg.NativeException;
 import org.simgrid.msg.HostNotFoundException;
+import org.simgrid.msg.Msg;
 
 class Main {
   private Main() {
@@ -23,7 +22,7 @@ class Main {
     throw new IllegalAccessError("Utility class");
   }
 
-  public static void main(String[] args) throws NativeException, HostNotFoundException {
+  public static void main(String[] args) throws HostNotFoundException {
     Msg.init(args);
 
     String platform = "../platforms/small_platform.xml";
index d4c9bea..6e044a5 100644 (file)
@@ -11,10 +11,9 @@ package async.yield;
  *  and has nothing to do at the end as with Task.isend() where it must do a Comm.wait().
  */
 
-import org.simgrid.msg.Msg;
 import org.simgrid.msg.Host;
-import org.simgrid.msg.NativeException;
 import org.simgrid.msg.HostNotFoundException;
+import org.simgrid.msg.Msg;
 
 class Main {
   private Main() {
@@ -22,7 +21,7 @@ class Main {
     throw new IllegalAccessError("Utility class");
   }
 
-  public static void main(String[] args) throws NativeException, HostNotFoundException {
+  public static void main(String[] args) throws HostNotFoundException {
     Msg.init(args);
 
     String platform = "../platforms/small_platform.xml";
index 1118f80..eebd5dc 100644 (file)
@@ -4,13 +4,9 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 package async.yield;
-import org.simgrid.msg.Msg;
 import org.simgrid.msg.Host;
-import org.simgrid.msg.Task;
+import org.simgrid.msg.Msg;
 import org.simgrid.msg.Process;
-import org.simgrid.msg.HostFailureException;
-import org.simgrid.msg.TimeoutException;
-import org.simgrid.msg.TransferFailureException;
 
 public class Yielder extends Process {
   public Yielder (Host host, String name, String[] args) {
index c64a4dc..36f98b3 100644 (file)
@@ -8,12 +8,17 @@ package cloud.migration;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.simgrid.msg.*;
+import org.simgrid.msg.Host;
+import org.simgrid.msg.HostFailureException;
+import org.simgrid.msg.HostNotFoundException;
+import org.simgrid.msg.Msg;
+import org.simgrid.msg.MsgException;
 import org.simgrid.msg.Process;
+import org.simgrid.msg.VM;
 
 public class Test extends Process{
 
-  Test(String hostname, String name) throws HostNotFoundException, NativeException  {
+  Test(String hostname, String name) throws HostNotFoundException {
     super(hostname, name);
   }
 
index 07b5f22..71ff307 100644 (file)
@@ -6,8 +6,13 @@
 
 package cloud.migration;
 
-import org.simgrid.msg.*;
+import org.simgrid.msg.Host;
+import org.simgrid.msg.HostFailureException;
+import org.simgrid.msg.HostNotFoundException;
+import org.simgrid.msg.Msg;
+import org.simgrid.msg.MsgException;
 import org.simgrid.msg.Process;
+import org.simgrid.msg.VM;
 
 // This test aims at validating that the migration process is robust in face of host turning off either on the SRC 
 // node or on the DST node. 
@@ -17,7 +22,7 @@ public class TestHostOnOff extends Process{
   protected Host host1 = null;
   protected Host host2 = null;
 
-  TestHostOnOff(String hostname, String name) throws  HostNotFoundException, NativeException {
+  TestHostOnOff(String hostname, String name) throws  HostNotFoundException {
     super(hostname, name);
   }
 
index 4a88994..de92e9e 100644 (file)
@@ -13,7 +13,7 @@ import org.simgrid.msg.MsgException;
 import org.simgrid.msg.HostNotFoundException;
 
 public class EnergyConsumer extends Process {
-  public EnergyConsumer(String hostname, String name) throws HostNotFoundException{
+  public EnergyConsumer(String hostname, String name) throws HostNotFoundException {
     super(hostname,name);
   }
 
index 49964c3..3ac36da 100644 (file)
@@ -28,7 +28,7 @@ public class Main {
     }
     /* Construct the platform */
     Msg.createEnvironment(args[0]);
-    /* Instanciate a process */
+    /* Instantiate a process */
     new EnergyConsumer("MyHost1","energyConsumer").start();
     /* Execute the simulation */
     Msg.run();
index aa364a6..f6c3afa 100644 (file)
@@ -5,17 +5,16 @@
 
 package energy.pstate;
 
-import org.simgrid.msg.Msg;
 import org.simgrid.msg.Host;
 import org.simgrid.msg.HostNotFoundException;
-import org.simgrid.msg.NativeException;
+import org.simgrid.msg.Msg;
 
 class Main {
   private Main() {
     throw new IllegalAccessError("Utility class");
   }
 
-  public static void main(String[] args) throws NativeException, HostNotFoundException {
+  public static void main(String[] args) throws HostNotFoundException {
     Msg.energyInit();
     Msg.init(args);
 
index 8001cbf..754e8b0 100644 (file)
@@ -9,7 +9,6 @@ import org.simgrid.msg.Host;
 import org.simgrid.msg.HostFailureException;
 import org.simgrid.msg.HostNotFoundException;
 import org.simgrid.msg.Msg;
-import org.simgrid.msg.NativeException;
 import org.simgrid.msg.Process;
 import org.simgrid.msg.Task;
 import org.simgrid.msg.TaskCancelledException;
@@ -71,7 +70,7 @@ public class PstateRunner extends Process {
                }
        }
 
-       PstateRunner(Host host, String name, String[] args) throws NativeException  {
+       PstateRunner(Host host, String name, String[] args) {
                super(host, name, args);
        }
 
index 6b37812..7fa2702 100644 (file)
@@ -5,15 +5,14 @@
 
 package energy.vm;
 
-import org.simgrid.msg.Msg;
-import org.simgrid.msg.VM;
 import org.simgrid.msg.Host;
-import org.simgrid.msg.Task;
-import org.simgrid.msg.Process;
 import org.simgrid.msg.HostFailureException;
 import org.simgrid.msg.HostNotFoundException;
+import org.simgrid.msg.Msg;
+import org.simgrid.msg.Process;
+import org.simgrid.msg.Task;
 import org.simgrid.msg.TaskCancelledException;
-import org.simgrid.msg.NativeException;
+import org.simgrid.msg.VM;
 
 /* This class is a process in charge of running the test. It creates and starts the VMs, and fork processes within VMs */
 public class EnergyVMRunner extends Process {
@@ -36,7 +35,7 @@ public class EnergyVMRunner extends Process {
     }
   }
 
-  EnergyVMRunner(Host host, String name, String[] args) throws HostNotFoundException, NativeException  {
+  EnergyVMRunner(Host host, String name, String[] args) throws HostNotFoundException {
     super(host, name, args);
   }
 
index 385fe40..f301018 100644 (file)
@@ -5,17 +5,16 @@
 
 package energy.vm;
 
-import org.simgrid.msg.Msg;
 import org.simgrid.msg.Host;
 import org.simgrid.msg.HostNotFoundException;
-import org.simgrid.msg.NativeException;
+import org.simgrid.msg.Msg;
 
 class Main {
   private Main() {
     throw new IllegalAccessError("Utility class");
   }
 
-  public static void main(String[] args) throws NativeException, HostNotFoundException {
+  public static void main(String[] args) throws HostNotFoundException {
     Msg.energyInit();
     Msg.init(args);
 
index f62b469..71d281b 100644 (file)
@@ -8,14 +8,13 @@ package process.kill;
 
 import org.simgrid.msg.Msg;
 import org.simgrid.msg.MsgException;
-import org.simgrid.msg.NativeException;
 
 public class Main {
   private Main() {
     throw new IllegalAccessError("Utility class");
   }
 
-  public static void main(String[] args) throws NativeException {
+  public static void main(String[] args) {
     /* initialize the MSG simulation. Must be done before anything else (even logging). */
     Msg.init(args);
     Msg.createEnvironment(args[0]);
index 9498dbc..67a7e66 100644 (file)
@@ -5,11 +5,10 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 package process.migration;
+import org.simgrid.msg.HostNotFoundException;
 import org.simgrid.msg.Msg;
 import org.simgrid.msg.Mutex;
 import org.simgrid.msg.Process;
-import org.simgrid.msg.NativeException;
-import org.simgrid.msg.HostNotFoundException;
 
 class Main {
   protected static Mutex mutex;
@@ -19,7 +18,7 @@ class Main {
     throw new IllegalAccessError("Utility class");
   }
 
-  public static void main(String[] args) throws NativeException {
+  public static void main(String[] args) {
     Msg.init(args);
     if(args.length < 1) {
       Msg.info("Usage   : Migration platform_file");
index 2168b16..03da6a6 100644 (file)
@@ -6,14 +6,13 @@
 
 package process.startkilltime;
 import org.simgrid.msg.Msg;
-import org.simgrid.msg.NativeException;
 
 public class Main {
   private Main() {
     throw new IllegalAccessError("Utility class");
   }
 
-  public static void main(String[] args) throws NativeException {
+  public static void main(String[] args) {
     Msg.init(args);
     if(args.length < 2) {
       Msg.info("Usage   : StartKilltime platform_file deployment_file");
index 29133c1..fd301f3 100644 (file)
@@ -6,7 +6,6 @@
 
 package task.priority;
 import org.simgrid.msg.Msg;
-import org.simgrid.msg.NativeException;
 
 /* Demonstrates the use of Task.setPriority to change the computation priority of a task */ 
 public class Main {
@@ -14,7 +13,7 @@ public class Main {
     throw new IllegalAccessError("Utility class");
   }
 
-  public static void main(String[] args) throws NativeException {
+  public static void main(String[] args) {
     Msg.init(args);
     if(args.length < 2) {
       Msg.info("Usage   : Priority platform_file deployment_file");
index ed126d8..782f68f 100644 (file)
@@ -6,16 +6,15 @@
 
 package trace.pingpong;
 import org.simgrid.msg.Msg;
-import org.simgrid.trace.Trace;
 import org.simgrid.msg.MsgException;
-import org.simgrid.msg.NativeException;
+import org.simgrid.trace.Trace;
 
 public class Main  {
   private Main() {
     throw new IllegalAccessError("Utility class");
   }
 
-  public static void main(String[] args) throws MsgException, NativeException {
+  public static void main(String[] args) throws MsgException {
     Msg.init(args);
     if(args.length < 1) {
       Msg.info("Usage   : Main platform_file");
index e6ea4bb..3675e10 100644 (file)
@@ -5,17 +5,16 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 package trace.pingpong;
-import org.simgrid.msg.NativeException;
 import org.simgrid.msg.Task;
 
 public class PingPongTask extends Task {
   private double timeVal;
 
-  public PingPongTask() throws NativeException {
+  public PingPongTask() {
     this.timeVal = 0;
   }
 
-  public PingPongTask(String name, double computeDuration, double messageSize) throws NativeException {
+  public PingPongTask(String name, double computeDuration, double messageSize) {
     super(name,computeDuration,messageSize);
   }
 
index a74ebba..4a1f26e 100644 (file)
@@ -5,19 +5,18 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 package trace.pingpong;
+import org.simgrid.msg.HostNotFoundException;
 import org.simgrid.msg.Msg;
 import org.simgrid.msg.MsgException;
-import org.simgrid.msg.NativeException;
-import org.simgrid.msg.HostNotFoundException;
-import org.simgrid.msg.Task;
 import org.simgrid.msg.Process;
+import org.simgrid.msg.Task;
 import org.simgrid.trace.Trace;
 
 public class Receiver extends Process {
   private static final double COMM_SIZE_LAT = 1;
   private static final double COMM_SIZE_BW = 100000000;
 
-  public Receiver(String hostname, String name, String[]args) throws HostNotFoundException, NativeException {
+  public Receiver(String hostname, String name, String[]args) throws HostNotFoundException {
     super(hostname,name,args);
   }
 
index 256a4b8..d3f107d 100644 (file)
@@ -5,13 +5,12 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 package trace.pingpong;
-import org.simgrid.msg.Msg;
 import org.simgrid.msg.Host;
-import org.simgrid.msg.Task;
-import org.simgrid.msg.Process;
-import org.simgrid.msg.MsgException;
-import org.simgrid.msg.NativeException;
 import org.simgrid.msg.HostNotFoundException;
+import org.simgrid.msg.Msg;
+import org.simgrid.msg.MsgException;
+import org.simgrid.msg.Process;
+import org.simgrid.msg.Task;
 import org.simgrid.trace.Trace;
 
 public class Sender extends Process {
@@ -19,7 +18,7 @@ public class Sender extends Process {
   private static final double commSizeBw = 100000000;
   private static final String PM_STATE = "PM_STATE";
 
-  public Sender(String hostname, String name, String[] args) throws HostNotFoundException, NativeException {
+  public Sender(String hostname, String name, String[] args) throws HostNotFoundException {
     super(hostname,name,args);
   }
 
index f8fff39..7e536de 100644 (file)
@@ -74,8 +74,7 @@ void jmsg_throw_status(JNIEnv *env, msg_error_t status) {
         jxbt_throw_task_cancelled(env,nullptr);
     break;
     default:
-        jxbt_throw_native(env,xbt_strdup("undefined message failed "
-          "(please see jmsg_throw_status function in jmsg.cpp)"));
+      xbt_die("undefined message failed (please see jmsg_throw_status function in jmsg.cpp)");
   }
 }
 
index 7e129de..0a3f1c3 100644 (file)
@@ -47,13 +47,13 @@ simgrid::s4u::NetZone* jas_get_native(JNIEnv* env, jobject jas)
   return (simgrid::s4u::NetZone*)(uintptr_t)env->GetLongField(jas, jas_field_As_bind);
 }
 
-JNIEXPORT void JNICALL Java_org_simgrid_msg_As_nativeInit(JNIEnv *env, jclass cls) {
+JNIEXPORT void JNICALL Java_org_simgrid_msg_As_nativeInit(JNIEnv* env, jclass cls)
+{
   jclass class_As = env->FindClass("org/simgrid/msg/As");
   jas_method_As_constructor = env->GetMethodID(class_As, "<init>", "()V");
   jas_field_As_bind = jxbt_get_jfield(env,class_As, "bind", "J");
-  if (!class_As || !jas_method_As_constructor || !jas_field_As_bind) {
-    jxbt_throw_native(env,bprintf("Can't find some fields in Java class. You should report this bug."));
-  }
+  xbt_assert(class_As && jas_method_As_constructor && jas_field_As_bind,
+             "Native initialization of msg/AS failed. Please report that bug");
 }
 
 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_As_getName(JNIEnv * env, jobject jas) {
index 37de834..4802bd5 100644 (file)
@@ -45,19 +45,16 @@ void jcomm_bind_task(JNIEnv *env, jobject jcomm) {
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Comm_nativeInit(JNIEnv *env, jclass cls) {
   jclass jfield_class_Comm = env->FindClass("org/simgrid/msg/Comm");
-  if (!jfield_class_Comm) {
-    jxbt_throw_native(env,bprintf("Can't find the org/simgrid/msg/Comm class."));
-    return;
-  }
+  xbt_assert(jfield_class_Comm, "Native initialization of msg/Comm failed. Please report that bug");
+
   jcomm_field_Comm_bind = jxbt_get_jfield(env, jfield_class_Comm, "bind", "J");
   jcomm_field_Comm_taskBind  = jxbt_get_jfield(env, jfield_class_Comm, "taskBind", "J");
   jcomm_field_Comm_receiving = jxbt_get_jfield(env, jfield_class_Comm, "receiving", "Z");
   jtask_field_Comm_task = jxbt_get_jfield(env, jfield_class_Comm, "task", "Lorg/simgrid/msg/Task;");
   jcomm_field_Comm_finished = jxbt_get_jfield(env, jfield_class_Comm, "finished", "Z");
-  if (!jcomm_field_Comm_bind || !jcomm_field_Comm_taskBind || !jcomm_field_Comm_receiving || !jtask_field_Comm_task ||
-      !jcomm_field_Comm_finished) {
-    jxbt_throw_native(env,bprintf("Can't find some fields in Java class."));
-  }
+  xbt_assert(jcomm_field_Comm_bind && jcomm_field_Comm_taskBind && jcomm_field_Comm_receiving &&
+                 jtask_field_Comm_task && jcomm_field_Comm_finished,
+             "Native initialization of msg/Comm failed. Please report that bug");
 }
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Comm_nativeFinalize(JNIEnv *env, jobject jcomm) {
@@ -81,7 +78,7 @@ JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Comm_test(JNIEnv *env, jobject j
   }
 
   if (!comm) {
-    jxbt_throw_native(env,bprintf("comm is null"));
+    jxbt_throw_null(env, bprintf("comm is null"));
     return JNI_FALSE;
   }
 
@@ -101,7 +98,7 @@ JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Comm_test(JNIEnv *env, jobject j
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Comm_waitCompletion(JNIEnv *env, jobject jcomm, jdouble timeout) {
   msg_comm_t comm = (msg_comm_t) (uintptr_t) env->GetLongField(jcomm, jcomm_field_Comm_bind);
   if (!comm) {
-    jxbt_throw_native(env,bprintf("comm is null"));
+    jxbt_throw_null(env, bprintf("comm is null"));
     return;
   }
 
@@ -132,7 +129,7 @@ static msg_comm_t* jarray_to_commArray(JNIEnv *env, jobjectArray jcomms, /* OUT
 
      comms[i] = (msg_comm_t) (uintptr_t) env->GetLongField(jcomm, jcomm_field_Comm_bind);
      if (!comms[i]) {
-       jxbt_throw_native(env,bprintf("comm at rank %d is null",i));
+       jxbt_throw_null(env, bprintf("comm at rank %d is null", i));
        return nullptr;
      }
 
index 09f12e4..386ba55 100644 (file)
@@ -66,9 +66,8 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Host_nativeInit(JNIEnv *env, jclass
   jhost_method_Host_constructor = env->GetMethodID(class_Host, "<init>", "()V");
   jhost_field_Host_bind = jxbt_get_jfield(env,class_Host, "bind", "J");
   jhost_field_Host_name = jxbt_get_jfield(env, class_Host, "name", "Ljava/lang/String;");
-  if (!class_Host || !jhost_field_Host_name || !jhost_method_Host_constructor || !jhost_field_Host_bind) {
-    jxbt_throw_native(env,bprintf("Can't find some fields in Java class. You should report this bug."));
-  }
+  xbt_assert(class_Host && jhost_field_Host_name && jhost_method_Host_constructor && jhost_field_Host_bind,
+             "Native initialization of msg/Host failed. Please report that bug");
 }
 
 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Host_getByName(JNIEnv * env, jclass cls, jstring jname) {
index 7ddb3b6..bcd0d07 100644 (file)
@@ -83,6 +83,7 @@ jboolean jprocess_is_valid(jobject jprocess, JNIEnv * env)
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_nativeInit(JNIEnv *env, jclass cls) {
   jclass jprocess_class_Process = env->FindClass("org/simgrid/msg/Process");
+  xbt_assert(jprocess_class_Process, "Native initialization of msg/Process failed. Please report that bug");
 
   jprocess_field_Process_name = jxbt_get_jfield(env, jprocess_class_Process, "name", "Ljava/lang/String;");
   jprocess_field_Process_bind = jxbt_get_jfield(env, jprocess_class_Process, "bind", "J");
@@ -91,10 +92,9 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_nativeInit(JNIEnv *env, jcla
   jprocess_field_Process_ppid = jxbt_get_jfield(env, jprocess_class_Process, "ppid", "I");
   jprocess_field_Process_host = jxbt_get_jfield(env, jprocess_class_Process, "host", "Lorg/simgrid/msg/Host;");
   jprocess_field_Process_killTime = jxbt_get_jfield(env, jprocess_class_Process, "killTime", "D");
-  if (!jprocess_class_Process || !jprocess_field_Process_id || !jprocess_field_Process_name ||
-      !jprocess_field_Process_pid || !jprocess_field_Process_ppid || !jprocess_field_Process_host) {
-    jxbt_throw_native(env,bprintf("Can't find some fields in Java class. You should report this bug."));
-  }
+  xbt_assert(jprocess_field_Process_id && jprocess_field_Process_name && jprocess_field_Process_pid &&
+                 jprocess_field_Process_ppid && jprocess_field_Process_host,
+             "Native initialization of msg/Process failed. Please report that bug");
 }
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_create(JNIEnv * env, jobject jprocess_arg, jobject jhostname)
index abd552e..ee48e40 100644 (file)
@@ -31,12 +31,12 @@ msg_storage_t jstorage_get_native(JNIEnv * env, jobject jstorage) {
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Storage_nativeInit(JNIEnv *env, jclass cls) {
   jclass class_Storage = env->FindClass("org/simgrid/msg/Storage");
+  xbt_assert(class_Storage, "Native initialization of msg/Storage failed. Please report that bug");
   jstorage_method_Storage_constructor = env->GetMethodID(class_Storage, "<init>", "()V");
   jstorage_field_Storage_bind = jxbt_get_jfield(env,class_Storage, "bind", "J");
   jstorage_field_Storage_name = jxbt_get_jfield(env, class_Storage, "name", "Ljava/lang/String;");
-  if (!class_Storage || !jstorage_field_Storage_name || !jstorage_method_Storage_constructor || !jstorage_field_Storage_bind) {
-    jxbt_throw_native(env,bprintf("Can't find some fields in Java class. You should report this bug."));
-  }
+  xbt_assert(jstorage_field_Storage_name && jstorage_method_Storage_constructor && jstorage_field_Storage_bind,
+             "Native initialization of msg/Storage failed. Please report that bug");
 }
 
 void jstorage_bind(jobject jstorage, msg_storage_t storage, JNIEnv * env) {
index 118dc91..0b2da88 100644 (file)
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg);
 
-static jfieldID jsyncro_field_Mutex_bind;
+static jfieldID jsynchro_field_Mutex_bind;
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Mutex_nativeInit(JNIEnv *env, jclass cls) {
-  jsyncro_field_Mutex_bind = jxbt_get_sfield(env, "org/simgrid/msg/Mutex", "bind", "J");
-  if (!jsyncro_field_Mutex_bind) {
-    jxbt_throw_native(env,bprintf("Can't find some fields in Java class. You should report this bug."));
-  }
+  jsynchro_field_Mutex_bind = jxbt_get_sfield(env, "org/simgrid/msg/Mutex", "bind", "J");
+  xbt_assert(jsynchro_field_Mutex_bind, "Native initialization of msg/Mutex failed. Please report that bug");
 }
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Mutex_init(JNIEnv * env, jobject obj) {
   xbt_mutex_t mutex = xbt_mutex_init();
 
-  env->SetLongField(obj, jsyncro_field_Mutex_bind, (jlong) (uintptr_t) (mutex));
+  env->SetLongField(obj, jsynchro_field_Mutex_bind, (jlong)(uintptr_t)(mutex));
 }
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Mutex_acquire(JNIEnv * env, jobject obj) {
-  xbt_mutex_t mutex = (xbt_mutex_t) (uintptr_t) env->GetLongField(obj, jsyncro_field_Mutex_bind);
+  xbt_mutex_t mutex = (xbt_mutex_t)(uintptr_t)env->GetLongField(obj, jsynchro_field_Mutex_bind);
   try {
     xbt_mutex_acquire(mutex);
   }
@@ -43,34 +41,32 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Mutex_acquire(JNIEnv * env, jobject
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Mutex_release(JNIEnv * env, jobject obj) {
   xbt_mutex_t mutex;
 
-  mutex = (xbt_mutex_t) (uintptr_t) env->GetLongField(obj, jsyncro_field_Mutex_bind);
+  mutex = (xbt_mutex_t)(uintptr_t)env->GetLongField(obj, jsynchro_field_Mutex_bind);
   xbt_mutex_release(mutex);
 }
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Mutex_nativeFinalize(JNIEnv * env, jobject obj) {
-  xbt_mutex_t mutex = (xbt_mutex_t)(uintptr_t)env->GetLongField(obj, jsyncro_field_Mutex_bind);
+  xbt_mutex_t mutex = (xbt_mutex_t)(uintptr_t)env->GetLongField(obj, jsynchro_field_Mutex_bind);
   xbt_mutex_destroy(mutex);
 }
 
-static jfieldID jsyncro_field_Semaphore_bind;
+static jfieldID jsynchro_field_Semaphore_bind;
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Semaphore_nativeInit(JNIEnv *env, jclass cls) {
-  jsyncro_field_Semaphore_bind = jxbt_get_sfield(env, "org/simgrid/msg/Semaphore", "bind", "J");
-  if (!jsyncro_field_Semaphore_bind) {
-    jxbt_throw_native(env,bprintf("Can't find some fields in Semaphore Java class. You should report this bug."));
-  }
+  jsynchro_field_Semaphore_bind = jxbt_get_sfield(env, "org/simgrid/msg/Semaphore", "bind", "J");
+  xbt_assert(jsynchro_field_Semaphore_bind, "Native initialization of msg/Semaphore failed. Please report that bug");
 }
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Semaphore_init(JNIEnv * env, jobject obj, jint capacity) {
   msg_sem_t sem = MSG_sem_init((int) capacity);
 
-  env->SetLongField(obj, jsyncro_field_Semaphore_bind, (jlong) (uintptr_t) (sem));
+  env->SetLongField(obj, jsynchro_field_Semaphore_bind, (jlong)(uintptr_t)(sem));
 }
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Semaphore_acquire(JNIEnv * env, jobject obj, jdouble timeout) {
   msg_sem_t sem;
 
-  sem = (msg_sem_t) (uintptr_t) env->GetLongField(obj, jsyncro_field_Semaphore_bind);
+  sem             = (msg_sem_t)(uintptr_t)env->GetLongField(obj, jsynchro_field_Semaphore_bind);
   msg_error_t res = MSG_sem_acquire_timeout(sem, (double) timeout);
   if (res != MSG_OK) {
     jmsg_throw_status(env, res);
@@ -80,14 +76,14 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Semaphore_acquire(JNIEnv * env, jobj
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Semaphore_release(JNIEnv * env, jobject obj) {
   msg_sem_t sem;
 
-  sem = (msg_sem_t) (uintptr_t) env->GetLongField(obj, jsyncro_field_Semaphore_bind);
+  sem = (msg_sem_t)(uintptr_t)env->GetLongField(obj, jsynchro_field_Semaphore_bind);
   MSG_sem_release(sem);
 }
 
 JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Semaphore_wouldBlock(JNIEnv * env, jobject obj) {
   msg_sem_t sem;
 
-  sem = (msg_sem_t) (uintptr_t) env->GetLongField(obj, jsyncro_field_Semaphore_bind);
+  sem     = (msg_sem_t)(uintptr_t)env->GetLongField(obj, jsynchro_field_Semaphore_bind);
   int res = MSG_sem_would_block(sem);
   return (jboolean) res;
 }
@@ -95,6 +91,6 @@ JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Semaphore_wouldBlock(JNIEnv * en
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Semaphore_nativeFinalize(JNIEnv * env, jobject obj) {
   msg_sem_t sem;
 
-  sem = (msg_sem_t) (uintptr_t) env->GetLongField(obj, jsyncro_field_Semaphore_bind);
+  sem = (msg_sem_t)(uintptr_t)env->GetLongField(obj, jsynchro_field_Semaphore_bind);
   MSG_sem_destroy(sem);
 }
index f298008..844433c 100644 (file)
@@ -48,6 +48,8 @@ jboolean jtask_is_valid(jobject jtask, JNIEnv * env)
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_nativeInit(JNIEnv *env, jclass cls) {
   jclass jtask_class_Comm = env->FindClass("org/simgrid/msg/Comm");
   jclass jtask_class_Task = env->FindClass("org/simgrid/msg/Task");
+  xbt_assert(jtask_class_Comm && jtask_class_Task,
+             "Native initialization of msg/Comm or msg/Task failed. Please report that bug");
 
   jtask_method_Comm_constructor = env->GetMethodID(jtask_class_Comm, "<init>", "()V");
   jtask_field_Task_bind = jxbt_get_jfield(env, jtask_class_Task, "bind", "J");
@@ -56,10 +58,9 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_nativeInit(JNIEnv *env, jclass
   jtask_field_Comm_bind = jxbt_get_jfield(env, jtask_class_Comm, "bind", "J");
   jtask_field_Comm_taskBind = jxbt_get_jfield(env, jtask_class_Comm, "taskBind", "J");
   jtask_field_Comm_receiving = jxbt_get_jfield(env, jtask_class_Comm, "receiving", "Z");
-  if (!jtask_field_Task_bind || !jtask_class_Task || !jtask_field_Comm_bind || !jtask_field_Comm_taskBind ||
-        !jtask_field_Comm_receiving || !jtask_method_Comm_constructor) {
-          jxbt_throw_native(env,bprintf("Can't find some fields in Java class."));
-  }
+  xbt_assert(jtask_field_Task_bind && jtask_field_Comm_bind && jtask_field_Comm_taskBind &&
+                 jtask_field_Comm_receiving && jtask_method_Comm_constructor,
+             "Native initialization of msg/Task failed. Please report that bug");
 }
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_create(JNIEnv * env, jobject jtask, jstring jname,
@@ -399,36 +400,29 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_receive(JNIEnv * env, jclass
 }
 
 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_irecv(JNIEnv * env, jclass cls, jstring jmailbox) {
-  msg_comm_t comm;
-  const char *mailbox;
-  jclass comm_class;
+  jclass comm_class = env->FindClass("org/simgrid/msg/Comm");
+  if (!comm_class)
+    return nullptr;
+
   //pointer to store the task object pointer.
   msg_task_t *task = xbt_new(msg_task_t,1);
   *task = nullptr;
   /* There should be a cache here */
-  comm_class = env->FindClass("org/simgrid/msg/Comm");
-
-  if (!comm_class) {
-    jxbt_throw_native(env,bprintf("fieldID or methodID or class not found."));
-    return nullptr;
-  }
 
   jobject jcomm = env->NewObject(comm_class, jtask_method_Comm_constructor);
   if (!jcomm) {
-    jxbt_throw_native(env,bprintf("Can't create a Comm object."));
+    jxbt_throw_jni(env, "Can't create a Comm object.");
     return nullptr;
   }
 
-  mailbox = env->GetStringUTFChars(jmailbox, 0);
-
-  comm = MSG_task_irecv(task,mailbox);
+  const char* mailbox = env->GetStringUTFChars(jmailbox, 0);
+  msg_comm_t comm     = MSG_task_irecv(task, mailbox);
+  env->ReleaseStringUTFChars(jmailbox, mailbox);
 
   env->SetLongField(jcomm, jtask_field_Comm_bind, (jlong) (uintptr_t)(comm));
   env->SetLongField(jcomm, jtask_field_Comm_taskBind, (jlong) (uintptr_t)(task));
   env->SetBooleanField(jcomm, jtask_field_Comm_receiving, JNI_TRUE);
 
-  env->ReleaseStringUTFChars(jmailbox, mailbox);
-
   return jcomm;
 }
 
@@ -477,55 +471,42 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_receiveBounded(JNIEnv * env,
 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_irecvBounded(JNIEnv * env, jclass cls, jstring jmailbox,
                                                                  jdouble rate)
 {
-  msg_comm_t comm;
-  const char *mailbox;
-  jclass comm_class;
-  //pointer to store the task object pointer.
-  msg_task_t *task = xbt_new(msg_task_t,1);
-  *task = nullptr;
-  /* There should be a cac hee */
-  comm_class = env->FindClass("org/simgrid/msg/Comm");
-
-  if (!comm_class) {
-    jxbt_throw_native(env,bprintf("fieldID or methodID or class not found."));
+  jclass comm_class = env->FindClass("org/simgrid/msg/Comm");
+  if (!comm_class)
     return nullptr;
-  }
+
+  // pointer to store the task object pointer.
+  msg_task_t* task = xbt_new0(msg_task_t, 1);
 
   jobject jcomm = env->NewObject(comm_class, jtask_method_Comm_constructor);
   if (!jcomm) {
-    jxbt_throw_native(env,bprintf("Can't create a Comm object."));
+    jxbt_throw_jni(env, "Can't create a Comm object.");
     return nullptr;
   }
 
-  mailbox = env->GetStringUTFChars(jmailbox, 0);
-
-  comm = MSG_task_irecv_bounded(task,mailbox, (double) rate);
+  const char* mailbox = env->GetStringUTFChars(jmailbox, 0);
+  msg_comm_t comm     = MSG_task_irecv_bounded(task, mailbox, (double)rate);
+  env->ReleaseStringUTFChars(jmailbox, mailbox);
 
   env->SetLongField(jcomm, jtask_field_Comm_bind, (jlong) (uintptr_t)(comm));
   env->SetLongField(jcomm, jtask_field_Comm_taskBind, (jlong) (uintptr_t)(task));
   env->SetBooleanField(jcomm, jtask_field_Comm_receiving, JNI_TRUE);
 
-  env->ReleaseStringUTFChars(jmailbox, mailbox);
-
   return jcomm;
 }
 
 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_isend(JNIEnv *env, jobject jtask, jstring jmailbox)
 {
-  jclass comm_class;
-  msg_task_t task;
-  jobject jcomm;
   msg_comm_t comm;
-  const char *mailbox;
 
-  comm_class = env->FindClass("org/simgrid/msg/Comm");
+  jclass comm_class = env->FindClass("org/simgrid/msg/Comm");
 
   if (!comm_class) return nullptr;
 
-  jcomm = env->NewObject(comm_class, jtask_method_Comm_constructor);
-  mailbox = env->GetStringUTFChars(jmailbox, 0);
+  jobject jcomm       = env->NewObject(comm_class, jtask_method_Comm_constructor);
+  const char* mailbox = env->GetStringUTFChars(jmailbox, 0);
 
-  task = jtask_to_native_task(jtask, env);
+  msg_task_t task = jtask_to_native_task(jtask, env);
 
   if (!task) {
     env->ReleaseStringUTFChars(jmailbox, mailbox);
@@ -549,15 +530,14 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_isend(JNIEnv *env, jobject j
 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_isendBounded(JNIEnv *env, jobject jtask, jstring jmailbox,
                                                                  jdouble maxrate)
 {
-  jclass comm_class;
   msg_task_t task;
   jobject jcomm;
   msg_comm_t comm;
   const char *mailbox;
 
-  comm_class = env->FindClass("org/simgrid/msg/Comm");
-
-  if (!comm_class) return nullptr;
+  jclass comm_class = env->FindClass("org/simgrid/msg/Comm");
+  if (!comm_class)
+    return nullptr;
 
   jcomm = env->NewObject(comm_class, jtask_method_Comm_constructor);
   mailbox = env->GetStringUTFChars(jmailbox, 0);
index 31a61a6..23b0c5a 100644 (file)
@@ -34,9 +34,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_VM_nativeInit(JNIEnv *env, jclass cl
 {
   jclass jprocess_class_VM = env->FindClass("org/simgrid/msg/VM");
   jvm_field_bind = jxbt_get_jfield(env, jprocess_class_VM, "bind", "J");
-  if (!jvm_field_bind  ) {
-    jxbt_throw_native(env,bprintf("Can't find some fields in Java class. You should report this bug."));
-  }
+  xbt_assert(jvm_field_bind, "Native initialization of msg/VM failed. Please report that bug");
 }
 
 JNIEXPORT jint JNICALL Java_org_simgrid_msg_VM_isCreated(JNIEnv * env, jobject jvm)
index 27b4ddd..d6fe7e7 100644 (file)
@@ -192,11 +192,6 @@ void jxbt_throw_notbound(JNIEnv * env, const char *kind, void *pointer)
   jxbt_throw_by_name(env, "org/simgrid/msg/JniException", bprintf("Internal error: %s %p not bound", kind, pointer));
 }
 
-void jxbt_throw_native(JNIEnv * env, char *msg)
-{
-  jxbt_throw_by_name(env, "org/simgrid/msg/NativeException", msg);
-}
-
 void jxbt_throw_null(JNIEnv * env, char *msg)
 {
   jxbt_throw_by_name(env, "java/lang/NullPointerException", msg);
index 2218349..2b0830e 100644 (file)
@@ -54,8 +54,6 @@ void jxbt_throw_by_name(JNIEnv * env, const char *name, char *msg);
 void jxbt_throw_jni(JNIEnv * env, const char *msg);
 /** Thrown when using an object not bound to a native one where it should, or reverse (kinda JNI issue) */
 void jxbt_throw_notbound(JNIEnv * env, const char *kind, void *pointer);
-/** Thrown on error in native MSG code */
-void jxbt_throw_native(JNIEnv * env, char *msg);
 /** Thrown if NULL gets used */
 void jxbt_throw_null(JNIEnv * env, char *msg);
 
diff --git a/src/bindings/java/org/simgrid/msg/NativeException.java b/src/bindings/java/org/simgrid/msg/NativeException.java
deleted file mode 100644 (file)
index ecc12de..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/* This exception is raised when there is an error within the C world of SimGrid. */
-
-/* Copyright (c) 2006-2014. 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. */
-
-package org.simgrid.msg;
-
-/** Exception raised when there is an error within the C world of SimGrid. */
-public class NativeException extends MsgException {
-       private static final long serialVersionUID = 1L;
-
-       /** Constructs an <code>NativeException</code> with a detail message. */
-       public NativeException(String s) {
-               super(s);
-       }
-}
index 6d65b67..4f29954 100644 (file)
@@ -108,11 +108,9 @@ public abstract class Process implements Runnable {
         * @param args                  The arguments of the main function of the process.
         *
         * @exception                   HostNotFoundException  if no host with this name exists.
-        *                      NativeException
-        * @throws NativeException
         *
         */ 
-       public Process(String hostname, String name, String[] args) throws HostNotFoundException, NativeException {
+       public Process(String hostname, String name, String[] args) throws HostNotFoundException {
                this(Host.getByName(hostname), name, args);
        }
        /**
@@ -201,7 +199,7 @@ public abstract class Process implements Runnable {
        public native boolean isSuspended();
        
        /** Yield the current process. All other processes that are ready at the same timestamp will be executed first */
-       public native static void yield();
+       public static native void yield();
        
        /**
         * Specify whether the process should restart when its host restarts after a failure
@@ -231,10 +229,8 @@ public abstract class Process implements Runnable {
         * @param PID                   The process identifier of the process to get.
         *
         * @return                              The process with the specified PID.
-        *
-        * @exception                   NativeException on error in the native SimGrid code
         */ 
-       public static native Process fromPID(int PID) throws NativeException;
+       public static native Process fromPID(int PID);
        /**
         * This method returns the PID of the process.
         *
index b4cac70..bf2aa6f 100644 (file)
@@ -41,10 +41,9 @@ public class Storage {
         *
         * @return              The storage object with the given name.
         * @exception           StorageNotFoundException if the name of the storage is not valid.
-        * @exception           NativeException if the native version of this method failed.
         */ 
        public static native Storage getByName(String name) 
-                       throws HostNotFoundException, NullPointerException, NativeException, StorageNotFoundException;
+                       throws HostNotFoundException, NullPointerException, StorageNotFoundException;
 
        /**
         * This method returns the name of a storage.
index e267422..e371cae 100644 (file)
@@ -196,7 +196,7 @@ public class Task {
         * @throws HostFailureException 
         * @throws TransferFailureException 
         */
-       public void send(String mailbox) throws TransferFailureException, HostFailureException, TimeoutException, NativeException {
+       public void send(String mailbox) throws TransferFailureException, HostFailureException, TimeoutException {
                send(mailbox, -1);
        } 
 
@@ -205,12 +205,11 @@ public class Task {
         *
         * @param mailbox where to send the message
         * @param timeout
-        * @exception  NativeException if the retrieval fails.
         * @throws TimeoutException 
         * @throws HostFailureException 
         * @throws TransferFailureException 
         */
-       public native void send(String mailbox, double timeout) throws TransferFailureException, HostFailureException, TimeoutException, NativeException;
+       public native void send(String mailbox, double timeout) throws TransferFailureException, HostFailureException, TimeoutException;
 
        /** Sends the task on the specified mailbox (capping the sending rate to \a maxrate) 
         *
index d06dad0..452314d 100644 (file)
@@ -479,7 +479,6 @@ set(JMSG_JAVA_SRC
   src/bindings/java/org/simgrid/msg/Msg.java
   src/bindings/java/org/simgrid/msg/MsgException.java
   src/bindings/java/org/simgrid/msg/Mutex.java
-  src/bindings/java/org/simgrid/msg/NativeException.java
   src/bindings/java/org/simgrid/msg/Process.java
   src/bindings/java/org/simgrid/msg/ProcessKilledError.java
   src/bindings/java/org/simgrid/msg/ProcessNotFoundException.java