Richard Eckart de Castilho created UIMA-4487:
------------------------------------------------
Summary: Position lost on FSIterator copy
Key: UIMA-4487
URL: https://issues.apache.org/jira/browse/UIMA-4487
Project: UIMA
Issue Type: Bug
Components: Core Java Framework
Reporter: Richard Eckart de Castilho
Fix For: 2.8.0SDK
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:
{noformat}
@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);
}
{noformat}
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)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)