You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by va...@apache.org on 2009/01/10 23:37:30 UTC

svn commit: r733388 - in /lucene/pylucene/trunk/jcc: CHANGES jcc/sources/JCCEnv.cpp jcc/sources/JCCEnv.h jcc/sources/macros.h setup.py

Author: vajda
Date: Sat Jan 10 14:37:30 2009
New Revision: 733388

URL: http://svn.apache.org/viewvc?rev=733388&view=rev
Log:
 - unhandled java exception is printed out via ExceptionDescribe()

Modified:
    lucene/pylucene/trunk/jcc/CHANGES
    lucene/pylucene/trunk/jcc/jcc/sources/JCCEnv.cpp
    lucene/pylucene/trunk/jcc/jcc/sources/JCCEnv.h
    lucene/pylucene/trunk/jcc/jcc/sources/macros.h
    lucene/pylucene/trunk/jcc/setup.py

Modified: lucene/pylucene/trunk/jcc/CHANGES
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/CHANGES?rev=733388&r1=733387&r2=733388&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/CHANGES (original)
+++ lucene/pylucene/trunk/jcc/CHANGES Sat Jan 10 14:37:30 2009
@@ -5,6 +5,7 @@
 ------------------
  - JCC now a subproject of the Apache PyLucene project
  - fixed bug where thread's JNIEnv was not set before calling findClass()
+ - unhandled java exception is printed out via ExceptionDescribe()
  - 
 
 Version 2.0 -> 2.1

Modified: lucene/pylucene/trunk/jcc/jcc/sources/JCCEnv.cpp
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/sources/JCCEnv.cpp?rev=733388&r1=733387&r2=733388&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/sources/JCCEnv.cpp (original)
+++ lucene/pylucene/trunk/jcc/jcc/sources/JCCEnv.cpp Sat Jan 10 14:37:30 2009
@@ -279,7 +279,9 @@
 
     if (throwable)
     {
-        //vm_env->ExceptionDescribe();
+        if (!env->handlers)
+            vm_env->ExceptionDescribe();
+
         vm_env->ExceptionClear();
 
 #ifdef PYTHON

Modified: lucene/pylucene/trunk/jcc/jcc/sources/JCCEnv.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/sources/JCCEnv.h?rev=733388&r1=733387&r2=733388&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/sources/JCCEnv.h (original)
+++ lucene/pylucene/trunk/jcc/jcc/sources/JCCEnv.h Sat Jan 10 14:37:30 2009
@@ -91,6 +91,7 @@
 public:
     JavaVM *vm;
     std::multimap<int, countedRef> refs;
+    int handlers;
 
     class exception {
     public:
@@ -270,14 +271,18 @@
 class PythonThreadState {
   private:
     PyThreadState *state;
+    int handler;
   public:
-    PythonThreadState()
+    PythonThreadState(int handler=0)
     {
         state = PyEval_SaveThread();
+        this->handler = handler;
+        env->handlers += handler;
     }
     ~PythonThreadState()
     {
         PyEval_RestoreThread(state);
+        env->handlers -= handler;
     }
 };
 

Modified: lucene/pylucene/trunk/jcc/jcc/sources/macros.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/sources/macros.h?rev=733388&r1=733387&r2=733388&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/sources/macros.h (original)
+++ lucene/pylucene/trunk/jcc/jcc/sources/macros.h Sat Jan 10 14:37:30 2009
@@ -20,7 +20,7 @@
 #define OBJ_CALL(action)                                                \
     {                                                                   \
         try {                                                           \
-            PythonThreadState state;                                    \
+            PythonThreadState state(1);                                 \
             action;                                                     \
         } catch (JCCEnv::pythonError) {                                 \
             return NULL;                                                \
@@ -32,7 +32,7 @@
 #define INT_CALL(action)                                                \
     {                                                                   \
         try {                                                           \
-            PythonThreadState state;                                    \
+            PythonThreadState state(1);                                 \
             action;                                                     \
         } catch (JCCEnv::pythonError) {                                 \
             return -1;                                                  \

Modified: lucene/pylucene/trunk/jcc/setup.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/setup.py?rev=733388&r1=733387&r2=733388&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/setup.py (original)
+++ lucene/pylucene/trunk/jcc/setup.py Sat Jan 10 14:37:30 2009
@@ -14,6 +14,7 @@
 
 import os, sys, platform, subprocess
 
+jcc_ver = '2.1'
 python_ver = '%d.%d.%d' %(sys.version_info[0:3])
 machine = platform.machine()
 
@@ -22,7 +23,6 @@
 else:
     platform = sys.platform
 
-
 # Add or edit the entry corresponding to your system in the INCLUDES, CFLAGS
 # DEBUG_CFLAGS, LFLAGS and JAVAC dictionaries below. These entries are used
 # to build JCC _and_ by JCC to drive compiling and linking via distutils or
@@ -236,8 +236,8 @@
         if platform in ('darwin', 'ipod'):
             kwds["extra_link_args"] = \
                 lflags + ['-install_name', '@rpath/libjcc.dylib',
-                          '-current_version', '2.0',
-                          '-compatibility_version', '2.0']
+                          '-current_version', jcc_ver,
+                          '-compatibility_version', jcc_ver]
         elif platform == 'linux2':
             kwds["extra_link_args"] = \
                 lflags + ['-lpython%s.%s' %(sys.version_info[0:2])]
@@ -276,7 +276,7 @@
 
     args = {
         'name': 'JCC',
-        'version': '2.1',
+        'version': jcc_ver,
         'description': 'a C++ code generator for calling Java from C++/Python',
         'long_description': open('DESCRIPTION').read(),
         'author': 'Andi Vajda',