Issue1819

classification
Title: Incorrect handling of Java object toString methods returning null
Type: behaviour Severity: critical
Components: Core Versions: 2.5.2
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: pjenvey Nosy List: alex.gronholm, pjenvey
Priority: Keywords:

Created on 2011-11-18.22:05:41 by alex.gronholm, last changed 2011-11-24.01:47:16 by pjenvey.

Files
File name Uploaded Description Edit Remove
jytree.py alex.gronholm, 2011-11-18.22:05:41 Script that demonstrates the problem
Messages
msg6723 (view) Author: Alex Grönholm (alex.gronholm) Date: 2011-11-18.22:05:40
In some circumstances, a Python method that overrides a Java method can get null instead of None passed to it, which obviously should never happen. In the attached source code, the problem only occurs if both the model and cell renderer are set to Python class instances.
msg6728 (view) Author: Philip Jenvey (pjenvey) Date: 2011-11-21.20:54:32
Unfortunately I don't time to get to this any time soon Alex.

What I can tell you about this bug is that Jython would have created a 'Proxy' POJO for those Python classes. It would fulfill the Java interface contract required from other Java code.

I believe the proxy would end up calling Py.java2py on all arguments passed to it and pass the results to actual the Python function. Py.java2py goes through the whole 'adapter' chain, which should have noticed a null and converted it to Py.None.

Obviously one of those pieces of the picture is not playing out as I think it should. Maybe I'm wrong about the proxy passing *all arguments* through java2py, because I'm pretty sure this already works as expected: Py.java2py(null) == Py.None
msg6732 (view) Author: Philip Jenvey (pjenvey) Date: 2011-11-24.01:33:30
Turns out we weren't actually passing a null into the method here, what's passed for 'value' in the test is a DefaultMutableTreeNode. This Swing class's toString method apparently returns null, which eventually blows up Jython when it goes to print it
msg6733 (view) Author: Philip Jenvey (pjenvey) Date: 2011-11-24.01:47:16
fixed in 4d0f8af76d2d and 8bc674cdfd2d
History
Date User Action Args
2011-11-24 01:47:16pjenveysetstatus: open -> closed
resolution: fixed
messages: + msg6733
2011-11-24 01:33:31pjenveysetmessages: + msg6732
title: null passed to Python method instead of None -> Incorrect handling of Java object toString methods returning null
2011-11-24 01:18:22pjenveysetassignee: pjenvey
2011-11-21 20:54:32pjenveysetnosy: + pjenvey
messages: + msg6728
2011-11-18 22:05:41alex.gronholmcreate