You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by al...@apache.org on 2007/01/22 17:54:23 UTC

svn commit: r498695 - /incubator/uima/uimaj/trunk/uimaj-examples/src/main/java/org/apache/uima/examples/RunAE.java

Author: alally
Date: Mon Jan 22 08:54:23 2007
New Revision: 498695

URL: http://svn.apache.org/viewvc?view=rev&rev=498695
Log:
Generate better error message if user tries to turn on XML 
detagging feature of RunAE when running a remote AE.
UIMA-213: https://issues.apache.org/jira/browse/UIMA-213

Modified:
    incubator/uima/uimaj/trunk/uimaj-examples/src/main/java/org/apache/uima/examples/RunAE.java

Modified: incubator/uima/uimaj/trunk/uimaj-examples/src/main/java/org/apache/uima/examples/RunAE.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-examples/src/main/java/org/apache/uima/examples/RunAE.java?view=diff&rev=498695&r1=498694&r2=498695
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-examples/src/main/java/org/apache/uima/examples/RunAE.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-examples/src/main/java/org/apache/uima/examples/RunAE.java Mon Jan 22 08:54:23 2007
@@ -22,6 +22,7 @@
 import java.io.File;
 import java.util.Iterator;
 
+import org.apache.uima.UIMAException;
 import org.apache.uima.UIMAFramework;
 import org.apache.uima.cas.CAS;
 import org.apache.uima.cas.FSIterator;
@@ -38,6 +39,7 @@
 import org.apache.uima.collection.metadata.CpeDescription;
 import org.apache.uima.collection.metadata.CpeSofaMapping;
 import org.apache.uima.collection.metadata.CpeSofaMappings;
+import org.apache.uima.resource.ResourceInitializationException;
 import org.apache.uima.tools.components.FileSystemCollectionReader;
 import org.apache.uima.tools.components.InlineXmlCasConsumer;
 import org.apache.uima.tools.components.XmlDetagger;
@@ -199,9 +201,18 @@
       docsProcessed = 0;
       mCPE.process();
     } catch (Exception e) {
-      e.printStackTrace();
+      //special check for using XML detagger with remotes, which will generate an error
+      //since sofa mappings aren't supported for remotes
+      if (xmlTagName != null && xmlTagName.length() > 0 && e instanceof UIMAException &&
+              ((UIMAException)e).hasMessageKey(ResourceInitializationException.SOFA_MAPPING_NOT_SUPPORTED_FOR_REMOTE)) {
+        System.err.println("The XML detagging feature (-t) is not supported for remote Analysis Engines or for Aggregates containing remotes.");
+      }
+      else {
+        e.printStackTrace();
+      }
     }
   }
+  
 
   /**
    * @see org.apache.uima.collection.base_cpm.BaseStatusCallbackListener#initializationComplete()