After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 313152 - TreeStore returns null for getValue with DataColumnObject
TreeStore returns null for getValue with DataColumnObject
Status: VERIFIED DUPLICATE of bug 301239
Product: java-gnome
Classification: Bindings
Component: GTK
Not Applicable
Other Linux
: Normal normal
: ---
Assigned To: java-gnome bindings maintainers
java-gnome bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2005-08-10 19:38 UTC by Megan Howell Jones
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: 2.9/2.10



Description Megan Howell Jones 2005-08-10 19:38:48 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";
		}
	}

	
}
Comment 1 Ismael Juma 2005-08-10 19:51:17 UTC
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 ***
Comment 2 Ismael Juma 2005-09-25 13:28:05 UTC
Closing.