[
https://issues.apache.org/jira/browse/UIMA-6352?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Richard Eckart de Castilho updated UIMA-6352:
---------------------------------------------
Description:
The {{CASCompleteSerializer}} consists of a {{CASMgrSerializer}} and a
{{CASSerializer}}. However, {{CAS.reinit(CASCompleteSerializer)}} does not
fully include the behavior of {{CAS.reinit(CASMgrSerializer)}} - in particular
the index repositories in {{baseCas.svd.sofa2indexMap}} are not cleared. Since
the {{CAS.reinit(CASCompleteSerializer)}} can replace the type system in the
CAS, this can cause the {{TypeSystem}} and {{Type}} instances used in the CAS
to be out-of-sync with the respective instances used in the
{{FSIndexRepository}} instances stored in {{baseCas.svd.sofa2indexMap}}.
This test illustrates the problem:
{code}
@Test
public void thatReplacingTypeSystemInCasWorks() throws Exception {
System.setProperty("uima.enable_strict_type_source_check", "true");
CAS cas = CasCreationUtils.createCas();
cas.setDocumentText("First view text");
cas.createView("secondView").setDocumentText("Second view text");
TypeSystem originalTypeSystem = cas.getTypeSystem();
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
serializeWithCompression(cas, buffer, originalTypeSystem);
TypeSystemDescription newTSD = new TypeSystemDescription_impl();
newTSD.addType("my.Type", "", CAS.TYPE_NAME_ANNOTATION);
CAS tempCas = createCas(newTSD, null, null, null);
CASCompleteSerializer serializer = serializeCASComplete((CASImpl) tempCas);
deserializeCASComplete(serializer, (CASImpl) cas);
load(new ByteArrayInputStream(buffer.toByteArray()), cas,
originalTypeSystem);
}
{code}
was:The {{CASCompleteSerializer}} consists of a {{CASMgrSerializer}} and a
{{CASSerializer}}. However, {{CAS.reinit(CASCompleteSerializer)}} does not
fully include the behavior of {{CAS.reinit(CASMgrSerializer)}} - in particular
the index repositories in {{baseCas.svd.sofa2indexMap}} are not cleared. Since
the {{CAS.reinit(CASCompleteSerializer)}} can replace the type system in the
CAS, this can cause the {{TypeSystem}} and {{Type}} instances used in the CAS
to be out-of-sync with the respective instances used in the
{{FSIndexRepository}} instances stored in {{baseCas.svd.sofa2indexMap}}.
> reinit(CASCompleteSerializer) does not properly reset indexes
> -------------------------------------------------------------
>
> Key: UIMA-6352
> URL: https://issues.apache.org/jira/browse/UIMA-6352
> Project: UIMA
> Issue Type: Bug
> Components: Core Java Framework
> Affects Versions: 3.1.1SDK
> Reporter: Richard Eckart de Castilho
> Assignee: Richard Eckart de Castilho
> Priority: Major
> Fix For: 3.2.0SDK
>
>
> The {{CASCompleteSerializer}} consists of a {{CASMgrSerializer}} and a
> {{CASSerializer}}. However, {{CAS.reinit(CASCompleteSerializer)}} does not
> fully include the behavior of {{CAS.reinit(CASMgrSerializer)}} - in
> particular the index repositories in {{baseCas.svd.sofa2indexMap}} are not
> cleared. Since the {{CAS.reinit(CASCompleteSerializer)}} can replace the type
> system in the CAS, this can cause the {{TypeSystem}} and {{Type}} instances
> used in the CAS to be out-of-sync with the respective instances used in the
> {{FSIndexRepository}} instances stored in {{baseCas.svd.sofa2indexMap}}.
> This test illustrates the problem:
> {code}
> @Test
> public void thatReplacingTypeSystemInCasWorks() throws Exception {
> System.setProperty("uima.enable_strict_type_source_check", "true");
>
> CAS cas = CasCreationUtils.createCas();
> cas.setDocumentText("First view text");
> cas.createView("secondView").setDocumentText("Second view text");
> TypeSystem originalTypeSystem = cas.getTypeSystem();
> ByteArrayOutputStream buffer = new ByteArrayOutputStream();
> serializeWithCompression(cas, buffer, originalTypeSystem);
>
> TypeSystemDescription newTSD = new TypeSystemDescription_impl();
> newTSD.addType("my.Type", "", CAS.TYPE_NAME_ANNOTATION);
>
> CAS tempCas = createCas(newTSD, null, null, null);
> CASCompleteSerializer serializer = serializeCASComplete((CASImpl)
> tempCas);
> deserializeCASComplete(serializer, (CASImpl) cas);
>
> load(new ByteArrayInputStream(buffer.toByteArray()), cas,
> originalTypeSystem);
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)