Author: schor Date: Wed Dec 21 20:52:20 2016 New Revision: 1775563 URL: http://svn.apache.org/viewvc?rev=1775563&view=rev Log: [UIMA-4674] fix npe in pretty-print of arrays; fix reset and test of empty modified tracking info
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java?rev=1775563&r1=1775562&r2=1775563&view=diff ============================================================================== --- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java (original) +++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java Wed Dec 21 20:52:20 2016 @@ -91,7 +91,6 @@ import org.apache.uima.cas.impl.SlotKind import org.apache.uima.cas.text.AnnotationFS; import org.apache.uima.cas.text.AnnotationIndex; import org.apache.uima.cas.text.Language; -import org.apache.uima.internal.util.Int2ObjHashMap; import org.apache.uima.internal.util.IntVector; import org.apache.uima.internal.util.Misc; import org.apache.uima.internal.util.PositiveIntSet; @@ -623,7 +622,11 @@ public class CASImpl extends AbstractCas } trackingMark = null; - if (null != modifiedPreexistingFSs) modifiedPreexistingFSs.clear(); + if (null != modifiedPreexistingFSs) { + modifiedPreexistingFSs.clear(); + } + + trackingMarkList = null; } void switchClassLoader(ClassLoader newClassLoader) { @@ -4460,7 +4463,10 @@ public class CASImpl extends AbstractCas this); if (this.svd.modifiedPreexistingFSs == null) { this.svd.modifiedPreexistingFSs = new IdentityHashMap<>(); - } else {errorMultipleMarkers();} + } + if (this.svd.modifiedPreexistingFSs.size() > 0) { + errorMultipleMarkers(); + } if (this.svd.trackingMarkList == null) { this.svd.trackingMarkList = new ArrayList<MarkerImpl>(); Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java?rev=1775563&r1=1775562&r2=1775563&view=diff ============================================================================== --- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java (original) +++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java Wed Dec 21 20:52:20 2016 @@ -946,6 +946,9 @@ public class FeatureStructureImplC exten } private final void getPrintRefs(PrintReferences printRefs, FeatureStructureImplC fs) { + if (null == fs) { + return; + } boolean seenBefore = printRefs.addReference(fs); if (seenBefore) { return;