[ https://java.net/jira/browse/GLAZEDLISTS-499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=393982#comment-393982 ] fabian_ commented on GLAZEDLISTS-499: ------------------------------------- I got a bit further here, and got a new, even simpler failing testcase: @Test public void testAllPossibleGrouperStateChanges_FixMe() { final TransactionList<String> source = new TransactionList<String>(new BasicEventList<String>()); final UniqueList<String> uniqueList = new UniqueList<String>(source, String.CASE_INSENSITIVE_ORDER); ListConsistencyListener.install(uniqueList); source.add("A"); source.add("A"); source.add("B"); source.beginEvent(); source.set(0, "B"); source.set(1, "B"); source.commitEvent(); assertEquals(source, GlazedListsTests.stringToList("BBB")); assertEquals(GlazedListsTests.stringToList("B"), uniqueList); } The problem lies in Grouper on line 179. If the todoList is also adjusted by 2 instead of 1, some tests work. > GroupingList is throwing an npe > ------------------------------- > > Key: GLAZEDLISTS-499 > URL: https://java.net/jira/browse/GLAZEDLISTS-499 > Project: glazedlists > Issue Type: Bug > Components: core > Affects Versions: current > Environment: Operating System: All > Platform: All > Reporter: vgoldshteyn > Priority: Blocker > Fix For: 1.10.0 > > > This problem might be related to the > https://glazedlists.dev.java.net/issues/show_bug.cgi?id=491. > below is a modified case that breaks the latest build with the patch for issue > 491. > thanks for your help > package sandbox; > import java.util.Comparator; > import junit.framework.TestCase; > import ca.odell.glazedlists.BasicEventList; > import ca.odell.glazedlists.GroupingList; > import ca.odell.glazedlists.TransactionList; > public class test extends TestCase > { > protected void setUp() throws Exception > { > super.setUp(); > } > protected void tearDown() throws Exception > { > super.tearDown(); > } > public void testIt() > { > TransactionList<String> source = new TransactionList<String>(new > BasicEventList<String>()); > Comparator<String> comparator = new StringPrefixComparator(1); > GroupingList<String> grouped = new GroupingList<String>(source, > comparator); > String[] s = new > String[]{"MSFT","MSFT","IBM","C","IBM","C","C","IBM","IBM","C"}; > String[] upd = new > String[]{"MSFT","MSFT","MSFT","C","C","IBM","IBM","IBM","C","MSFT"}; > > for( int i = 0; i < s.length; i++ ) > source.add(s[i]); > System.out.println(grouped.toString()); > source.beginEvent(); > for (int i = 0; i < upd.length; i++) > source.set(i, upd[i]); > source.commitEvent(); > System.out.println(grouped.toString()); > } > private static class StringPrefixComparator implements > Comparator<String> > { > private final int prefixLen; > public StringPrefixComparator(int prefixLen) > { > this.prefixLen = prefixLen; > } > public int compare(String o1, String o2) > { > return o1.substring(0, > prefixLen).compareTo(o2.substring(0, prefixLen)); > } > } > } -- This message was sent by Atlassian JIRA (v6.2.3#6260) |
Free forum by Nabble | Edit this page |