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:39:04 UTC

svn commit: r498685 - /incubator/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/DocumentAnalyzer.java

Author: alally
Date: Mon Jan 22 08:39:03 2007
New Revision: 498685

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

Modified:
    incubator/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/DocumentAnalyzer.java

Modified: incubator/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/DocumentAnalyzer.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/DocumentAnalyzer.java?view=diff&rev=498685&r1=498684&r2=498685
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/DocumentAnalyzer.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/DocumentAnalyzer.java Mon Jan 22 08:39:03 2007
@@ -1248,9 +1248,35 @@
       }
 
     } catch (Throwable t) {
-      displayError(t);
+      //special check for using XML detagger with remotes, which will generate an error
+      //since sofa mappings aren't supported for remotes
+      if (usingXmlDetagger && exceptionHasMessageKey(t, ResourceInitializationException.SOFA_MAPPING_NOT_SUPPORTED_FOR_REMOTE)) {
+        displayError("The XML detagging feature is not supported for remote Analysis Engines or for Aggregates containing remotes.  " +
+           "If you are running a remote Analysis Engine the \"XML Tag Containing Text\" field must be left blank.");
+      }      
+      else {
+        displayError(t);
+      }
       aborted();
     }
+  }
+
+  /**
+   * @param t
+   * @param sofa_mapping_not_supported_for_remote
+   * @return
+   */
+  private boolean exceptionHasMessageKey(Throwable t, String messageKey) {
+    if (t instanceof UIMAException) {
+      if (messageKey.equals(((UIMAException)t).getMessageKey())) {
+        return true;
+      }
+    }
+    Throwable cause = t.getCause();
+    if (cause != null) {
+      return exceptionHasMessageKey(cause, messageKey);      
+    }
+    return false;
   }
 
   class ProcessingThread extends Thread {