I've had various issues with File <-> URL conversion. The best way, so far, 
appears to be:

File -> URL: new File("myfile.txt").toURI().toURL() (possibly with an 
getAbsoluteFile() in between)
URL -> File: new File(aUrl.toURI())

Other approaches appear to have problems with URL-encoding, in particular with 
spaces. Problems often start cropping up when the builds run in a Jenkins where 
the Jobs has spaces in the name.

-- Richard

Am 12.06.2013 um 00:46 schrieb [email protected]:

> Author: schor
> Date: Tue Jun 11 22:45:53 2013
> New Revision: 1492003
> 
> URL: http://svn.apache.org/r1492003
> Log:
> [UIMA-2983] make import setLocation argument be a proper form for a URL to an 
> absolute file location.
> 
> Modified:
>    
> uima/uimaj/trunk/jcasgen-maven-plugin/src/main/java/org/apache/uima/tools/jcasgen/maven/JCasGenMojo.java
> 
> Modified: 
> uima/uimaj/trunk/jcasgen-maven-plugin/src/main/java/org/apache/uima/tools/jcasgen/maven/JCasGenMojo.java
> URL: 
> http://svn.apache.org/viewvc/uima/uimaj/trunk/jcasgen-maven-plugin/src/main/java/org/apache/uima/tools/jcasgen/maven/JCasGenMojo.java?rev=1492003&r1=1492002&r2=1492003&view=diff
> ==============================================================================
> --- 
> uima/uimaj/trunk/jcasgen-maven-plugin/src/main/java/org/apache/uima/tools/jcasgen/maven/JCasGenMojo.java
>  (original)
> +++ 
> uima/uimaj/trunk/jcasgen-maven-plugin/src/main/java/org/apache/uima/tools/jcasgen/maven/JCasGenMojo.java
>  Tue Jun 11 22:45:53 2013
> @@ -134,7 +134,7 @@ public class JCasGenMojo
>         boolean contextDelta = false;
>         for (String descriptorLocation : ds.getIncludedFiles()) {
>             Import imp = new Import_impl();
> -            imp.setLocation(new File(ds.getBasedir(), 
> descriptorLocation).getAbsolutePath());
> +            imp.setLocation("file:///" + (new File(ds.getBasedir(), 
> descriptorLocation)).getAbsolutePath());
>             imports.add(imp);
> 
>             contextDelta |= this.buildContext
> 
> 

Reply via email to