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 231218 - IndexOutOfBoundsException: valid viewIndex: 0 <= index < 0 but was: -1
Summary: IndexOutOfBoundsException: valid viewIndex: 0 <= index < 0 but was: -1
Status: RESOLVED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: Code (show other bugs)
Version: 7.4
Hardware: All All
: P3 normal (vote)
Assignee: Jiri Rechtacek
URL:
Keywords: NETFIX, PATCH_AVAILABLE
Depends on:
Blocks:
 
Reported: 2013-06-13 13:49 UTC by Maksim Khramov
Modified: 2013-06-18 14:49 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter: 201391


Attachments
stacktrace (3.16 KB, text/plain)
2013-06-13 13:49 UTC, Maksim Khramov
Details
proposed patch v1 (5.06 KB, patch)
2013-06-14 20:16 UTC, matthias42
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Maksim Khramov 2013-06-13 13:49:52 UTC
Build: NetBeans IDE Dev (Build 201306122301)
VM: Java HotSpot(TM) 64-Bit Server VM, 23.25-b01, Java(TM) SE Runtime Environment, 1.7.0_25-b13
OS: Windows 7

User Comments:
mkhramov: SQL Copy Cell value command invoked on empty cell




Stacktrace: 
java.lang.IndexOutOfBoundsException: valid viewIndex: 0 <= index < 0 but was: -1
   at org.jdesktop.swingx.sort.DefaultSortController.convertRowIndexToModel(DefaultSortController.java:311)
   at javax.swing.JTable.convertRowIndexToModel(JTable.java:2641)
   at javax.swing.JTable.getValueAt(JTable.java:2716)
   at org.netbeans.modules.db.dataview.output.DataViewTableUI$7.actionPerformed(DataViewTableUI.java:381)
   at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
   at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
Comment 1 Maksim Khramov 2013-06-13 13:49:55 UTC
Created attachment 135757 [details]
stacktrace
Comment 2 matthias42 2013-06-14 20:16:16 UTC
Created attachment 135820 [details]
proposed patch v1

The patches fixes the problem by disabling the actions in the menu when no row is selected. I included other menu entries that just turn to no-ops when invoked without a selection, so that this looks and feels consistent.
Comment 3 Jaroslav Havlin 2013-06-17 09:33:58 UTC
Applied as http://hg.netbeans.org/core-main/rev/73af42a196d5
Thank you for the patch, Matthias.
Comment 4 Jaroslav Havlin 2013-06-17 13:12:48 UTC
http://hg.netbeans.org/core-main/rev/071dc065358f
I'm sorry, I've had to revert part of the patch. Some listeners, e.g. TableSelectionListener, were notified before the MouseListener that updates field selectedRows.
Comment 5 Quality Engineering 2013-06-18 14:49:46 UTC
Integrated into 'main-golden', will be available in build *201306181109* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/73af42a196d5
User: Jaroslav Havlin <jhavlin@netbeans.org>
Log: #231218: IndexOutOfBoundsException: valid viewIndex: 0 <= index < 0 but was: -1

Patch by Matthias42.