Skip to main content

JXTreeTable: Data corruption issue on closing a branch while editing

2 replies [Last post]
siva
Offline
Joined: 2003-07-15

Hi, seem to be getting NPE occationally, typically when a branch of a tree at the bottom of the table is being closed while editing (so that, after closing the branch, the initial row index at the editing node is more than the row count of the table after closing). Looks as if the tree is closed first and then the value is being set or something like that. Trace attached at the bottom.

Though I could live with this bug, I realized that, let's say my tree has root which has two children A, B and each has one children A1 and B1. Now, while I am editing A1 (row = 2), if I click on A, the value of A1 that I just entered is being set to B (after closing B is at row 2).
I tested this and am able to consistently reproduce it.

While we are at it, what if I don't want the user to close the branch till the edit is committed by the user in the cell? As in, if the partial edit is not valid, then I want to force the user to complete entering the right value before letting the user can close the branch.

java.lang.NullPointerException
at org.jdesktop.swing.JXTreeTable$TreeTableModelAdapter.nodeForRow(Unknown Source)
at org.jdesktop.swing.JXTreeTable$TreeTableModelAdapter.setValueAt(Unknown Source)
at javax.swing.JTable.setValueAt(JTable.java:1794)
at org.jdesktop.swing.JXTable.setValueAt(Unknown Source)
at MyJXTreeTable.setValueAt(HEditor.java:302)
at javax.swing.JTable.editingStopped(JTable.java:3167)
at javax.swing.AbstractCellEditor.fireEditingStopped(AbstractCellEditor.java:124)
at javax.swing.DefaultCellEditor$EditorDelegate.stopCellEditing(DefaultCellEditor.java:329)
at javax.swing.DefaultCellEditor.stopCellEditing(DefaultCellEditor.java:214)
at javax.swing.JTable.editCellAt(JTable.java:2510)
at org.jdesktop.swing.JXTreeTable.editCellAt(Unknown Source)
at javax.swing.plaf.basic.BasicTableUI$MouseInputHandler.adjustFocusAndSelection(BasicTableUI.java:510)
at javax.swing.plaf.basic.BasicTableUI$MouseInputHandler.mousePressed(BasicTableUI.java:494)
at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:222)
at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:221)
at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:221)
at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:221)
at java.awt.Component.processMouseEvent(Component.java:5097)
at java.awt.Component.processEvent(Component.java:4897)

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
bino_george
Offline
Joined: 2003-06-16

Hi Siva,
Could you please file a bug with a suitable testcase that reproduces the bug. I will look into this
problem. Thanks,

Regards,
Bino.

siva
Offline
Joined: 2003-07-15

Issue 120 has been logged for this with a testcase.

https://jdnc.dev.java.net/issues/show_bug.cgi?id=120