I noticed that sometimes the Python exception isn't correctly set when a Java method throws a java RuntimeException, which causes a Python SystemError.
I've attached a test case which specifies JavaError, since that's what the old PyLucene did: >>> DateField.dateToString(SimpleDateFormat('yyyy-MM-dd').parse('1900-1-1')) Traceback (most recent call last): File "<stdin>", line 1, in ? PyLucene.JavaError: java.lang.RuntimeException: time '-2208967200000' is too early, must be >= 0 (I had to call SimpleDateFormat().parse(), since I got an InvalidArgsError with just "DateField.dateToString(Date(0,1,1))") Thanks, Aaron Lav ([EMAIL PROTECTED])
import unittest from lucene import * class TestRuntimeError(unittest.TestCase): def testRunTimeError(self): def date_convert(): # should raise a java.lang.RuntimeException, because # the date is before the start of the epoch return DateField.dateToString(Date(0,1,1)) self.assertRaises(JavaError, date_convert) if __name__ == '__main__': import lucene lucene.initVM(lucene.CLASSPATH) unittest.main()
_______________________________________________ pylucene-dev mailing list pylucene-dev@osafoundation.org http://lists.osafoundation.org/mailman/listinfo/pylucene-dev