#266 [java] Don't create jthrowable local reference on exception

closed-accepted
None
5
2011-05-17
2011-04-19
Alan Harder
No

ExceptionOccurred creates a local reference for the jthrowable, but the generated code simply checks if it is non-null. Use ExceptionCheck instead.

Index: Source/Modules/java.cxx

--- java.cxx (revision 12640)
+++ java.cxx (working copy)
@@ -3990,7 +3990,7 @@

Printf(w->code, "jenv->%s(Swig::jclass_%s, Swig::director_methids[%s], %s);\n", methop, imclass_name, methid, jupcall_args);

- Printf(w->code, "if (jenv->ExceptionOccurred()) return $null;\n");
+ Printf(w->code, "if (jenv->ExceptionCheck() == JNI_TRUE) return $null;\n");

if (!is_void) {
String *jresult_str = NewString("jresult");

Discussion

  • William Fulton

    William Fulton - 2011-05-17
    • assigned_to: nobody --> wsfulton
    • status: open --> closed-accepted
     
  • William Fulton

    William Fulton - 2011-05-17

    Thanks, applied for swig-2.0.4.

     

Log in to post a comment.