You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2015/07/27 23:45:46 UTC

svn commit: r1692957 - /uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/CasCopier.java

Author: schor
Date: Mon Jul 27 21:45:46 2015
New Revision: 1692957

URL: http://svn.apache.org/r1692957
Log:
[UIMA-4541] fix cas copier test for documentAnnotation to support use case of combining copyFS and copyView (multiple times with one CasCopier instance).

Modified:
    uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/CasCopier.java

Modified: uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/CasCopier.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/CasCopier.java?rev=1692957&r1=1692956&r2=1692957&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/CasCopier.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/CasCopier.java Mon Jul 27 21:45:46 2015
@@ -360,7 +360,6 @@ public class CasCopier {
     Iterator<CAS> viewIterator = aSrcCas.getViewIterator();
     while (viewIterator.hasNext()) {
       CAS view = viewIterator.next();
-      copier.srcCasDocumentAnnotation = 0;  // each view needs to get this once
       copier.copyCasView(view, aCopySofa); 
 
     }
@@ -494,6 +493,8 @@ public class CasCopier {
       throw new UIMARuntimeException(UIMARuntimeException.UNSUPPORTED_CAS_COPY_TO_OR_FROM_BASE_CAS, null);
     }
     
+    srcCasDocumentAnnotation = 0;  // each view needs to get this once
+    
 //    mLowLevelDestCas = aTgtCasView.getLowLevelCAS();
 //    mLowLevelSrcCas = aSrcCasView.getLowLevelCAS();
     
@@ -604,6 +605,8 @@ public class CasCopier {
       tgtCasViewImpl = originalTgtCasImpl;
     }
     
+    // safety - insure DocumentAnnotation is tested.
+    srcCasDocumentAnnotation = 0;  
     return copyFs2Fs(aFS);
   }
   
@@ -658,6 +661,7 @@ public class CasCopier {
     // same Sofa ID in the target CAS. If it does not exist it will be created.
     if (srcTypeCode == srcSofaTypeCode) {
       String destSofaId = getDestSofaId(srcCasViewImpl.ll_getSofaID(aFS));
+      // note: not put into the mFsMap, because each view needs a separate copy
       return ((CASImpl)getOrCreateView(originalTgtCas, destSofaId)).getSofaRef();
     }
 
@@ -689,6 +693,7 @@ public class CasCopier {
           }
         }
       }
+      // note note put into mFsMap, because each view needs a separate copy
       return destDocAnnot;
     }