You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by ea...@apache.org on 2019/02/17 20:03:06 UTC
svn commit: r1853768 -
/uima/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/CasHelper.java
Author: eae
Date: Sun Feb 17 20:03:06 2019
New Revision: 1853768
URL: http://svn.apache.org/viewvc?rev=1853768&view=rev
Log:
UIMA-5988 ignore situation where workitem type is not defined in typesystem
Modified:
uima/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/CasHelper.java
Modified: uima/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/CasHelper.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/CasHelper.java?rev=1853768&r1=1853767&r2=1853768&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/CasHelper.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/CasHelper.java Sun Feb 17 20:03:06 2019
@@ -18,8 +18,6 @@
*/
package org.apache.uima.ducc;
-import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
-import org.apache.uima.analysis_engine.annotator.AnnotatorInitializationException;
import org.apache.uima.cas.CAS;
import org.apache.uima.cas.FSIterator;
import org.apache.uima.cas.Feature;
@@ -39,33 +37,24 @@ public class CasHelper {
String retVal = null;
if (cas != null) {
retVal = cas.getDocumentText();
- try {
- // Get a reference to the "Workitem" Type
- mWorkitemType = cas.getTypeSystem().getType("org.apache.uima.ducc.Workitem");
- if (mWorkitemType == null) {
- throw new AnalysisEngineProcessException(AnnotatorInitializationException.TYPE_NOT_FOUND,
- new Object[] { CasHelper.class.getName(), "org.apache.uima.ducc.Workitem" });
- }
- // Get a reference to the "sendToALL" Feature
- mInputspecFeature = mWorkitemType.getFeatureByBaseName("inputspec");
- if (mInputspecFeature == null) {
- throw new AnalysisEngineProcessException(AnnotatorInitializationException.FEATURE_NOT_FOUND,
- new Object[] { CasHelper.class.getName(), "org.apache.uima.ducc.Workitem:inputspec" });
- }
- FSIterator<FeatureStructure> it = cas.getIndexRepository().getAllIndexedFS(mWorkitemType);
- if (it.isValid()) {
- FeatureStructure wi = it.get();
- if (wi != null) {
- String id = wi.getStringValue(mInputspecFeature);
- if(id != null) {
- retVal = id;
- }
- }
- }
- }
- catch (Exception e) {
- e.printStackTrace();
- }
+
+ // Get references to the "Workitem" Type and the "inputspec" Feature
+ mWorkitemType = cas.getTypeSystem().getType("org.apache.uima.ducc.Workitem");
+ if (mWorkitemType != null) {
+ mInputspecFeature = mWorkitemType.getFeatureByBaseName("inputspec");
+ if (mInputspecFeature != null) {
+ FSIterator<FeatureStructure> it = cas.getIndexRepository().getAllIndexedFS(mWorkitemType);
+ if (it.isValid()) {
+ FeatureStructure wi = it.get();
+ if (wi != null) {
+ String id = wi.getStringValue(mInputspecFeature);
+ if(id != null) {
+ retVal = id;
+ }
+ }
+ }
+ }
+ }
}
return retVal;
}