uima-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject svn commit: r999567 - in /uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/components: XCasWriterCasConsumer.java XmiWriterCasConsumer.java
Date Tue, 21 Sep 2010 19:34:55 GMT
Author: schor
Date: Tue Sep 21 19:34:54 2010
New Revision: 999567

URL: http://svn.apache.org/viewvc?rev=999567&view=rev
Log:
[UIMA-1879] handle blanks in file paths

Modified:
    uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/components/XCasWriterCasConsumer.java
    uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/components/XmiWriterCasConsumer.java

Modified: uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/components/XCasWriterCasConsumer.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/components/XCasWriterCasConsumer.java?rev=999567&r1=999566&r2=999567&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/components/XCasWriterCasConsumer.java
(original)
+++ uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/components/XCasWriterCasConsumer.java
Tue Sep 21 19:34:54 2010
@@ -24,6 +24,8 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.net.URL;
 
 import org.apache.uima.UIMAFramework;
@@ -104,13 +106,17 @@ public class XCasWriterCasConsumer exten
       SourceDocumentInformation fileLoc = (SourceDocumentInformation) it.next();
       File inFile;
       try {
-        inFile = new File(new URL(fileLoc.getUri()).getPath());
+        // handle blanks in path
+        // https://issues.apache.org/jira/browse/UIMA-1748
+        URI uri = new URI(fileLoc.getUri());
+        inFile = new File(uri);
+
         String outFileName = inFile.getName();
         if (fileLoc.getOffsetInSource() > 0) {
           outFileName += fileLoc.getOffsetInSource();
         }
         outFile = new File(mOutputDir, outFileName);
-      } catch (MalformedURLException e1) {
+      } catch (URISyntaxException e) {
         // invalid URL, use default processing below
       }
     }

Modified: uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/components/XmiWriterCasConsumer.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/components/XmiWriterCasConsumer.java?rev=999567&r1=999566&r2=999567&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/components/XmiWriterCasConsumer.java
(original)
+++ uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/components/XmiWriterCasConsumer.java
Tue Sep 21 19:34:54 2010
@@ -24,6 +24,8 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.net.URL;
 
 import org.apache.uima.UIMAFramework;
@@ -98,7 +100,10 @@ public class XmiWriterCasConsumer extend
       SourceDocumentInformation fileLoc = (SourceDocumentInformation) it.next();
       File inFile;
       try {
-        inFile = new File(new URL(fileLoc.getUri()).getPath());
+        // handle blanks in path
+        // https://issues.apache.org/jira/browse/UIMA-1748
+        URI uri = new URI(fileLoc.getUri());
+        inFile = new File(uri);
         String outFileName = inFile.getName();
         if (fileLoc.getOffsetInSource() > 0) {
           outFileName += ("_" + fileLoc.getOffsetInSource());
@@ -106,8 +111,8 @@ public class XmiWriterCasConsumer extend
         outFileName += ".xmi";
         outFile = new File(mOutputDir, outFileName);
         modelFileName = mOutputDir.getAbsolutePath() + "/" + inFile.getName() + ".ecore";
-      } catch (MalformedURLException e1) {
-        // invalid URL, use default processing below
+      } catch (URISyntaxException e) {
+        // bad URI, use default processing below
       }
     }
     if (outFile == null) {



Mime
View raw message