[Issue 453] New - SeparatorList incorrectly throws ConcurrentModificationException when setting comparator

View: New views
2 Messages — Rating Filter:   Alert me  

[Issue 453] New - SeparatorList incorrectly throws ConcurrentModificationException when setting comparator

by phustad-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

https://glazedlists.dev.java.net/issues/show_bug.cgi?id=453
                 Issue #|453
                 Summary|SeparatorList incorrectly throws ConcurrentModificatio
                        |nException when setting comparator
               Component|glazedlists
                 Version|current
                Platform|All
              OS/Version|All
                     URL|
                  Status|NEW
       Status whiteboard|
                Keywords|
              Resolution|
              Issue type|DEFECT
                Priority|P2
            Subcomponent|core
             Assigned to|jessewilson
             Reported by|phustad






------- Additional comments from phustad@... Mon Sep  8 11:00:00 +0000 2008 -------
When setting the comparator of a SeparatorList having a constrained
defaultLimit, the SeparatorList always throws a ConcurrentModificationException
as demonstrated by the Test Case. The CME was not detected by the standard
SeparatorListTest.testSetComparator, since this test has a defaultLimit equal to
Integer.MAX_VALUE.

  public void testSetComparatorWithLimit() {
        EventList<String> source = new BasicEventList<String>();
        source.addAll(GlazedListsTests.stringToList("AAaaaBBBBbCCCddd"));

        SeparatorList<String> separatorList = new SeparatorList<String>(source,
(Comparator)GlazedLists.caseInsensitiveComparator(), 0, 2);
        ListConsistencyListener<String> listConsistencyListener =
ListConsistencyListener.install(separatorList);
        listConsistencyListener.setPreviousElementTracked(false);

   
        separatorList.setComparator(new CaseComparator());
        // make list changes
        source.addAll(5, GlazedListsTests.stringToList("aaaA"));
        // change the comparator again
        separatorList.setComparator(GlazedLists.caseInsensitiveComparator());
       
    }

java.util.ConcurrentModificationException: Cannot begin a new event while
another event is in progress by thread, main
        at
ca.odell.glazedlists.event.ListEventAssembler$AssemblerHelper.beginEvent(ListEventAssembler.java:347)
        at
ca.odell.glazedlists.event.ListEventAssembler.beginEvent(ListEventAssembler.java:114)
        at ca.odell.glazedlists.SeparatorList.listChanged(SeparatorList.java:178)
        at
ca.odell.glazedlists.event.ListEventAssembler$ListSequencePublisherAdapter$ListEventFormat.fire(ListEventAssembler.java:781)
        at
ca.odell.glazedlists.event.ListEventAssembler$ListSequencePublisherAdapter$ListEventFormat.fire(ListEventAssembler.java:1)
        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$ListSequencePublisherAdapter.fireEvent(ListEventAssembler.java:767)
        at
ca.odell.glazedlists.event.ListEventAssembler$AssemblerHelper.commitEvent(ListEventAssembler.java:416)
        at
ca.odell.glazedlists.event.ListEventAssembler.commitEvent(ListEventAssembler.java:249)
        at ca.odell.glazedlists.SortedList.setComparator(SortedList.java:478)
        at ca.odell.glazedlists.SeparatorList.setComparator(SeparatorList.java:142)
        at
ca.odell.glazedlists.SeparatorListTest.testSetComparatorWithLimit(SeparatorListTest.java:671)
        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)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@...
For additional commands, e-mail: issues-help@...


[Issue 453] SeparatorList incorrectly throws ConcurrentModificationException when setting comparator

by phustad-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

https://glazedlists.dev.java.net/issues/show_bug.cgi?id=453



User phustad changed the following:

                What    |Old value                 |New value
================================================================================
     Attachment is patch|                          |Created an attachment (id=
                        |                          |40)
Proposed fix and test
                        |                          |case for issue 453

--------------------------------------------------------------------------------




------- Additional comments from phustad@... Tue Sep  9 09:58:02 +0000 2008 -------
Created an attachment (id=40)
Proposed fix and test case for issue 453


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@...
For additional commands, e-mail: issues-help@...

LightInTheBox - Buy quality products at wholesale price!