[
https://issues.apache.org/jira/browse/UIMA-5601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16190302#comment-16190302
]
Richard Eckart de Castilho commented on UIMA-5601:
--------------------------------------------------
I think UIMA should continue to behave as it does not: create an instance of
whatever DocumentAnnotation is in this special JAR file. If that annotation is
deleted by client code and another instance of DocumentAnnotation or of a
subclass of DocumentAnnotation is added to the CAS, that should be returned by
getDocumentAnnotation().
If might be a good idea to thrown an exception if a second instance of a
DocumentAnnotation (or subclass) is added.
* The CASCopier should not create a new DocumentAnnotation if the target CAS
already contains one.
* If it does not contain one, it should create a default one.
* If the CASCopier is used to copy the annotation returned from
getDocumentAnnotation() in the source CAS to the target CAS, then a potentially
previously created default instance of DocumentAnnotation in the target CAS
should be replaced with the copied instance.
> uv3: CasCopier problems with custom subclasses of DocumentAnnotation
> --------------------------------------------------------------------
>
> Key: UIMA-5601
> URL: https://issues.apache.org/jira/browse/UIMA-5601
> Project: UIMA
> Issue Type: Bug
> Components: Core Java Framework
> Affects Versions: 3.0.0SDK-beta
> Reporter: Richard Eckart de Castilho
>
> It seems as if there may be a bug in the way that CasCopier handles the
> documen annotation.
> Specifically, it seems as if the CasCopier incorrectly handles the case where
> the target CAS already contains a document annotation. In my case, I do:
> * create the target CAS
> * add a document annotation (DocumentMetaData extends DocumentAnnotation) to
> the target CAS
> * create the CasCopier with the source and target CAS
> * copy several FSes but *not* the document annotation
> Expected:
> * target CAS contains 1 DocumentMetaData annotation
> Actual
> * target CAS contains 2 DocumentMetaData annotation
> Also, it seems that `isDocumentAnnotation` may not able to handle it if a CAS
> uses a custom subclass of DocumentAnnotation:
> {noformat}
> private <T extends FeatureStructure> boolean isDocumentAnnotation(T aFS) {
> if (((TOP)aFS)._getTypeCode() != TypeSystemConstants.docTypeCode) {
> return false;
> }
> if (srcCasDocumentAnnotation == null) {
> srcCasDocumentAnnotation =
> srcCasViewImpl.getDocumentAnnotationNoCreate();
> }
> return aFS == srcCasDocumentAnnotation;
> }
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)