GNOME Bugzilla – Bug 313152
TreeStore returns null for getValue with DataColumnObject
Last modified: 2009-08-15 18:40:50 UTC
Version details: libgtk-java-2.6.2-3, libgnome-java-2.10.1-3 Distribution/Version: Fedora Core release 4 (Rawhide) A TreeStore is unable to return an object stored inside a DataColumnObject. The following test class can reproduce this bug. It shows a TreeStore created with two DataBlocks: a DataColumnObject and a DataColumnString. When a new row is appended and its values are set, it is possible to retrieve the value that is stored in the DataColumnString, but not in the DataColumnObject. A null value is always returned for the DataColumnObject. When executing the test class, the following is the output I get: setPhrase was: DataColumnString will work getPhrase was: DataColumnString will work setTestObj was: gnome.TestTreeStore$TestObject@228a02 getTestObj was: null The test class (sorry for the aweful formatting...my tabs are set to 2 spaces in gvim but obviously not in my browser): ------------------------------ import org.gnu.gnome.Program; import org.gnu.gtk.DataColumn; import org.gnu.gtk.DataColumnObject; import org.gnu.gtk.DataColumnString; import org.gnu.gtk.TreeIter; import org.gnu.gtk.TreeStore; /** * @author mhowellj * class used to test tree store methods */ public class TestTreeStore { public void test() { DataColumn[] dc = new DataColumn[2]; dc[0] = new DataColumnString(); dc[1] = new DataColumnObject(); TreeStore ts = new TreeStore(dc); TestObject setTestObj = new TestObject(); String setPhrase = "DataColumnString will work"; TreeIter item = ts.getFirstIter(); item = ts.appendRow(item); ts.setValue(item, (DataColumnString)dc[0], setPhrase ); ts.setValue(item, (DataColumnObject)dc[1], setTestObj ); String getPhrase = ts.getValue(item,(DataColumnString)dc[0]); TestObject getTestObj = (TestObject)ts.getValue(item,(DataColumnObject)dc[1]); System.out.println("setPhrase was: "+setPhrase); System.out.println("getPhrase was: "+getPhrase); System.out.println("setTestObj was: "+setTestObj); System.out.println("getTestObj was: "+getTestObj); } /* ######## Main Stuff ########## */ public static void main(String[] args) { Program.initGnomeUI("Hello", "0.1", args); TestTreeStore newTest = new TestTreeStore(); newTest.test(); } private class TestObject { protected String getName() { return "I'm a testObject"; } } }
Hi, thanks for reporting this. This had already been reported and solved though (there hasn't been a release since that fix went it, however). Marking as duplicate. *** This bug has been marked as a duplicate of 301239 ***
Closing.