Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.7.0
    • Fix Version/s: milestone 1
    • Component/s: core
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      447

      Description

      see for example testcase EventTableViewerTest.guiTestClearOnThreadProxy_FixMe()

      stacktrace of failing test:

      java.lang.RuntimeException: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
      at
      ca.odell.glazedlists.GuiTestCase$ExecuteGuiTestsRunnable.run(GuiTestCase.java:116)
      at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:152)
      at org.eclipse.swt.widgets.Display.syncExec(Display.java:4097)
      at ca.odell.glazedlists.swt.SwtTestCase.executeOnGUIThread(SwtTestCase.java:40)
      at ca.odell.glazedlists.GuiTestCase.testGui(GuiTestCase.java:47)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at junit.framework.TestCase.runTest(TestCase.java:164)
      at junit.framework.TestCase.runBare(TestCase.java:130)
      at junit.framework.TestResult$1.protect(TestResult.java:106)
      at junit.framework.TestResult.runProtected(TestResult.java:124)
      at junit.framework.TestResult.run(TestResult.java:109)
      at junit.framework.TestCase.run(TestCase.java:120)
      at junit.framework.TestSuite.runTest(TestSuite.java:230)
      at junit.framework.TestSuite.run(TestSuite.java:225)
      at
      org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      at
      org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
      at
      org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
      at
      org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
      at
      org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
      Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
      at java.util.ArrayList.RangeCheck(ArrayList.java:547)
      at java.util.ArrayList.remove(ArrayList.java:387)
      at ca.odell.glazedlists.BasicEventList.remove(BasicEventList.java:172)
      at ca.odell.glazedlists.TransformedList.remove(TransformedList.java:111)
      at ca.odell.glazedlists.impl.SimpleIterator.remove(SimpleIterator.java:62)
      at ca.odell.glazedlists.AbstractEventList.clear(AbstractEventList.java:424)
      at ca.odell.glazedlists.TransformedList.clear(TransformedList.java:95)
      at
      ca.odell.glazedlists.swt.EventTableViewerTest.guiTestClearOnThreadProxy_FixMe(EventTableViewerTest.java:389)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at
      ca.odell.glazedlists.GuiTestCase$ExecuteGuiTestsRunnable.run(GuiTestCase.java:112)
      ... 22 more

        Activity

        Hide
        brands added a comment -
            • Issue 374 has been marked as a duplicate of this issue. ***
        Show
        brands added a comment - Issue 374 has been marked as a duplicate of this issue. ***
        Show
        brands added a comment - Reported problems: http://www.nabble.com/clear%28%29-throws-IndexOutOfBoundsException-from-SwingThreadProxyEventList-to4895197.html#a4896931 http://www.nabble.com/Remove-all-items-from-EventTableViewer-to16732688.html#a16732688
        Hide
        brands added a comment -

        Calling clear() on ThreadProxyList calls TransformedList.clear() :
        public void clear() {
        // nest changes and let the other methods compose the event
        updates.beginEvent(true);
        try

        { super.clear(); // AbstractEventList.clear() }

        finally

        { updates.commitEvent(); }

        }

        AbstractEventList.clear() uses SimpleIterator to remove the list elements one by
        one. SimpleIterator uses source.size() to implement hasNext() method.

        But ThreadProxylist.size() returns the size of the local cache, which is only
        updated after commitEvent. So SimpleIterator sees the old wrong list size and
        iterates "too far"...

        Show
        brands added a comment - Calling clear() on ThreadProxyList calls TransformedList.clear() : public void clear() { // nest changes and let the other methods compose the event updates.beginEvent(true); try { super.clear(); // AbstractEventList.clear() } finally { updates.commitEvent(); } } AbstractEventList.clear() uses SimpleIterator to remove the list elements one by one. SimpleIterator uses source.size() to implement hasNext() method. But ThreadProxylist.size() returns the size of the local cache, which is only updated after commitEvent. So SimpleIterator sees the old wrong list size and iterates "too far"...
        Hide
        jessewilson added a comment -

        James came through town and convinced me to fix this!

        We ended up making ThreadProxyEventList apply changes to its own cache more eagerly.

        Show
        jessewilson added a comment - James came through town and convinced me to fix this! We ended up making ThreadProxyEventList apply changes to its own cache more eagerly.

          People

          • Assignee:
            jessewilson
            Reporter:
            brands
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: