|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
[Issue 475] New - IndexOutOfBoundsException when changing a filter using a JideTable under 1.8.0https://glazedlists.dev.java.net/issues/show_bug.cgi?id=475
Issue #|475 Summary|IndexOutOfBoundsException when changing a filter using | a JideTable under 1.8.0 Component|glazedlists Version|current Platform|PC OS/Version|other URL| Status|NEW Status whiteboard| Keywords| Resolution| Issue type|DEFECT Priority|P3 Subcomponent|swing Assigned to|jessewilson Reported by|actualsystems ------- Additional comments from actualsystems@... Wed May 27 14:58:50 +0000 2009 ------- Our test case uses JideTable from the Jide grids package: (http://www.jidesoft.com/javadoc/com/jidesoft/grid/JideTable.html) (jide-grids.jar and jide-common.jar). Tested using Windows Vista and a 32-bit JVM (1.6) and Jide-grids.jar version (from the MANIFEST.MF) Jide-Version: 2.1.2.02 The following test case reproduces the problem, and changing t from being a JideTable to a JTable causes it not to occur. This test case works under GlazedLists 1.7.0. import ca.odell.glazedlists.*; import ca.odell.glazedlists.gui.TableFormat; import ca.odell.glazedlists.swing.*; import com.jidesoft.grid.JideTable; import javax.swing.*; import javax.swing.text.JTextComponent; import java.awt.*; import java.lang.reflect.InvocationTargetException; import java.util.List; /** * Test for a bug in Glazed Lists filtering * If a selection is on the screen, and the filter changes so that the selected row index no longer exists, * we get an IndexOutOfBoundsException */ public class TestFilterBug implements Runnable { private static final EventList<String> base = new DebugList<String>(); public static void main(String[] args) throws InvocationTargetException, InterruptedException { SwingUtilities.invokeLater(new TestFilterBug()); Thread.sleep(500); // show window base.getReadWriteLock().writeLock().lock(); try { base.add("C"); base.add("B"); base.add("A"); } finally { base.getReadWriteLock().writeLock().unlock(); } } public void run() { try { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTable t = new JideTable(); f.getContentPane().setLayout(new BorderLayout()); JTextComponent filter = new JTextField(); f.getContentPane().add(filter, BorderLayout.NORTH); f.getContentPane().add(new JScrollPane(t), BorderLayout.CENTER); FilterList<String> filtered = new FilterList<String>(base, new TextComponentMatcherEditor<String>(filter, new TextFilterator<String>() { public void getFilterStrings(List<String> baseList, String element) { baseList.add(element); } })); f.pack(); t.setModel(new EventTableModel<String>(filtered, new TableFormat<String>() { public int getColumnCount() { return 3; } public String getColumnName(int column) { return "X"; } public Object getColumnValue(String baseObject, int column) { return baseObject + column; } })); t.setSelectionModel(new EventSelectionModel<String>(filtered)); f.setVisible(true); Thread.sleep(1000); // wait for list t.getSelectionModel().setSelectionInterval(2, 2); filter.setText("X"); } catch (Throwable t) { System.out.println(t.getMessage()); t.printStackTrace(); System.exit(0); } } } Program output: Index: 2, Size: 0 java.lang.IndexOutOfBoundsException: Index: 2, Size: 0 at java.util.ArrayList.RangeCheck(ArrayList.java:547) at java.util.ArrayList.get(ArrayList.java:322) at ca.odell.glazedlists.impl.gui.ThreadProxyEventList.get(ThreadProxyEventList.java:136) at ca.odell.glazedlists.ListSelection.setAllColor(ListSelection.java:544) at ca.odell.glazedlists.ListSelection.deselectAll(ListSelection.java:524) at ca.odell.glazedlists.ListSelection.setAnchorSelectionIndex(ListSelection.java:799) at ca.odell.glazedlists.swing.EventSelectionModel.setAnchorSelectionIndex(EventSelectionModel.java:314) at com.jidesoft.grid.JideTable.d(Unknown Source) at com.jidesoft.grid.JideTable.b(Unknown Source) at com.jidesoft.grid.JideTable.tableChanged(Unknown Source) at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280) at ca.odell.glazedlists.swing.EventTableModel.handleListChange(EventTableModel.java:189) at ca.odell.glazedlists.swing.EventTableModel.listChanged(EventTableModel.java:170) at ca.odell.glazedlists.event.ListEventAssembler$ListEventFormat.fire(ListEventAssembler.java:412) at ca.odell.glazedlists.event.ListEventAssembler$ListEventFormat.fire(ListEventAssembler.java:409) at ca.odell.glazedlists.event.SequenceDependenciesEventPublisher$SubjectAndListener.firePendingEvent(SequenceDependenciesEventPublisher.java:445) at ca.odell.glazedlists.event.SequenceDependenciesEventPublisher.fireEvent(SequenceDependenciesEventPublisher.java:344) at ca.odell.glazedlists.event.ListEventAssembler.commitEvent(ListEventAssembler.java:316) at ca.odell.glazedlists.FilterList.constrained(FilterList.java:389) at ca.odell.glazedlists.FilterList.changeMatcher(FilterList.java:286) at ca.odell.glazedlists.FilterList.changeMatcherWithLocks(FilterList.java:269) at ca.odell.glazedlists.FilterList.access$100(FilterList.java:51) at ca.odell.glazedlists.FilterList$PrivateMatcherEditorListener.changedMatcher(FilterList.java:443) at ca.odell.glazedlists.matchers.AbstractMatcherEditor.fireChangedMatcher(AbstractMatcherEditor.java:115) at ca.odell.glazedlists.matchers.AbstractMatcherEditor.fireConstrained(AbstractMatcherEditor.java:73) at ca.odell.glazedlists.matchers.TextMatcherEditor.setTextMatcher(TextMatcherEditor.java:321) at ca.odell.glazedlists.matchers.TextMatcherEditor.setFilterText(TextMatcherEditor.java:292) at ca.odell.glazedlists.swing.TextComponentMatcherEditor.refilter(TextComponentMatcherEditor.java:209) at ca.odell.glazedlists.swing.TextComponentMatcherEditor.access$100(TextComponentMatcherEditor.java:44) at ca.odell.glazedlists.swing.TextComponentMatcherEditor$FilterHandler.insertUpdate(TextComponentMatcherEditor.java:221) at javax.swing.text.AbstractDocument.fireInsertUpdate(AbstractDocument.java:185) at javax.swing.text.AbstractDocument.handleInsertString(AbstractDocument.java:734) at javax.swing.text.AbstractDocument.insertString(AbstractDocument.java:693) at javax.swing.text.PlainDocument.insertString(PlainDocument.java:114) at javax.swing.text.AbstractDocument.replace(AbstractDocument.java:655) at javax.swing.text.JTextComponent.setText(JTextComponent.java:1693) at com.actual_systems.p2.client.GUI.workordermanager.TestFilterBug.run(TestFilterBug.java:86) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) at java.awt.EventQueue.dispatchEvent(EventQueue.java:597) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161) at java.awt.EventDispatchThread.run(EventDispatchThread.java:122) Process finished with exit code 0 --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscribe@... For additional commands, e-mail: issues-help@... |
| Free embeddable forum powered by Nabble | Forum Help |