Patch: another JNI test

Tom Tromey tromey@cygnus.com
Sun Feb 27 13:42:00 GMT 2000


I'm checking in this patch.  It adds a test which checks to make sure
that our JNI functions are properly handling exceptions.  (This test
fails with the current g++ / gcj / libgcj.)

2000-02-23  Tom Tromey  <tromey@cygnus.com>

	* libjava.jni/noclass.c: New file.
	* libjava.jni/noclass.out: New file.
	* libjava.jni/noclass.java: New file.

Tom

Index: libjava.jni/noclass.c
===================================================================
RCS file: noclass.c
diff -N noclass.c
--- /dev/null	Tue May  5 13:32:27 1998
+++ noclass.c	Sun Feb 27 13:40:59 2000
@@ -0,0 +1,9 @@
+#include <noclass.h>
+
+void
+Java_noclass_find_1it (JNIEnv *env, jclass k)
+{
+  /* We cause an exception by asking for a class we know does not
+     exist.  */
+  k = (*env)->FindClass (env, "java/lang/Sarcophagus");
+}
Index: libjava.jni/noclass.java
===================================================================
RCS file: noclass.java
diff -N noclass.java
--- /dev/null	Tue May  5 13:32:27 1998
+++ noclass.java	Sun Feb 27 13:40:59 2000
@@ -0,0 +1,18 @@
+// Test to make sure JNI implementation catches exceptions.
+
+public class noclass
+{
+  static
+  {
+    System.loadLibrary ("noclass");
+  }
+
+  public static native void find_it ();
+
+  public static void main (String[] args)
+  {
+    find_it ();
+    // If find_it() causes a crash, we won't be running this next line.
+    System.out.println ("Ok");
+  }
+}
Index: libjava.jni/noclass.out
===================================================================
RCS file: noclass.out
diff -N noclass.out
--- /dev/null	Tue May  5 13:32:27 1998
+++ noclass.out	Sun Feb 27 13:40:59 2000
@@ -0,0 +1 @@
+Ok


More information about the Java-patches mailing list