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 2013/05/22 16:48:07 UTC

svn commit: r1485234 - in /uima/uimaj/trunk/uimaj-core/src: main/java/org/apache/uima/cas/ main/java/org/apache/uima/cas/impl/ test/java/org/apache/uima/cas/impl/

Author: schor
Date: Wed May 22 14:48:06 2013
New Revision: 1485234

URL: http://svn.apache.org/r1485234
Log:
[UIMA-2791] support error reporting when setting up filtered type serialization, if target / src type systems are not compatible.  Add detection of equal type systems to CasTypeSystemMapper.  

Modified:
    uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/CAS.java
    uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes6.java
    uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
    uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasTypeSystemMapper.java
    uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java
    uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/impl/CasTypeSystemMapperTst.java
    uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/impl/SerDesTest6.java

Modified: uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/CAS.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/CAS.java?rev=1485234&r1=1485233&r2=1485234&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/CAS.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/CAS.java Wed May 22 14:48:06 2013
@@ -35,6 +35,7 @@ import org.apache.uima.cas.impl.BinaryCa
 import org.apache.uima.cas.text.AnnotationFS;
 import org.apache.uima.cas.text.AnnotationIndex;
 import org.apache.uima.jcas.JCas;
+import org.apache.uima.resource.ResourceInitializationException;
 
 /**
  * Object-oriented CAS (Common Analysis System) API.
@@ -1083,8 +1084,9 @@ public interface CAS extends AbstractCas
    * @param tgtTypeSystem null or a target TypeSystem, which must be mergable with this CAS's type system
    * @return information to be used on subsequent serializations (to save time) or deserializations (for receiving delta CASs) 
    * @throws IOException
+   * @throws ResourceInitializationException if target type system is incompatible with this CAS's type system
    */
-  public ReuseInfo serializeWithCompression(Object out, TypeSystem tgtTypeSystem) throws IOException;
+  public ReuseInfo serializeWithCompression(Object out, TypeSystem tgtTypeSystem) throws IOException, ResourceInitializationException;
   
   /**
    * @param out an OutputStream, a DataOutputStream, or a File
@@ -1093,7 +1095,8 @@ public interface CAS extends AbstractCas
    * @param reuseInfo if mark is not null, this parameter is required 
    * - and must have been computed when the service did the original deserialization of the CAS now being serialized as a delta CAS
    * @throws IOException
+   * @throws ResourceInitializationException if target type system is incompatible with this CAS's type system
    */
-  public void serializeWithCompression(Object out, TypeSystem tgtTypeSystem, Marker mark, ReuseInfo reuseInfo) throws IOException;
+  public void serializeWithCompression(Object out, TypeSystem tgtTypeSystem, Marker mark, ReuseInfo reuseInfo) throws IOException, ResourceInitializationException;
   
 }

Modified: uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes6.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes6.java?rev=1485234&r1=1485233&r2=1485234&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes6.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes6.java Wed May 22 14:48:06 2013
@@ -75,6 +75,7 @@ import org.apache.uima.cas.impl.TypeSyst
 import org.apache.uima.internal.util.IntVector;
 import org.apache.uima.internal.util.rb_trees.Int2IntRBT;
 import org.apache.uima.jcas.JCas;
+import org.apache.uima.resource.ResourceInitializationException;
 import org.apache.uima.util.impl.DataIO;
 import org.apache.uima.util.impl.OptimizeStrings;
 import org.apache.uima.util.impl.SerializationMeasures;
@@ -467,6 +468,7 @@ public class BinaryCasSerDes6 {
    * @param doMeasurements if true, measurements are done (on serialization)
    * @param compressLevel if not null, specifies enum instance for compress level
    * @param compressStrategy if not null, specifies enum instance for compress strategy
+   * @throws ResourceInitializationException if the target type system is incompatible with the source type system
    */
   public BinaryCasSerDes6(
       AbstractCas aCas,
@@ -475,7 +477,7 @@ public class BinaryCasSerDes6 {
       ReuseInfo rfs,
       boolean doMeasurements,
       CompressLevel compressLevel, 
-      CompressStrat compressStrategy) {
+      CompressStrat compressStrategy) throws ResourceInitializationException {
     cas = ((CASImpl) ((aCas instanceof JCas) ? ((JCas)aCas).getCas(): aCas)).getBaseCAS();
     
     this.ts = cas.getTypeSystemImpl();
@@ -522,8 +524,9 @@ public class BinaryCasSerDes6 {
   /**
    * Setup to serialize (not delta) or deserialize (not delta) using binary compression, no type mapping but only processing reachable Feature Structures
    * @param cas
+   * @throws ResourceInitializationException never thrown 
    */
-  public BinaryCasSerDes6(AbstractCas cas) {
+  public BinaryCasSerDes6(AbstractCas cas) throws ResourceInitializationException {
     this(cas, null, null, null, false, CompressLevel.Default, CompressStrat.Default);
   }
   
@@ -532,8 +535,9 @@ public class BinaryCasSerDes6 {
    * @param cas
    * @param mark
    * @param tgtTs
+   * @throws ResourceInitializationException if the target type system is incompatible with the source type system
    */
-  public BinaryCasSerDes6(AbstractCas cas, TypeSystemImpl tgtTs) {
+  public BinaryCasSerDes6(AbstractCas cas, TypeSystemImpl tgtTs) throws ResourceInitializationException {
     this(cas, null, tgtTs, null, false, CompressLevel.Default, CompressStrat.Default);
   }
 
@@ -543,8 +547,9 @@ public class BinaryCasSerDes6 {
    * @param mark
    * @param tgtTs
    * @param rfs Reused Feature Structure information - required for both delta serialization and delta deserialization
+   * @throws ResourceInitializationException if the target type system is incompatible with the source type system
    */
-  public BinaryCasSerDes6(AbstractCas cas, MarkerImpl mark, TypeSystemImpl tgtTs, ReuseInfo rfs) {
+  public BinaryCasSerDes6(AbstractCas cas, MarkerImpl mark, TypeSystemImpl tgtTs, ReuseInfo rfs) throws ResourceInitializationException {
     this(cas, mark, tgtTs, rfs, false, CompressLevel.Default, CompressStrat.Default);
   }
   
@@ -555,8 +560,9 @@ public class BinaryCasSerDes6 {
    * @param tgtTs
    * @param rfs Reused Feature Structure information - speed up on serialization, required on delta deserialization
    * @param doMeasurements
+   * @throws ResourceInitializationException if the target type system is incompatible with the source type system
    */
-  public BinaryCasSerDes6(AbstractCas cas, MarkerImpl mark, TypeSystemImpl tgtTs, ReuseInfo rfs, boolean doMeasurements) {
+  public BinaryCasSerDes6(AbstractCas cas, MarkerImpl mark, TypeSystemImpl tgtTs, ReuseInfo rfs, boolean doMeasurements) throws ResourceInitializationException {
     this(cas, mark, tgtTs, rfs, doMeasurements, CompressLevel.Default, CompressStrat.Default);
   }
 
@@ -564,8 +570,9 @@ public class BinaryCasSerDes6 {
    * Setup to serialize (not delta) or deserialize (maybe delta) using binary compression, no type mapping and only processing reachable Feature Structures
    * @param cas
    * @param rfs
+   * @throws ResourceInitializationException never thrown
    */
-  public BinaryCasSerDes6(AbstractCas cas, ReuseInfo rfs) {
+  public BinaryCasSerDes6(AbstractCas cas, ReuseInfo rfs) throws ResourceInitializationException {
     this(cas, null, null, rfs, false, CompressLevel.Default, CompressStrat.Default);
   }
 

Modified: uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java?rev=1485234&r1=1485233&r2=1485234&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java Wed May 22 14:48:06 2013
@@ -86,6 +86,7 @@ import org.apache.uima.cas.text.Language
 import org.apache.uima.internal.util.IntVector;
 import org.apache.uima.jcas.JCas;
 import org.apache.uima.jcas.impl.JCasImpl;
+import org.apache.uima.resource.ResourceInitializationException;
 
 /**
  * Implements the CAS interfaces. This class must be public because we need to
@@ -1206,7 +1207,11 @@ public class CASImpl extends AbstractCas
           (new BinaryCasSerDes4(this.getTypeSystemImpl(), false)).deserialize(this, dis, delta);
           return SerialFormat.COMPRESSED;
         } else {
-          (new BinaryCasSerDes6(this, rfs)).deserializeAfterVersion(dis, delta, AllowPreexistingFS.allow);
+          try {
+            (new BinaryCasSerDes6(this, rfs)).deserializeAfterVersion(dis, delta, AllowPreexistingFS.allow);
+          } catch (ResourceInitializationException e) {
+            // never thrown
+          }
           return SerialFormat.COMPRESSED_FILTERED;
         }
       }
@@ -4320,18 +4325,20 @@ public class CASImpl extends AbstractCas
   }
   
   /**
+   * @throws ResourceInitializationException if target type system is incompatible with this CAS's type system
    * @see org.apache.uima.cas.CAS#serializeWithCompression(Object out, TypeSystem tgtTypeSystem, Marker marker)
    */
-  public ReuseInfo serializeWithCompression(Object out, TypeSystem tgtTypeSystem) throws IOException {
+  public ReuseInfo serializeWithCompression(Object out, TypeSystem tgtTypeSystem) throws IOException, ResourceInitializationException {
     BinaryCasSerDes6 bcs = new BinaryCasSerDes6(this, (TypeSystemImpl) tgtTypeSystem);
     bcs.serialize(out);
     return bcs.getReuseInfo();
   }
   
   /**
+   * @throws ResourceInitializationException if target type system is incompatible with this CAS's type system
    * @see org.apache.uima.cas.CAS#serializeWithCompression(Object out, TypeSystem tgtTypeSystem, Marker mark, ReuseInfo reuseInfo)
    */
-  public void serializeWithCompression(Object out, TypeSystem tgtTypeSystem, Marker mark, ReuseInfo reuseInfo) throws IOException {
+  public void serializeWithCompression(Object out, TypeSystem tgtTypeSystem, Marker mark, ReuseInfo reuseInfo) throws IOException, ResourceInitializationException {
     BinaryCasSerDes6 bcs = new BinaryCasSerDes6(this, (MarkerImpl) mark, (TypeSystemImpl) tgtTypeSystem, reuseInfo);
     bcs.serialize(out);
   }

Modified: uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasTypeSystemMapper.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasTypeSystemMapper.java?rev=1485234&r1=1485233&r2=1485234&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasTypeSystemMapper.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasTypeSystemMapper.java Wed May 22 14:48:06 2013
@@ -28,6 +28,8 @@ import java.util.Map;
 import java.util.Map.Entry;
 
 import org.apache.uima.cas.Type;
+import org.apache.uima.cas.TypeSystem;
+import org.apache.uima.resource.ResourceInitializationException;
 
 /**
  * This class gets initialized with two type systems, and then provides 
@@ -93,18 +95,39 @@ public class CasTypeSystemMapper {
    */
   final private int[] tTgt2Src;
   
-  public CasTypeSystemMapper(TypeSystemImpl tsSrc, TypeSystemImpl tsTgt) {
+  final private boolean typeSystemsSame;
+  
+  public boolean isEqual() {
+    return this.typeSystemsSame;
+  }
+  
+  public CasTypeSystemMapper(TypeSystemImpl tsSrc, TypeSystemImpl tsTgt) throws ResourceInitializationException {
     if (!tsSrc.isCommitted() || !tsTgt.isCommitted()) {
       throw new RuntimeException("Type Systems must be committed before calling this method");
     }
     this.tsSrc = tsSrc;
     this.tsTgt = tsTgt;
     
-    this.tSrc2Tgt = addTypes(tsSrc, tsTgt);
-    this.tTgt2Src = addTypes(tsTgt, tsSrc);
-    this.fSrcInTgt = new boolean[tsSrc.getTypeArraySize()] [];
-    this.fTgt2Src = new int[tsSrc.getTypeArraySize()] [];
-    addFeatures(tsSrc, tsTgt);
+    int[] temptSrc2Tgt = null;
+    int[] temptTgt2Src = null;
+    boolean[][] localFSrcInTgt = null;
+    int[][] localFTgt2Src = null;
+    if (tsSrc == tsTgt) {
+      typeSystemsSame = true;
+    } else {
+      temptSrc2Tgt = addTypes(tsSrc, tsTgt);
+      temptTgt2Src = addTypes(tsTgt, tsSrc);
+    
+      localFSrcInTgt = new boolean[tsSrc.getTypeArraySize()] [];
+      localFTgt2Src = new int[tsSrc.getTypeArraySize()] [];
+      typeSystemsSame = addFeatures(tsSrc, tsTgt, localFSrcInTgt, localFTgt2Src, temptSrc2Tgt);
+    }
+    
+    this.tSrc2Tgt = temptSrc2Tgt;
+    this.tTgt2Src = temptTgt2Src;
+    this.fSrcInTgt =localFSrcInTgt;
+    this.fTgt2Src = localFTgt2Src;
+    
 //    this.fTgt2Src = addFeatures(tsTgt, tsSrc);
   }
   
@@ -164,7 +187,7 @@ public class CasTypeSystemMapper {
 //    return fTgt2Src[c];
 //  }
 
-  private int[] addTypes(TypeSystemImpl tsSrc, TypeSystemImpl tsTgt) {
+  private static int[] addTypes(TypeSystemImpl tsSrc, TypeSystemImpl tsTgt) {
     Map<TypeImpl, TypeImpl> mSrc2Tgt = new LinkedHashMap<TypeImpl, TypeImpl>();
     for (Iterator<Type> it = tsSrc.getTypeIterator(); it.hasNext();) {
       TypeImpl tSrc = (TypeImpl) it.next();
@@ -180,12 +203,16 @@ public class CasTypeSystemMapper {
     return r;  
   }
   
-  private void addFeatures(TypeSystemImpl tsSrc, TypeSystemImpl tsTgt) {
+  private boolean addFeatures(final TypeSystemImpl tsSrc, final TypeSystemImpl tsTgt, final boolean[][] localFSrcInTgt, final int[][] localFTgt2Src, final int[] temptSrc2Tgt) throws ResourceInitializationException {
+    boolean isEqual = tsSrc.getTypeArraySize() == tsTgt.getTypeArraySize();
     for (int tCodeSrc = 0; tCodeSrc < tsSrc.getTypeArraySize(); tCodeSrc++) {
-      final int tCodeTgt = mapTypeCodeSrc2Tgt(tCodeSrc);
+      final int tCodeTgt = temptSrc2Tgt[tCodeSrc];
+      if (tCodeTgt != tCodeSrc) {
+        isEqual = false;
+      }
       if (tCodeTgt == 0) {  // this type not in target
-        fSrcInTgt[tCodeSrc] = BOOLEAN0;
-        fTgt2Src[tCodeSrc] = null;  // should never be referenced
+        localFSrcInTgt[tCodeSrc] = BOOLEAN0;
+        localFTgt2Src[tCodeSrc] = null;  // should never be referenced
         continue;
       }
       
@@ -193,25 +220,29 @@ public class CasTypeSystemMapper {
       final int[] fcSrc = tsSrc.ll_getAppropriateFeatures(tCodeSrc);
       final int[] fcTgt = tsTgt.ll_getAppropriateFeatures(tCodeTgt);
       
+      if (fcSrc.length != fcTgt.length) {
+        isEqual = false;
+      }
+      
       if (fcSrc.length == 0) {
         // source has no features
-        fSrcInTgt[tCodeSrc] = BOOLEAN0;
-        fTgt2Src[tCodeSrc] = new int[fcTgt.length];
-        Arrays.fill(fTgt2Src[tCodeSrc], -1);
+        localFSrcInTgt[tCodeSrc] = BOOLEAN0;
+        localFTgt2Src[tCodeSrc] = new int[fcTgt.length];
+        Arrays.fill(localFTgt2Src[tCodeSrc], -1);
         continue;  // source type has no features        
       }
       
       final boolean[] srcInTgt = new boolean[fcSrc.length];
-      fSrcInTgt[tCodeSrc] = srcInTgt;
+      localFSrcInTgt[tCodeSrc] = srcInTgt;
       
       if (fcTgt.length == 0) {
         Arrays.fill(srcInTgt, false);
-        fTgt2Src[tCodeSrc] = INT0;
+        localFTgt2Src[tCodeSrc] = INT0;
         continue;  // target type has no features        
       }
       
       final int[] tgt2srcOffsets = new int[fcTgt.length];
-      fTgt2Src[tCodeSrc] = tgt2srcOffsets;
+      localFTgt2Src[tCodeSrc] = tgt2srcOffsets;
       
 //      // debug 
 //      if (tCodeTgt == 228) {
@@ -268,7 +299,23 @@ public class CasTypeSystemMapper {
         final String nameSrc = namesSrc.get(fciSrc);
         // feature names are semi sorted, not completely sorted due to inheritence
         final int iTgt = namesTgt.indexOf(nameSrc);
-        srcInTgt[fciSrc] = ((-1) != iTgt);  // -1 if not there
+        if (iTgt == -1) {
+          isEqual = false;          
+          srcInTgt[fciSrc] = false;
+        } else {
+          if (! tsSrc.ll_getFeatureForCode(fcSrc[fciSrc]).getRange().getName().equals(
+                tsTgt.ll_getFeatureForCode(fcTgt[iTgt]).getRange().getName())) {
+            throw new ResourceInitializationException(
+                ResourceInitializationException.INCOMPATIBLE_RANGE_TYPES, new Object[] {
+                    tsSrc.ll_getTypeForCode(tCodeSrc).getName() + ":" + nameSrc, 
+                    tsSrc.ll_getFeatureForCode(fcSrc[fciSrc]).getRange().getName(), 
+                    tsTgt.ll_getFeatureForCode(fcTgt[iTgt]).getRange().getName(),
+                    ""});
+          }
+          srcInTgt[fciSrc] = true;
+          
+          
+        } 
       } // end of for loop over all source features of a type code
       
       // for each feature in the target, find the corresponding source feature by name match (if any)
@@ -277,8 +324,12 @@ public class CasTypeSystemMapper {
         // feature names are semi sorted, not completely sorted due to inheritence
         final int iSrc = namesSrc.indexOf(nameTgt);
         tgt2srcOffsets[fciTgt] = iSrc;  // -1 if not there
+        if (fciTgt != iSrc) {
+          isEqual = false;
+        }
       } // end of for loop over all target features of a type code      
     }   // end of for loop over all typecodes
+    return isEqual;
   }
 
   

Modified: uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java?rev=1485234&r1=1485233&r2=1485234&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java Wed May 22 14:48:06 2013
@@ -56,6 +56,7 @@ import org.apache.uima.internal.util.Str
 import org.apache.uima.internal.util.SymbolTable;
 import org.apache.uima.internal.util.rb_trees.IntRedBlackTree;
 import org.apache.uima.internal.util.rb_trees.RedBlackTree;
+import org.apache.uima.resource.ResourceInitializationException;
 
 /**
  * Type system implementation.
@@ -1588,7 +1589,7 @@ public class TypeSystemImpl implements T
    *********************************************************/
   Map<TypeSystemImpl, CasTypeSystemMapper> typeSystemMappers = new HashMap<TypeSystemImpl, CasTypeSystemMapper>();
   
-  synchronized CasTypeSystemMapper getTypeSystemMapper(TypeSystemImpl tgtTs) {
+  synchronized CasTypeSystemMapper getTypeSystemMapper(TypeSystemImpl tgtTs) throws ResourceInitializationException {
     if ((null == tgtTs) || (this == tgtTs)) {
       return null;  // conventions for no type mapping
     }
@@ -1597,7 +1598,7 @@ public class TypeSystemImpl implements T
       m = new CasTypeSystemMapper(this, tgtTs);
       typeSystemMappers.put(tgtTs, m);
     }
-    return m;
+    return (m.isEqual()) ? null : m;
   }
   
 }

Modified: uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/impl/CasTypeSystemMapperTst.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/impl/CasTypeSystemMapperTst.java?rev=1485234&r1=1485233&r2=1485234&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/impl/CasTypeSystemMapperTst.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/impl/CasTypeSystemMapperTst.java Wed May 22 14:48:06 2013
@@ -12,6 +12,7 @@ import org.apache.uima.cas.admin.FSIndex
 import org.apache.uima.cas.admin.TypeSystemMgr;
 import org.apache.uima.cas.test.AnnotatorInitializer;
 import org.apache.uima.cas.test.CASInitializer;
+import org.apache.uima.resource.ResourceInitializationException;
 
 public class CasTypeSystemMapperTst extends TestCase {
   
@@ -23,22 +24,24 @@ public class CasTypeSystemMapperTst exte
     super.tearDown();
   }
 
-  public void testCasTypeSystemMapperFull() {
+  public void testCasTypeSystemMapperFull() throws ResourceInitializationException {
     TypeSystemImpl ts1 = createTs(3, 0x1ffff, 0x1ffff);
     TypeSystemImpl ts2 = createTs(3, 0x1ffff, 0x1ffff); 
     CasTypeSystemMapper m = new CasTypeSystemMapper(ts1, ts2);
     chkbase(m, 38);
+    assertTrue(m.isEqual());
   }
   
-  public void testMissingType1() {
+  public void testMissingType1() throws ResourceInitializationException {
     TypeSystemImpl ts1 = createTs(3, 0x1ffff, 0x1ffff);
     TypeSystemImpl ts2 = createTs(1, 0x1ffff, 0x1ffff); 
     CasTypeSystemMapper m = new CasTypeSystemMapper(ts1, ts2);
     chkbase(m, 37);
     assertEquals(0, m.mapTypeCodeSrc2Tgt(38));
+    assertFalse(m.isEqual());
   }
 
-  public void testMissingType2() {
+  public void testMissingType2() throws ResourceInitializationException {
     TypeSystemImpl ts1 = createTs(3, 0x1ffff, 0x1ffff);
     TypeSystemImpl ts2 = createTs(2, 0x1ffff, 0x1ffff); 
     CasTypeSystemMapper m = new CasTypeSystemMapper(ts1, ts2);
@@ -47,17 +50,19 @@ public class CasTypeSystemMapperTst exte
     assertEquals(37, m.mapTypeCodeSrc2Tgt(38));
     assertEquals(38, m.mapTypeCodeTgt2Src(37));
     chkfeats(m, 38);
+    assertFalse(m.isEqual());
   }
   
-  public void testMissingType3() {
+  public void testMissingType3() throws ResourceInitializationException {
     TypeSystemImpl ts1 = createTs(1, 0x1ffff, 0x1ffff);
     TypeSystemImpl ts2 = createTs(3, 0x1ffff, 0x1ffff); 
     CasTypeSystemMapper m = new CasTypeSystemMapper(ts1, ts2);
     chkbase(m, 37);
     assertEquals(0, m.mapTypeCodeTgt2Src(38));
+    assertFalse(m.isEqual());
   }
   
-  public void testMissingType4() {
+  public void testMissingType4() throws ResourceInitializationException {
     TypeSystemImpl ts1 = createTs(2, 0x1ffff, 0x1ffff);
     TypeSystemImpl ts2 = createTs(3, 0x1ffff, 0x1ffff); 
     CasTypeSystemMapper m = new CasTypeSystemMapper(ts1, ts2);
@@ -66,28 +71,31 @@ public class CasTypeSystemMapperTst exte
     assertEquals(37, m.mapTypeCodeTgt2Src(38));
     assertEquals(0, m.mapTypeCodeTgt2Src(37));
     chkfeats(m, 37);
+    assertFalse(m.isEqual());
   }
   
-  public void testMissingType5() {
+  public void testMissingType5() throws ResourceInitializationException {
     TypeSystemImpl ts1 = createTs(3, 0x1ffff, 0x1ffff);
     TypeSystemImpl ts2 = createTs(0, 0x1ffff, 0x1ffff); 
     CasTypeSystemMapper m = new CasTypeSystemMapper(ts1, ts2);
     chkbase(m, 36);
     assertEquals( 0, m.mapTypeCodeSrc2Tgt(37));
     assertEquals(0, m.mapTypeCodeSrc2Tgt(38));
+    assertFalse(m.isEqual());
   }
 
-  public void testMissingType6() {
+  public void testMissingType6() throws ResourceInitializationException {
     TypeSystemImpl ts1 = createTs(0, 0x1ffff, 0x1ffff);
     TypeSystemImpl ts2 = createTs(3, 0x1ffff, 0x1ffff); 
     CasTypeSystemMapper m = new CasTypeSystemMapper(ts1, ts2);
     chkbase(m, 36);
     assertEquals( 0, m.mapTypeCodeTgt2Src(37));
     assertEquals(0, m.mapTypeCodeTgt2Src(38));
+    assertFalse(m.isEqual());
   }
 
   
-  public void testMissingFeature0() {
+  public void testMissingFeature0() throws ResourceInitializationException {
     TypeSystemImpl ts1 = createTs(3, 0x1ffff, 0x1ffff);
     for (int i = 0, mf = 1; i < 14; i++, mf = mf<<1) {
       TypeSystemImpl ts2 = createTs(3, 0x1ffff - mf, 0x1ffff);  
@@ -99,10 +107,11 @@ public class CasTypeSystemMapperTst exte
       assertEquals(38, m.mapTypeCodeTgt2Src(38));
       chkfeats(m, 38);
       chkMissingFeats1(m, 37, mf);    
-    } 
+      assertFalse(m.isEqual());
+   } 
   }
 
-  public void testMissingFeature0r() {
+  public void testMissingFeature0r() throws ResourceInitializationException {
     TypeSystemImpl ts1 = createTs(3, 0x1ffff, 0x1ffff);
     for (int i = 0, mf = 1; i < 14; i++, mf = mf<<1) {
       TypeSystemImpl ts2 = createTs(3, 0x1ffff, 0x1ffff - mf);  
@@ -114,10 +123,11 @@ public class CasTypeSystemMapperTst exte
       assertEquals(38, m.mapTypeCodeTgt2Src(38));
       chkfeats(m, 37);
       chkMissingFeats1(m, 38, mf);      
+      assertFalse(m.isEqual());
     }
   }
 
-  public void testMissingFeature0f() {
+  public void testMissingFeature0f() throws ResourceInitializationException {
     TypeSystemImpl ts2 = createTs(3, 0x1ffff, 0x1ffff);  
     for (int i = 0, mf = 1; i < 14; i++, mf = mf<<1) {
       TypeSystemImpl ts1 = createTs(3, 0x1ffff - mf, 0x1ffff); // feat 8
@@ -129,10 +139,11 @@ public class CasTypeSystemMapperTst exte
       assertEquals(38, m.mapTypeCodeTgt2Src(38));
       chkfeats(m, 38);
       chkMissingFeats2(m, 37, mf);
+      assertFalse(m.isEqual());
     }
   }
 
-  public void testMissingFeature0f2() {
+  public void testMissingFeature0f2() throws ResourceInitializationException {
     TypeSystemImpl ts2 = createTs(3, 0x1ffff, 0x1ffff);  
     for (int i = 0, mf = 1; i < 14; i++, mf = mf<<1) {
       TypeSystemImpl ts1 = createTs(3, 0x1ffff, 0x1ffff - mf); // feat 8
@@ -144,10 +155,11 @@ public class CasTypeSystemMapperTst exte
       assertEquals(38, m.mapTypeCodeTgt2Src(38));
       chkfeats(m, 37);
       chkMissingFeats2(m, 38, mf);
+      assertFalse(m.isEqual());
     }
   }
   
-  public void testMissingAllFeat1() {
+  public void testMissingAllFeat1() throws ResourceInitializationException {
     int mf = 0x1ffff;
     TypeSystemImpl ts1 = createTs(3, 0x1ffff, 0x1ffff);
     TypeSystemImpl ts2 = createTs(3, 0x1ffff, 0x1ffff - mf);  
@@ -159,9 +171,10 @@ public class CasTypeSystemMapperTst exte
     assertEquals(38, m.mapTypeCodeTgt2Src(38));
     chkfeats(m, 37);
     chkMissingFeats1(m, 38, mf);      
+    assertFalse(m.isEqual());
   }
 
-  public void testMissingAllFeat2() {
+  public void testMissingAllFeat2() throws ResourceInitializationException {
     int mf = 0x1ffff;
     TypeSystemImpl ts1 = createTs(3, 0x1ffff, 0x1ffff - mf);
     TypeSystemImpl ts2 = createTs(3, 0x1ffff, 0x1ffff);  
@@ -173,6 +186,7 @@ public class CasTypeSystemMapperTst exte
     assertEquals(38, m.mapTypeCodeTgt2Src(38));
     chkfeats(m, 37);
     chkMissingFeats2(m, 38, mf);      
+    assertFalse(m.isEqual());
   }
 
   private void chkfeats(CasTypeSystemMapper m, int tCode) {

Modified: uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/impl/SerDesTest6.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/impl/SerDesTest6.java?rev=1485234&r1=1485233&r2=1485234&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/impl/SerDesTest6.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/impl/SerDesTest6.java Wed May 22 14:48:06 2013
@@ -1136,6 +1136,9 @@ public class SerDesTest6 extends TestCas
       }
     } catch (IOException e) {
       throw new RuntimeException(e);
+    } catch (ResourceInitializationException e) {
+      e.printStackTrace();
+      fail();
     }    
   }
   
@@ -1158,6 +1161,9 @@ public class SerDesTest6 extends TestCas
       assertTrue(bcs.compareCASes(casSrc, casTgt));
     } catch (IOException e) {
       throw new RuntimeException(e);
+    } catch (ResourceInitializationException e) {
+      e.printStackTrace();
+      fail();
     }    
    
   }
@@ -1193,6 +1199,9 @@ public class SerDesTest6 extends TestCas
       }
     } catch (IOException e) {
       throw new RuntimeException(e);
+    } catch (ResourceInitializationException e) {
+      e.printStackTrace();
+      fail();
     }
     return riToReturn;
   }
@@ -1218,6 +1227,9 @@ public class SerDesTest6 extends TestCas
       }      
     } catch (IOException e) {
       throw new RuntimeException(e);
+    } catch (ResourceInitializationException e) {
+      e.printStackTrace();
+      fail();
     }
   }