[Pkg-ocaml-maint-commits] [SCM] camljava packaging branch, master, updated. upstream/0.3.orig-9-g3e872ed

Stefano Zacchiroli zack at upsilon.cc
Sat Nov 28 09:17:16 UTC 2009


The following commit has been merged in the master branch:
commit 3e872ed16a3d7314bd8981d028b6be1c7111e5c7
Author: Stefano Zacchiroli <zack at upsilon.cc>
Date:   Sat Nov 28 10:17:12 2009 +0100

    add debugging patch for java exceptions

diff --git a/debian/patches/0005-debugging-facility-for-Java-exceptions.patch b/debian/patches/0005-debugging-facility-for-Java-exceptions.patch
new file mode 100644
index 0000000..62d7c35
--- /dev/null
+++ b/debian/patches/0005-debugging-facility-for-Java-exceptions.patch
@@ -0,0 +1,71 @@
+From: Gregoire Henry <Gregoire.Henry at pps.jussieu.fr>
+Date: Sat, 28 Nov 2009 10:15:23 +0100
+Subject: [PATCH] debugging facility for Java exceptions
+
+debugging is togglable at runtime, without needing to recompile CamlJava
+---
+ lib/jni.mli    |    2 ++
+ lib/jni.mlp    |    2 ++
+ lib/jnistubs.c |   15 +++++++++++----
+ 3 files changed, 15 insertions(+), 4 deletions(-)
+
+diff --git a/lib/jni.mli b/lib/jni.mli
+index 2a593f0..ad829b3 100644
+--- a/lib/jni.mli
++++ b/lib/jni.mli
+@@ -14,6 +14,8 @@
+ 
+ (* Low-level Java interface (JNI level) *)
+ 
++external set_debug: bool -> unit = "camljava_set_debug"
++
+ (* Object operations *)
+ 
+ type obj
+diff --git a/lib/jni.mlp b/lib/jni.mlp
+index 9005e65..d1febac 100644
+--- a/lib/jni.mlp
++++ b/lib/jni.mlp
+@@ -14,6 +14,8 @@
+ 
+ (* Low-level Java interface (JNI level) *)
+ 
++external set_debug: bool -> unit = "camljava_set_debug"
++
+ external init: string -> unit = "camljava_Init"
+ external shutdown: unit -> unit = "camljava_Shutdown"
+ 
+diff --git a/lib/jnistubs.c b/lib/jnistubs.c
+index e1659f8..9938e89 100644
+--- a/lib/jnistubs.c
++++ b/lib/jnistubs.c
+@@ -74,6 +74,13 @@ value camljava_IsNull(value vobj)
+ 
+ /*********** Reflecting Java exceptions as Caml exceptions *************/
+ 
++static int debug = 0;
++
++value camljava_set_debug(value v) {
++  debug = Int_val(v);
++  return Val_unit;
++}
++
+ static void check_java_exception(void)
+ {
+   jthrowable exn;
+@@ -82,10 +89,10 @@ static void check_java_exception(void)
+ 
+   exn = (*jenv)->ExceptionOccurred(jenv);
+   if (exn != NULL) {
+-#if 0
+-    /* For debugging */
+-    (*jenv)->ExceptionDescribe(jenv);
+-#endif
++    if(debug) {
++      /* For debugging */
++      (*jenv)->ExceptionDescribe(jenv);
++    }
+     (*jenv)->ExceptionClear(jenv);
+     /* TODO: check Caml exception embedded into Java exception */
+     if (camljava_raise_exception == NULL) {
+-- 
diff --git a/debian/patches/series b/debian/patches/series
index da265c6..7238bfa 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@
 0002-Makefile-misc-fixes.patch
 0003-GC-global-reference-fix-for-JDK-1.6.patch
 0004-enforce-callback-invocation-from-main-thread.patch
+0005-debugging-facility-for-Java-exceptions.patch

-- 
camljava packaging



More information about the Pkg-ocaml-maint-commits mailing list