|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
JSR 223 impl bug in 2.5.1Ran into a small bug in the JSR 223 implementation of invokeFunction.
In org.python.jsr223.PyScriptEngine.invokeFunction(...), the catch block calls throwInvokeException. The idea being if you call a top level method that doesn't exist, it will throw a NoSuchMethodException. However, if the python function you call(that exists) throws a PyException like this, Traceback (most recent call last): File "<script>", line 19, in inform AttributeError: 'java.util.HashMap' object has no attribute 'iteritems' The catch will call throwInvokeException() will throw a NoSuchMethod exception with the top level method name as the problem since the pyException is an AttributeError. In this case, I have just called an invalid method inside the python script, but it gets masked as a top level miss. It seems the invokeFunction already can throw the NoSuchMethod exception. So the catch block can be changed like this. --- PyScriptEngine.java.orig 2009-10-15 10:50:28.000000000 -0500 +++ PyScriptEngine.java 2009-10-15 10:51:13.000000000 -0500 @@ -111,7 +111,7 @@ } return function.__call__(Py.javas2pys(args)).__tojava__(Object.class); } catch (PyException pye) { - return throwInvokeException(pye, name); + throw scriptException(pye); } } It looks like the invokeMethod method could suffer from the same problem, but I'm not sure if the same fix would apply there. A possible alternative that would cover both cases would be to append the pye.toString() result inside the NoSuchMethodException constructor in throwInvokeException() ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Jython-dev mailing list Jython-dev@... https://lists.sourceforge.net/lists/listinfo/jython-dev |
| Free embeddable forum powered by Nabble | Forum Help |