Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
3.1.1SDK
-
None
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:
@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); }
Attachments
Issue Links
- links to