Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Apparently, in some cases, a FSIterator becomes invalid/looses its position after a copy(). Unfortunately, I haven't been able to quickly create a plain UIMA test case (I tried reproducing the effect in GetAllIndexedTest, but couldn't.
So the following snipped is works (fails) when pasted into the uimaFIT CasUtilTest after upgrading uimaFIT to 2.8.0 RC 1:
@Test public void lala() throws Exception { String text = "Rot wood cheeses dew?"; tokenBuilder.buildTokens(jCas, text); CAS cas = jCas.getCas(); // Option 1: remove the ".copy()" FSIterator<FeatureStructure> fses = cas.getIndexRepository() .getAllIndexedFS(cas.getTypeSystem().getTopType()).copy(); // Option 2: explicitly moveToFirst // fses.moveToFirst(); int i = 0; while (fses.hasNext()) { fses.next(); i++; } assertEquals(6, i); }
Maybe you have some idea or can highlight another UIMA core test case where this could be conveniently tried out. (Unfortunately, setting up a test CAS in plain UIMA is a bit painful/verbose)