Return-Path: Delivered-To: apmail-lucene-pylucene-dev-archive@minotaur.apache.org Received: (qmail 76235 invoked from network); 27 Sep 2010 22:22:58 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 27 Sep 2010 22:22:58 -0000 Received: (qmail 33410 invoked by uid 500); 27 Sep 2010 22:22:57 -0000 Delivered-To: apmail-lucene-pylucene-dev-archive@lucene.apache.org Received: (qmail 33135 invoked by uid 500); 27 Sep 2010 22:22:57 -0000 Mailing-List: contact pylucene-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: pylucene-dev@lucene.apache.org Delivered-To: mailing list pylucene-dev@lucene.apache.org Received: (qmail 33070 invoked by uid 99); 27 Sep 2010 22:22:56 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Sep 2010 22:22:56 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of janssen@parc.com designates 13.1.64.93 as permitted sender) Received: from [13.1.64.93] (HELO alpha.xerox.com) (13.1.64.93) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Sep 2010 22:22:48 +0000 Received: from parc.com ([13.1.102.103]) by alpha.xerox.com with SMTP id <141640(1)>; Mon, 27 Sep 2010 15:22:14 PDT cc: pylucene-dev@lucene.apache.org To: To: Subject: Re: throwing an exception *through* Java? In-reply-to: References: <25256.1285448079@parc.com> <19590.1285453421@parc.com> <8716.1285611477@parc.com> <5E75C3B7-56D2-4EA1-973D-AD241E03FF4C@apache.org> <4153.1285617084@parc.com> Comments: In-reply-to Andi Vajda message dated "Mon, 27 Sep 2010 13:26:45 -0700." Cc: janssen@parc.com X-Mailer: MH-E 8.2; nmh 1.3; GNU Emacs 23.1.90 Date: Mon, 27 Sep 2010 15:22:14 PDT Message-ID: <99360.1285626134@parc.com> From: Bill Janssen X-Virus-Checked: Checked by ClamAV on apache.org Andi Vajda wrote: > > On Mon, 27 Sep 2010, Bill Janssen wrote: > > > Here's a printout of what I'm seeing: > > > > UpLibQueryParser.parse('_query_language:nl janssen')... > > => lucene.VERSION: 3.0.2 , jcc._jcc.JCC_VERSION 2.6 > > => Exception received is JavaError( > Traceback (most recent call last): > > File "/u/python/uplib/indexing.py", line 591, in getFieldQuery > > raise RequiresQueryLanguage(text) > > __main__.RequiresQueryLanguage: Query specifies language 'nl' > > >,) > > You are using --shared because the exception you're getting is > PythonException. > > > Is there some way to check to see if lucene is using --shared at runtime? > > No direct way that I can think of at the moment. > > So, it looks like you're getting a JavaError that wraps a PythonException. > Yet it's wrapped by a JavaError. This could mean that the test that > checks if the PythonException instance is of class PythonException > line 426 in JCCEnv.cpp is failing. > > As a hack, try changing that line to do a string compare on the class > names instead. Or just force it to true, even. OK, I tried that, no improvement. I used the 3.0.2 source distro. Here's my hacked version of reportException: void JCCEnv::reportException() const { JNIEnv *vm_env = get_vm_env(); jthrowable throwable = vm_env->ExceptionOccurred(); if (throwable) { if (!env->handlers) vm_env->ExceptionDescribe(); #ifdef PYTHON PythonGIL gil; if (PyErr_Occurred()) { /* _thr is PythonException ifdef _jcc_lib (shared mode) * if not shared mode, _thr is RuntimeException */ jobject cls = (jobject) vm_env->GetObjectClass(throwable); if (true) { #ifndef _jcc_lib /* PythonException class is not available without shared mode. * Python exception information thus gets lost and exception * is reported via plain Java RuntimeException. */ PyErr_Clear(); throw _EXC_JAVA; #else throw _EXC_PYTHON; #endif } } #endif throw _EXC_JAVA; } } And here's what I see: Exception received is JavaError(,) This implies that _jcc_lib (or PYTHON) is not #defined. Bill