Author: burn
Date: Wed Sep 25 19:03:44 2013
New Revision: 1526268

URL: http://svn.apache.org/r1526268
Log:
UIMA-3110 First check if the Workitem type is in tha CAS's typesystem before 
getting an iterator

Modified:
    
uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/uima/DuccJobProcessFC.java

Modified: 
uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/uima/DuccJobProcessFC.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/uima/DuccJobProcessFC.java?rev=1526268&r1=1526267&r2=1526268&view=diff
==============================================================================
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/uima/DuccJobProcessFC.java
 (original)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/uima/DuccJobProcessFC.java
 Wed Sep 25 19:03:44 2013
@@ -131,9 +131,14 @@ public class DuccJobProcessFC extends JC
       // If this is a work item CAS in a pipeline with an initial CM that has 
just been
       // to the CM then check if it should be sent to the last step, e.g. the 
CC.
       if (mStartsWithCasMultiplier && !internallyCreatedCas && currentStep == 
1) {
-        // has been to CM, see if should go to CC
-        Iterator<TOP> fsIter = 
this.getJCas().getJFSIndexRepository().getAllIndexedFS(Workitem.type);
-        if (fsIter.hasNext()) {
+        // Parent CAS has been to the initial CM, so see if a special flow has 
been requested.
+        // Get an iterator only if the Workitem type is in the CAS's 
typesystem 
+        // (avoids JCAS_TYPE_NOT_IN_CAS error)
+        Iterator<TOP> fsIter = null;
+        if (this.getJCas().getTypeSystem().getType(Workitem.class.getName()) 
!= null) {
+          fsIter = 
this.getJCas().getJFSIndexRepository().getAllIndexedFS(Workitem.type);
+        }
+        if (fsIter != null && fsIter.hasNext()) {
           Workitem wi = (Workitem) fsIter.next();
           if (fsIter.hasNext()) {
             throw new IllegalStateException("More than one instance of 
Workitem type");


Reply via email to