This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 269577

Summary: sqleditor corrupts data
Product: db Reporter: Aleksej
Component: SQL EditorAssignee: matthias42
Status: RESOLVED FIXED    
Severity: normal    
Priority: P1    
Version: 8.2   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:
Attachments: an example of an error

Description Aleksej 2017-01-17 07:28:51 UTC
Created attachment 163408 [details]
an example of an error

If you enable sorting, editing of a single line corrupts the data in other rows. Read more watch the video.
Comment 1 matthias42 2017-01-17 18:34:25 UTC
At this point I only have time for the analysis: 

The problem is located in StringTableCellEditor. On each keystroke the current value is committed to the table (lines 110-112):

                if (tc != null && ks.isOnKeyRelease()) {
                    table.getModel().setValueAt(tc.getText(), table.convertRowIndexToModel(row), table.convertColumnIndexToModel(column));
                }

This looks wrong from different perspectives - the intersting question: What was the reason for this implementation?

To give some more perspective of the consequences of this bug (yes this stays P1):

- You have to sort the table base on the column you are editing
- Editing has to change the order of the table
- All changes are reflected to the user in the GUI (so the issue can be worked around)
- Only data in the modified column is affected
Comment 2 Aleksej 2017-01-18 04:57:43 UTC
This problem appeared in version Netbeans 8.0. In earlier versions this was not. I understand the cause of the error. It is easy to fix. I'd like to see this bug fixed in the new version of Netbeans, and other users have not encountered this problem. How soon this issue will fix?
Comment 3 matthias42 2017-01-18 21:26:44 UTC
Thank you for reporting this. A fix was pushed as:

http://hg.netbeans.org/core-main/rev/dd9ce04ed357

In the next few days a nightly build will become available that contains the fix. By then a message will be appended to this bug.

Please grab that nightly or a later one and check if you agree that it is fixed. If you find it fixed, change the status to VERIFIED.
Comment 4 Quality Engineering 2017-03-23 02:47:42 UTC
Integrated into 'main-silver', will be available in build *201703230002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/dd9ce04ed357
User: Matthias Blaesing <matthias42@netbeans.org>
Log: #269577: Don't modify table model directly and use normal TableCellEditor config

processKeyBinding modified the TableModel directly instead of relying on the
Swing TableCellEditor mechanism.

Tested:
- Normal editing in input line
- Copy/Pasting into/from input line
- editing input line and opening textarea dialog initalizes the textarea with input line