-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
6
-
x86
-
linux
FULL PRODUCT VERSION :
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Ubuntu 7.04
A DESCRIPTION OF THE PROBLEM :
I made a Table with a fixed first row with a rowHeader(JTable) and a JTable for the rest iof the colums as described in o'reillys Java Swing 2nd edition.
without rowsorting actually enabled it just wored fine.
When I do sort a row and update (insert a row) in the underlying tablemodel I get these error.
It seems that the row sorter gets notified from both JTables.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
compile and run.
1. insert a row
2. selecting a row to sort (mouseclick on the column header)
3. inserting an other row
error occured!
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
a sorted table
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "AWT-EventQueue-0" Index: 1
java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at TableTest$TableModel.getValueAt(TableTest.java:93)
at javax.swing.table.TableRowSorter$TableRowSorterModelWrapper.getValueAt(TableRowSorter.java:252)
at javax.swing.DefaultRowSorter.compare(DefaultRowSorter.java:938)
at javax.swing.DefaultRowSorter.access$100(DefaultRowSorter.java:95)
at javax.swing.DefaultRowSorter$Row.compareTo(DefaultRowSorter.java:1359)
at javax.swing.DefaultRowSorter$Row.compareTo(DefaultRowSorter.java:1349)
at java.util.Arrays.binarySearch0(Arrays.java:2001)
at java.util.Arrays.binarySearch(Arrays.java:1943)
at javax.swing.DefaultRowSorter.insertInOrder(DefaultRowSorter.java:983)
at javax.swing.DefaultRowSorter.rowsInserted0(DefaultRowSorter.java:1041)
at javax.swing.DefaultRowSorter.rowsInserted(DefaultRowSorter.java:851)
at javax.swing.JTable.notifySorter(JTable.java:4221)
at javax.swing.JTable.sortedTableChanged(JTable.java:4069)
at javax.swing.JTable.tableChanged(JTable.java:4346)
at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
at javax.swing.table.AbstractTableModel.fireTableRowsInserted(AbstractTableModel.java:215)
at TableTest$TableModel.insertNew(TableTest.java:105)
at TableTest$1.actionPerformed(TableTest.java:155)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6038)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at javax.swing.DefaultRowSorter.convertRowIndexToModel(DefaultRowSorter.java:501)
at javax.swing.JTable.convertRowIndexToModel(JTable.java:2577)
at javax.swing.JTable.getValueAt(JTable.java:2652)
at javax.swing.JTable.prepareRenderer(JTable.java:5666)
at javax.swing.plaf.basic.BasicTableUI.paintCell(BasicTableUI.java:2067)
at javax.swing.plaf.basic.BasicTableUI.paintCells(BasicTableUI.java:1969)
at javax.swing.plaf.basic.BasicTableUI.paint(BasicTableUI.java:1765)
at javax.swing.plaf.ComponentUI.update(ComponentUI.java:143)
at javax.swing.JComponent.paintComponent(JComponent.java:758)
at javax.swing.JComponent.paint(JComponent.java:1022)
at javax.swing.JComponent.paintChildren(JComponent.java:859)
at javax.swing.JComponent.paint(JComponent.java:1031)
at javax.swing.JViewport.paint(JViewport.java:747)
at javax.swing.JComponent.paintChildren(JComponent.java:859)
at javax.swing.JComponent.paint(JComponent.java:1031)
at javax.swing.JComponent.paintToOffscreen(JComponent.java:5104)
at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:285)
at javax.swing.RepaintManager.paint(RepaintManager.java:1132)
at javax.swing.JComponent._paintImmediately(JComponent.java:5052)
at javax.swing.JComponent.paintImmediately(JComponent.java:4862)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:727)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:683)
at javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:663)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:128)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Attached seperatly
---------- END SOURCE ----------
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Ubuntu 7.04
A DESCRIPTION OF THE PROBLEM :
I made a Table with a fixed first row with a rowHeader(JTable) and a JTable for the rest iof the colums as described in o'reillys Java Swing 2nd edition.
without rowsorting actually enabled it just wored fine.
When I do sort a row and update (insert a row) in the underlying tablemodel I get these error.
It seems that the row sorter gets notified from both JTables.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
compile and run.
1. insert a row
2. selecting a row to sort (mouseclick on the column header)
3. inserting an other row
error occured!
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
a sorted table
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "AWT-EventQueue-0" Index: 1
java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at TableTest$TableModel.getValueAt(TableTest.java:93)
at javax.swing.table.TableRowSorter$TableRowSorterModelWrapper.getValueAt(TableRowSorter.java:252)
at javax.swing.DefaultRowSorter.compare(DefaultRowSorter.java:938)
at javax.swing.DefaultRowSorter.access$100(DefaultRowSorter.java:95)
at javax.swing.DefaultRowSorter$Row.compareTo(DefaultRowSorter.java:1359)
at javax.swing.DefaultRowSorter$Row.compareTo(DefaultRowSorter.java:1349)
at java.util.Arrays.binarySearch0(Arrays.java:2001)
at java.util.Arrays.binarySearch(Arrays.java:1943)
at javax.swing.DefaultRowSorter.insertInOrder(DefaultRowSorter.java:983)
at javax.swing.DefaultRowSorter.rowsInserted0(DefaultRowSorter.java:1041)
at javax.swing.DefaultRowSorter.rowsInserted(DefaultRowSorter.java:851)
at javax.swing.JTable.notifySorter(JTable.java:4221)
at javax.swing.JTable.sortedTableChanged(JTable.java:4069)
at javax.swing.JTable.tableChanged(JTable.java:4346)
at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
at javax.swing.table.AbstractTableModel.fireTableRowsInserted(AbstractTableModel.java:215)
at TableTest$TableModel.insertNew(TableTest.java:105)
at TableTest$1.actionPerformed(TableTest.java:155)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6038)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at javax.swing.DefaultRowSorter.convertRowIndexToModel(DefaultRowSorter.java:501)
at javax.swing.JTable.convertRowIndexToModel(JTable.java:2577)
at javax.swing.JTable.getValueAt(JTable.java:2652)
at javax.swing.JTable.prepareRenderer(JTable.java:5666)
at javax.swing.plaf.basic.BasicTableUI.paintCell(BasicTableUI.java:2067)
at javax.swing.plaf.basic.BasicTableUI.paintCells(BasicTableUI.java:1969)
at javax.swing.plaf.basic.BasicTableUI.paint(BasicTableUI.java:1765)
at javax.swing.plaf.ComponentUI.update(ComponentUI.java:143)
at javax.swing.JComponent.paintComponent(JComponent.java:758)
at javax.swing.JComponent.paint(JComponent.java:1022)
at javax.swing.JComponent.paintChildren(JComponent.java:859)
at javax.swing.JComponent.paint(JComponent.java:1031)
at javax.swing.JViewport.paint(JViewport.java:747)
at javax.swing.JComponent.paintChildren(JComponent.java:859)
at javax.swing.JComponent.paint(JComponent.java:1031)
at javax.swing.JComponent.paintToOffscreen(JComponent.java:5104)
at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:285)
at javax.swing.RepaintManager.paint(RepaintManager.java:1132)
at javax.swing.JComponent._paintImmediately(JComponent.java:5052)
at javax.swing.JComponent.paintImmediately(JComponent.java:4862)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:727)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:683)
at javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:663)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:128)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Attached seperatly
---------- END SOURCE ----------