You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by cw...@apache.org on 2010/04/28 23:01:56 UTC

svn commit: r939088 - /uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/AggregateAnalysisEngineController_impl.java

Author: cwiklik
Date: Wed Apr 28 21:01:56 2010
New Revision: 939088

URL: http://svn.apache.org/viewvc?rev=939088&view=rev
Log:
UIMA-1773 Catch an invalid step objects when executing a flow step

Modified:
    uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/AggregateAnalysisEngineController_impl.java

Modified: uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/AggregateAnalysisEngineController_impl.java
URL: http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/AggregateAnalysisEngineController_impl.java?rev=939088&r1=939087&r2=939088&view=diff
==============================================================================
--- uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/AggregateAnalysisEngineController_impl.java (original)
+++ uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/AggregateAnalysisEngineController_impl.java Wed Apr 28 21:01:56 2010
@@ -31,6 +31,7 @@ import java.util.concurrent.ConcurrentHa
 import java.util.concurrent.Semaphore;
 
 import org.apache.uima.UIMAFramework;
+import org.apache.uima.UIMARuntimeException;
 import org.apache.uima.aae.AsynchAECasManager;
 import org.apache.uima.aae.InProcessCache;
 import org.apache.uima.aae.InputChannel;
@@ -2154,7 +2155,6 @@ public class AggregateAnalysisEngineCont
               "executeFlowStep", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_step__FINEST",
               new Object[] { getComponentName(), aCasReferenceId });
     }
-
     try {
       if (step instanceof SimpleStep) {
         simpleStep((SimpleStep) step, aCasReferenceId);
@@ -2173,19 +2173,37 @@ public class AggregateAnalysisEngineCont
           }
         }
         finalStep((FinalStep) step, aCasReferenceId);
+      } else {
+        //  catch all case. If we are here, there is a fatal configuration problem of the 
+        //  flow controller 
+        UIMAFramework.getLogger(CLASS_NAME).logrb(Level.SEVERE, CLASS_NAME.getName(),
+                  "executeFlowStep", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+                  "UIMAEE_invalid_step__SEVERE",
+                  new Object[] { getComponentName(), step, aCasReferenceId });
+        throw new UIMARuntimeException(new Exception("Invalid Flow Step:"+step+" Object. Check Descriptor For Invalid AE Key" )); 
       }
-      if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINEST)) {
-        UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINEST, CLASS_NAME.getName(),
-                "executeFlowStep", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
-                "UIMAEE_completed_step__FINEST",
-                new Object[] { getComponentName(), aCasReferenceId });
+      if ( UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINEST)) {
+          UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINEST, CLASS_NAME.getName(),
+                  "executeFlowStep", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+                  "UIMAEE_completed_step__FINEST",
+                  new Object[] { getComponentName(), aCasReferenceId });
       }
 
     } catch (Exception e) {
-      HashMap map = new HashMap();
-      map.put(AsynchAEMessage.Command, AsynchAEMessage.Process);
-      map.put(AsynchAEMessage.CasReference, aCasReferenceId);
-      handleError(map, e);
+//      HashMap map = new HashMap();
+//      map.put(AsynchAEMessage.Command, AsynchAEMessage.Process);
+//      map.put(AsynchAEMessage.CasReference, aCasReferenceId);
+      ErrorContext ec = new ErrorContext();
+      ec.add(ErrorContext.THROWABLE_ERROR, e);
+      ec.add(AsynchAEMessage.CasReference, aCasReferenceId);
+      try {
+        handleAction(ErrorHandler.TERMINATE, null, ec);
+      } catch( Exception ex) {
+        UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(),
+                "executeFlowStep", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+                "UIMAEE_exception__WARNING", ex);
+      }
+//      handleError(map, e);
     }
   }