fix for ETCH-69: Compiler throws URISyntaxException if there are spaces in the classpath.
git-svn-id: https://svn.apache.org/repos/asf/incubator/etch/branches/sr-1.0.2.1@768704 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/src/main/java/etch/compiler/EtchCompiler.java b/compiler/src/main/java/etch/compiler/EtchCompiler.java
index 176a36e..b661ec9 100644
--- a/compiler/src/main/java/etch/compiler/EtchCompiler.java
+++ b/compiler/src/main/java/etch/compiler/EtchCompiler.java
@@ -22,6 +22,7 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.net.URI;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
@@ -219,7 +220,10 @@
String s = u.toString();
if (s.startsWith( "file:" ) && s.endsWith( ".jar" ))
{
- File f = new File( u.toURI() );
+ final String scheme = "file";
+ final String path = s.substring( scheme.length() + 1 );
+ // multi-arg constructor properly escapes paths
+ File f = new File( new URI( scheme, null, path, null ) );
if (f.isFile() && f.canRead())
{
s = f.getCanonicalPath();