Issue1841445

classification
Title: NPE in PythonInterpreter.get(String name, Class javaclass)
Type: Severity: normal
Components: None Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: cgroves, johnrsisson
Priority: normal Keywords:

Created on 2007-11-30.05:07:24 by johnrsisson, last changed 2007-12-02.22:03:52 by cgroves.

Messages
msg2026 (view) Author: John Sisson (johnrsisson) Date: 2007-11-30.05:07:24
If the name passed in the first parameter of a PythonInterpreter.get(String name, Class javaclass) call isn't bound, the get method's code will pass a null to the first parameter on the call to Py.tojava(..) and this  ends up causing a NullPointerException to be thrown.

This appears to be a bug in the get method's logic, as this behaviour isn't in the JavaDoc for the get method and the behaviour is inconsistent with the alternative get(String name) method that would return null.  Also applications shouldn't normally have to catch NullPointerException.

The get(String name, Class javaclass) code should check the result of the locals.__finditem__(name.intern() call before proceeding to call Py.tojava.

This issue exists in jython 2.1 onwards (not sure about earlier releases).
msg2027 (view) Author: Charlie Groves (cgroves) Date: 2007-12-02.22:03:52
Fixed in r3755.  Thanks!
History
Date User Action Args
2007-11-30 05:07:24johnrsissoncreate