ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm...@apache.org
Subject svn commit: r1532505 - /ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/ae/SHARPKnowtatorXMLReader.java
Date Tue, 15 Oct 2013 19:56:34 GMT
Author: tmill
Date: Tue Oct 15 19:56:34 2013
New Revision: 1532505

URL: http://svn.apache.org/r1532505
Log:
Fixes CTAKES-249. Checks for File with given URI and if doesn't exist tries again with new
filename.

Modified:
    ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/ae/SHARPKnowtatorXMLReader.java

Modified: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/ae/SHARPKnowtatorXMLReader.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/ae/SHARPKnowtatorXMLReader.java?rev=1532505&r1=1532504&r2=1532505&view=diff
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/ae/SHARPKnowtatorXMLReader.java
(original)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/ae/SHARPKnowtatorXMLReader.java
Tue Oct 15 19:56:34 2013
@@ -110,6 +110,7 @@ import org.apache.uima.jcas.JCas;
 import org.apache.uima.jcas.cas.FSArray;
 import org.apache.uima.jcas.cas.TOP;
 import org.apache.uima.jcas.tcas.Annotation;
+import org.apache.uima.util.UriUtils;
 import org.jdom2.JDOMException;
 import org.uimafit.component.JCasAnnotator_ImplBase;
 import org.uimafit.component.xwriter.XWriter;
@@ -171,15 +172,16 @@ public class SHARPKnowtatorXMLReader ext
   
   /**
    * Get the URI for the Knowtator XML file that should be loaded
+   * @throws URISyntaxException 
    */
   protected URI getKnowtatorURI(JCas jCas) throws AnalysisEngineProcessException {
     String textURI = this.getTextURI(jCas).toString();
     String xmlURI = textURI.replaceAll("Knowtator[/\\\\]text", "Knowtator_XML") + ".knowtator.xml";
-    try {
-      return new URI(xmlURI);
-    } catch (URISyntaxException e) {
-      throw new AnalysisEngineProcessException(e);
+    File fileTest = new File(URI.create(xmlURI));
+    if(!fileTest.exists()){
+      xmlURI = xmlURI.replace("_XML", " XML");
     }
+    return UriUtils.create(xmlURI);
   }
 
   /**



Mime
View raw message