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 2017/09/25 15:44:30 UTC
svn commit: r1809639 - in
/uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima:
cas/impl/ internal/util/ jcas/cas/
Author: schor
Date: Mon Sep 25 15:44:29 2017
New Revision: 1809639
URL: http://svn.apache.org/viewvc?rev=1809639&view=rev
Log: (empty)
Modified:
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes.java
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes4.java
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes6.java
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BuiltinTypeKinds.java
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XCASDeserializer.java
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiCasDeserializer.java
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/internal/util/Misc.java
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/Sofa.java
Modified: uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes.java
URL: http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes.java?rev=1809639&r1=1809638&r2=1809639&view=diff
==============================================================================
--- uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes.java (original)
+++ uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes.java Mon Sep 25 15:44:29 2017
@@ -46,7 +46,6 @@ import org.apache.uima.internal.util.Int
import org.apache.uima.internal.util.Misc;
import org.apache.uima.internal.util.Obj2IntIdentityHashMap;
import org.apache.uima.internal.util.function.Consumer_T_int_withIOException;
-import org.apache.uima.internal.util.function.DeserBinaryIndexes;
import org.apache.uima.jcas.cas.BooleanArray;
import org.apache.uima.jcas.cas.ByteArray;
import org.apache.uima.jcas.cas.DoubleArray;
@@ -1027,57 +1026,57 @@ public class BinaryCasSerDes {
return heapsz;
}
- /**
- * gets number of views, number of sofas,
- * For all sofas,
- * adds them to the index repo in the base index
- * registers the sofa
- * insures initial view created
- * for all views:
- * does the view action and updates the documentannotation
- * @param fsIndex the index info except for the actual list of FSs to reindex
- * @param fss the lists of FSs to reindex (concatenated add/remove, or just adds if not delta)
- * @param viewAction
- */
- void reinitIndexedFSs_common(int[] fsIndex, List<TOP> fss, DeserBinaryIndexes viewAction) {
- // Add FSs to index repository for base CAS
- int numViews = fsIndex[0];
- int loopLen = fsIndex[1]; // number of sofas, not necessarily the same as
- // number of views
- // because the initial view may not have a sofa
- for (int i = 0; i < loopLen; i++) { // iterate over all the sofas,
- baseCas.indexRepository.addFS(fss.get(i)); // add to base index
- }
-
-
- baseCas.forAllSofas(sofa -> {
- String id = sofa.getSofaID();
- if (CAS.NAME_DEFAULT_SOFA.equals(id)) { // _InitialView
- baseCas.registerInitialSofa();
- baseCas.addSofaViewName(id);
- }
- // next line the getView as a side effect
- // checks for dupl sofa name, and if not,
- // adds the name to the sofaNameSet
- ((CASImpl) baseCas.getView(sofa)).registerView(sofa);
- });
-
- baseCas.getInitialView(); // done for side effect of creating the initial view if not present
- // must be done before the next line, because it sets the
- // viewCount to 1.
- baseCas.setViewCount(numViews); // total number of views
-
- int fsIndexIdx = 2;
- for (int viewNbr = 1; viewNbr <= numViews; viewNbr++) {
- CASImpl view = (viewNbr == 1) ? (CASImpl) baseCas.getInitialView() : (CASImpl) baseCas.getView(viewNbr);
- if (view != null) {
- fsIndexIdx += (1 + viewAction.apply(fsIndexIdx, view));
- view.updateDocumentAnnotation(); // noop if sofa local data string == null
- } else {
- fsIndexIdx += 1;
- }
- }
- }
+// /**
+// * gets number of views, number of sofas,
+// * For all sofas,
+// * adds them to the index repo in the base index
+// * registers the sofa
+// * insures initial view created
+// * for all views:
+// * does the view action and updates the documentannotation
+// * @param fsIndex the index info except for the actual list of FSs to reindex
+// * @param fss the lists of FSs to reindex (concatenated add/remove, or just adds if not delta)
+// * @param viewAction
+// */
+// void reinitIndexedFSs_common(int[] fsIndex, List<TOP> fss, DeserBinaryIndexes viewAction) {
+// // Add FSs to index repository for base CAS
+// int numViews = fsIndex[0];
+// int loopLen = fsIndex[1]; // number of sofas, not necessarily the same as
+// // number of views
+// // because the initial view may not have a sofa
+// for (int i = 0; i < loopLen; i++) { // iterate over all the sofas,
+// baseCas.indexRepository.addFS(fss.get(i)); // add to base index
+// }
+//
+//
+// baseCas.forAllSofas(sofa -> {
+// String id = sofa.getSofaID();
+// if (CAS.NAME_DEFAULT_SOFA.equals(id)) { // _InitialView
+// baseCas.registerInitialSofa();
+// baseCas.addSofaViewName(id);
+// }
+// // next line the getView as a side effect
+// // checks for dupl sofa name, and if not,
+// // adds the name to the sofaNameSet
+// ((CASImpl) baseCas.getView(sofa)).registerView(sofa);
+// });
+//
+// baseCas.getInitialView(); // done for side effect of creating the initial view if not present
+// // must be done before the next line, because it sets the
+// // viewCount to 1.
+// baseCas.setViewCount(numViews); // total number of views
+//
+// int fsIndexIdx = 2;
+// for (int viewNbr = 1; viewNbr <= numViews; viewNbr++) {
+// CASImpl view = (viewNbr == 1) ? (CASImpl) baseCas.getInitialView() : (CASImpl) baseCas.getView(viewNbr);
+// if (view != null) {
+// fsIndexIdx += (1 + viewAction.apply(fsIndexIdx, view));
+// view.updateDocumentAnnotation(); // noop if sofa local data string == null
+// } else {
+// fsIndexIdx += 1;
+// }
+// }
+// }
/**
@@ -1915,9 +1914,10 @@ public class BinaryCasSerDes {
if (feat == tsi.sofaString) {
if (fixups4forwardFsRefs != null) {
// has to be deferred because it updates docAnnot which might not be deser yet.
+ // TODO no longer needed, calls the version which doesn't update docAnnot 9/2017
Sofa capturedSofa = sofa;
String capturedString = s;
- fixups4forwardFsRefs.add(() -> capturedSofa.setLocalSofaData(capturedString));
+ fixups4forwardFsRefs.add(() -> capturedSofa.setLocalSofaDataNoDocAnnotUpdate(capturedString));
} else {
sofa.setLocalSofaData(s);
}
Modified: uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes4.java
URL: http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes4.java?rev=1809639&r1=1809638&r2=1809639&view=diff
==============================================================================
--- uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes4.java (original)
+++ uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes4.java Mon Sep 25 15:44:29 2017
@@ -1977,7 +1977,7 @@ public class BinaryCasSerDes4 implements
break;
}
if (feat == ts.sofaString) {
- maybeStoreOrDefer(lfs -> ((Sofa)lfs).setLocalSofaData(s));
+ maybeStoreOrDefer(lfs -> ((Sofa)lfs).setLocalSofaDataNoDocAnnotUpdate(s));
break;
}
}
Modified: uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes6.java
URL: http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes6.java?rev=1809639&r1=1809638&r2=1809639&view=diff
==============================================================================
--- uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes6.java (original)
+++ uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes6.java Mon Sep 25 15:44:29 2017
@@ -2154,7 +2154,7 @@ public class BinaryCasSerDes6 implements
break;
}
if (srcFeat == srcTs.sofaString) {
- maybeStoreOrDefer(storeIt, fs, lfs -> ((Sofa)lfs).setLocalSofaData(vString));
+ maybeStoreOrDefer(storeIt, fs, lfs -> ((Sofa)lfs).setLocalSofaDataNoDocAnnotUpdate(vString));
break;
}
}
Modified: uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BuiltinTypeKinds.java
URL: http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BuiltinTypeKinds.java?rev=1809639&r1=1809638&r2=1809639&view=diff
==============================================================================
--- uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BuiltinTypeKinds.java (original)
+++ uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BuiltinTypeKinds.java Mon Sep 25 15:44:29 2017
@@ -5,6 +5,31 @@ import java.util.Set;
import org.apache.uima.cas.CAS;
import org.apache.uima.internal.util.Misc;
+import org.apache.uima.jcas.cas.AnnotationBase;
+import org.apache.uima.jcas.cas.BooleanArray;
+import org.apache.uima.jcas.cas.ByteArray;
+import org.apache.uima.jcas.cas.DoubleArray;
+import org.apache.uima.jcas.cas.EmptyFSList;
+import org.apache.uima.jcas.cas.EmptyFloatList;
+import org.apache.uima.jcas.cas.EmptyIntegerList;
+import org.apache.uima.jcas.cas.EmptyStringList;
+import org.apache.uima.jcas.cas.FSArray;
+import org.apache.uima.jcas.cas.FSList;
+import org.apache.uima.jcas.cas.FloatArray;
+import org.apache.uima.jcas.cas.FloatList;
+import org.apache.uima.jcas.cas.IntegerArray;
+import org.apache.uima.jcas.cas.IntegerList;
+import org.apache.uima.jcas.cas.LongArray;
+import org.apache.uima.jcas.cas.NonEmptyFSList;
+import org.apache.uima.jcas.cas.NonEmptyFloatList;
+import org.apache.uima.jcas.cas.NonEmptyIntegerList;
+import org.apache.uima.jcas.cas.NonEmptyStringList;
+import org.apache.uima.jcas.cas.ShortArray;
+import org.apache.uima.jcas.cas.Sofa;
+import org.apache.uima.jcas.cas.StringArray;
+import org.apache.uima.jcas.cas.StringList;
+import org.apache.uima.jcas.cas.TOP;
+import org.apache.uima.jcas.tcas.Annotation;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -51,13 +76,50 @@ public class BuiltinTypeKinds {
*/
public static final Set<String> nonCreatableTypesAndBuiltinArrays = new HashSet<String>();
+ public static final Set<String> creatableBuiltinJCasClassNames = new HashSet<>();
+
+ static {
+ Misc.addAll( creatableBuiltinJCasClassNames,
+ BooleanArray.class.getName(),
+ ByteArray.class.getName(),
+ ShortArray.class.getName(),
+ IntegerArray.class.getName(),
+ LongArray.class.getName(),
+ FloatArray.class.getName(),
+ DoubleArray.class.getName(),
+ StringArray.class.getName(),
+ FSArray.class.getName(),
+
+ EmptyFloatList.class.getName(),
+ NonEmptyFloatList.class.getName(),
+ FloatList.class.getName(),
+ EmptyIntegerList.class.getName(),
+ NonEmptyIntegerList.class.getName(),
+ IntegerList.class.getName(),
+ EmptyStringList.class.getName(),
+ NonEmptyStringList.class.getName(),
+ StringList.class.getName(),
+ EmptyFSList.class.getName(),
+ NonEmptyFSList.class.getName(),
+ FSList.class.getName(),
+
+ TOP.class.getName(),
+ AnnotationBase.class.getName(),
+ Annotation.class.getName(),
+
+ Sofa.class.getName(),
+ // no default class for next in the classpath
+ "org.apache.uima.jcas.tcas.DocumentAnnotation"
+ );
+ }
+
/**
* These types are
* - builtin, but could be extended by user
* - creatable - so they need a generator.
* -- non-creatable built-in types are not generated
*/
- public static final Set<String> creatableBuiltinJCas = new HashSet<String>();
+ public static final Set<String> creatableBuiltinJCas = new HashSet<>();
static {
Misc.addAll(primitiveTypeNames,
@@ -97,6 +159,8 @@ public class BuiltinTypeKinds {
CAS.TYPE_NAME_TOP,
CAS.TYPE_NAME_ANNOTATION_BASE,
CAS.TYPE_NAME_ANNOTATION
+// CAS.TYPE_NAME_DOCUMENT_ANNOTATION // https://issues.apache.org/jira/browse/UIMA-5586
+ // these are semi-builtin (for backwards compatibility - not to change users type system codes if not used)
// CAS.TYPE_NAME_FS_ARRAY_LIST,
// CAS.TYPE_NAME_INT_ARRAY_LIST,
// CAS.TYPE_NAME_FS_HASH_SET
Modified: uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
URL: http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java?rev=1809639&r1=1809638&r2=1809639&view=diff
==============================================================================
--- uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java (original)
+++ uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java Mon Sep 25 15:44:29 2017
@@ -1896,6 +1896,21 @@ public class CASImpl extends AbstractCas
}
/**
+ * Internal use, for cases where deserializing - special case setting sofString to skip updating the document annotation
+ * @param fs -
+ * @param feat -
+ * @param s -
+ */
+ public void setFeatureValueFromStringNoDocAnnotUpdate(FeatureStructureImplC fs, FeatureImpl feat, String s) {
+ if (fs instanceof Sofa &&
+ feat.getCode() == sofaStringFeatCode) {
+ ((Sofa)fs).setLocalSofaDataNoDocAnnotUpdate(s);
+ } else {
+ setFeatureValueFromString(fs, feat, s);
+ }
+ }
+
+ /**
* Supports setting slots to "0" for null values
* @param fs The feature structure to update
* @param feat the feature to update-
@@ -4032,7 +4047,7 @@ public class CASImpl extends AbstractCas
/**
* Generic issue: The returned document annotation could be either an instance of
- * DocumentAnnotation or an instance of Annotation - the Java cover class used for
+ * DocumentAnnotation or a subclass of it, or an instance of Annotation - the Java cover class used for
* annotations when JCas is not being used.
*/
@Override
@@ -4170,8 +4185,8 @@ public class CASImpl extends AbstractCas
void setDocTextFromDeserializtion(String text) {
if (mySofaIsValid()) {
- SofaFS sofa = getSofaRef(); // creates sofa if doesn't already exist
- sofa.setLocalSofaData(text);
+ Sofa sofa = getSofaRef(); // creates sofa if doesn't already exist
+ sofa.setLocalSofaDataNoDocAnnotUpdate(text);
}
}
Modified: uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java
URL: http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java?rev=1809639&r1=1809638&r2=1809639&view=diff
==============================================================================
--- uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java (original)
+++ uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java Mon Sep 25 15:44:29 2017
@@ -250,15 +250,15 @@ public abstract class FSClassRegistry {
/**
* Load JCas types for some combination of class loader and type system
- * These classes may have already been loaded for this type system
- * These classes may have already been loaded (perhaps for another type system)
- * @param ts
- * @param isDoUserJCasLoading
- * @param cl
+ * Some of these classes may have already been loaded for this type system
+ * Some of these classes may have already been loaded (perhaps for another type system)
+ * @param ts the type system
+ * @param isDoUserJCasLoading always true, left in for experimentation in the future with dynamic generation of JCas classes
+ * @param cl the class loader. For Pears, is the pear class loader
*/
- static void loadAtTypeSystemCommitTime(TypeSystemImpl ts, boolean isDoUserJCasLoading, ClassLoader cl) {
+ static void loadJCasForTSandClassLoader(TypeSystemImpl ts, boolean isDoUserJCasLoading, ClassLoader cl) {
- boolean alreadyLoaded = false;
+ boolean alreadyPartiallyLoaded = false; // true if any JCas types for this class loader have previously been loaded
Map<String, JCasClassInfo> type_to_jcasClassInfo;
synchronized (cl_to_type2JCas) {
@@ -268,7 +268,7 @@ public abstract class FSClassRegistry {
type_to_jcasClassInfo = new HashMap<>();
cl_to_type2JCas.put(cl, type_to_jcasClassInfo);
} else {
- alreadyLoaded = true;
+ alreadyPartiallyLoaded = true;
}
}
@@ -284,7 +284,7 @@ public abstract class FSClassRegistry {
if (jcas_class_info != null) {
Class<?> jcasClass = jcas_class_info.jcasClass;
- if (!alreadyLoaded) {
+ if (!alreadyPartiallyLoaded) {
type_to_jcasClassInfo.put(jcasClass.getCanonicalName(), jcas_class_info);
}
setTypeFromJCasIDforBuiltIns(jcas_class_info, ts, typecode);
@@ -306,6 +306,13 @@ public abstract class FSClassRegistry {
* This depends on having the TypeImpl's javaClass field be accurate (reflect any loaded JCas types)
*/
+ // this is this here rather than in a static initializer, because
+ // we want to use the "cl" parameter to get a version of the
+ // getMethodHandlesLookup that will have the right (maybe more local) permissions checking.
+ // This is done by having the UIMA Class loader notice that the class being loaded is
+ // MHLC, and then dynamically loading in that class loader a copy of the byte code
+ // for that class.
+
try {
Class<?> clazz = Class.forName(UIMAClassLoader.MHLC, true, cl);
Method m = clazz.getMethod("getMethodHandlesLookup");
@@ -865,7 +872,7 @@ public abstract class FSClassRegistry {
synchronized(cl_to_type2JCas) {
// This is the first time this class loader is being used - load the classes for this type system, or
// This is the first time this class loader is being used with this particular type system
- loadAtTypeSystemCommitTime(tsi, true, cl);
+ loadJCasForTSandClassLoader(tsi, true, cl);
FsGenerator3[] r = new FsGenerator3[tsi.getTypeArraySize()];
@@ -878,6 +885,9 @@ public abstract class FSClassRegistry {
}
JCasClassInfo jcci = e.getValue();
+ // skip entering a generator in the result if
+ // in a pear setup, and this cl is not the cl that loaded the JCas class.
+ // See method comment for why.
if (!isPear || jcci.isPearOverride(cl)) {
r[ti.getCode()] = (FsGenerator3) jcci.generator;
}
Modified: uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java
URL: http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java?rev=1809639&r1=1809638&r2=1809639&view=diff
==============================================================================
--- uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java (original)
+++ uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java Mon Sep 25 15:44:29 2017
@@ -1316,6 +1316,9 @@ public class TypeSystemImpl implements T
public TypeSystemImpl commit(ClassLoader cl) {
synchronized(this) {
if (this.locked) {
+ // is a no-op if already loaded for this Class Loader
+ // otherwise, need to load and set up generators for this class loader
+ getGeneratorsForClassLoader(cl, false);
return this; // might be called multiple times, but only need to do once
}
// because subsumes depends on it
@@ -1369,7 +1372,11 @@ public class TypeSystemImpl implements T
committedTypeSystems.put(this, new WeakReference<>(this));
}
- FSClassRegistry.loadAtTypeSystemCommitTime(this, true, cl);
+ // this call is here for the case where a commit happens, but no subsequent
+ // new CAS or switch classloader call is done. For example, a "reinit" in an existing CAS
+ // This call internally calls the code to load JCas classes for this class loader.
+ getGeneratorsForClassLoader(cl, false);
+// FSClassRegistry.loadJCasForTSandClassLoader(this, true, cl);
return this;
} // of sync block
}
Modified: uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XCASDeserializer.java
URL: http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XCASDeserializer.java?rev=1809639&r1=1809638&r2=1809639&view=diff
==============================================================================
--- uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XCASDeserializer.java (original)
+++ uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XCASDeserializer.java Mon Sep 25 15:44:29 2017
@@ -658,7 +658,7 @@ public class XCASDeserializer {
fixupToDos.add( () -> finalizeRefValue(Integer.parseInt(featVal), fs, feat));
} else { // is not a ref type.
- cas.setFeatureValueFromString(fs, feat, featVal);
+ cas.setFeatureValueFromStringNoDocAnnotUpdate(fs, feat, featVal);
}
}
Modified: uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiCasDeserializer.java
URL: http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiCasDeserializer.java?rev=1809639&r1=1809638&r2=1809639&view=diff
==============================================================================
--- uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiCasDeserializer.java (original)
+++ uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiCasDeserializer.java Mon Sep 25 15:44:29 2017
@@ -887,7 +887,7 @@ public class XmiCasDeserializer {
}
- // before looping over features, set the xmi to fs correspondence for this FS, incase a
+ // before looping over features, set the xmi to fs correspondence for this FS, in case a
// feature does a self reference
String idStr = attrs.getValue(ID_ATTR_NAME);
final int extId;
@@ -1050,7 +1050,7 @@ public class XmiCasDeserializer {
case LowLevelCAS.TYPE_CLASS_DOUBLE:
case LowLevelCAS.TYPE_CLASS_STRING:
{
- casBeingFilled.setFeatureValueFromString(fs, fi, featVal);
+ casBeingFilled.setFeatureValueFromStringNoDocAnnotUpdate(fs, fi, featVal);
break;
}
case LowLevelCAS.TYPE_CLASS_FS: deserializeFsRef(featVal, fi, fs); break;
@@ -1742,7 +1742,7 @@ public class XmiCasDeserializer {
for(FeatureImpl fi : currentType.getFeatureImpls()) {
if (!(fi.getName().equals(CAS.FEATURE_FULL_NAME_SOFA))) {
if ( ! this.featsSeen.contains(fi.getCode())) {
- casBeingFilled.setFeatureValueFromString(currentFs, fi, null);
+ casBeingFilled.setFeatureValueFromStringNoDocAnnotUpdate(currentFs, fi, null);
}
}
}
Modified: uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/internal/util/Misc.java
URL: http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/internal/util/Misc.java?rev=1809639&r1=1809638&r2=1809639&view=diff
==============================================================================
--- uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/internal/util/Misc.java (original)
+++ uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/internal/util/Misc.java Mon Sep 25 15:44:29 2017
@@ -54,6 +54,7 @@ import java.util.regex.Pattern;
import org.apache.uima.UIMAFramework;
import org.apache.uima.UIMARuntimeException;
import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.impl.BuiltinTypeKinds;
import org.apache.uima.internal.util.function.Runnable_withException;
import org.apache.uima.util.Level;
import org.apache.uima.util.Logger;
@@ -808,15 +809,19 @@ public class Misc {
* @return the fully qualified UIMA Type name
*/
public static String javaClassName2UimaTypeName(String className) {
- if (className.startsWith("org.apache.uima.jcas.cas.")) {
+ if (className.startsWith("org.apache.uima.jcas.cas.") &&
+ BuiltinTypeKinds.creatableBuiltinJCasClassNames.contains(className)) {
return CAS.UIMA_CAS_PREFIX + className.substring("org.apache.uima.jcas.cas.".length());
}
- if (className.startsWith("org.apache.uima.jcas.tcas.")) {
+ if (className.startsWith("org.apache.uima.jcas.tcas.")&&
+ BuiltinTypeKinds.creatableBuiltinJCasClassNames.contains(className)) {
return CAS.UIMA_TCAS_PREFIX + className.substring("org.apache.uima.jcas.tcas.".length());
}
return className;
}
+
+
public static void timeLoops(String title, int iterations, Runnable_withException r) throws Exception {
long shortest = Long.MAX_VALUE;
for (int i = 0; i < iterations; i++) {
Modified: uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/Sofa.java
URL: http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/Sofa.java?rev=1809639&r1=1809638&r2=1809639&view=diff
==============================================================================
--- uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/Sofa.java (original)
+++ uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/cas/Sofa.java Mon Sep 25 15:44:29 2017
@@ -177,18 +177,25 @@ public class Sofa extends TOP implements
}
/**
- * @see org.apache.uima.cas.SofaFS#setLocalSofaData(String) This method is duplicated in
- * SofaFSImpl. Any changes should be made in both places.
+ * @see org.apache.uima.cas.SofaFS#setLocalSofaData(String)
*/
@Override
public void setLocalSofaData(String aString) {
- if (isSofaDataSet()) { throwAlreadySet("setLocalSofaData()"); }
- _setStringValueNcWj(wrapGetIntCatchException(_FH_sofaString), aString);
-
+ setLocalSofaDataNoDocAnnotUpdate(aString);
+
// create or update the document annotation for this Sofa's view
((CASImpl)(_casView.getView(this))).updateDocumentAnnotation();
}
+ /**
+ * Internal use: used by deserializers
+ * @param aString the string to update
+ */
+ public void setLocalSofaDataNoDocAnnotUpdate(String aString) {
+ if (isSofaDataSet()) { throwAlreadySet("setLocalSofaData()"); }
+ _setStringValueNcWj(wrapGetIntCatchException(_FH_sofaString), aString);
+ }
+
public void setLocalSofaData(String aString, String mimeType) {
setLocalSofaData(aString);
setMimeType(mimeType);