bodewig     2004/04/20 06:25:08

  Modified:    src/main/org/apache/tools/ant AntClassLoader.java
  Log:
  Generate proper file URLs in AntClassLoader#getResource, PR: 28060
  
  Revision  Changes    Path
  1.82      +5 -2      ant/src/main/org/apache/tools/ant/AntClassLoader.java
  
  Index: AntClassLoader.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/AntClassLoader.java,v
  retrieving revision 1.81
  retrieving revision 1.82
  diff -u -r1.81 -r1.82
  --- AntClassLoader.java       9 Mar 2004 16:47:59 -0000       1.81
  +++ AntClassLoader.java       20 Apr 2004 13:25:08 -0000      1.82
  @@ -32,6 +32,7 @@
   import java.util.zip.ZipEntry;
   import java.util.zip.ZipFile;
   import org.apache.tools.ant.types.Path;
  +import org.apache.tools.ant.util.FileUtils;
   import org.apache.tools.ant.util.JavaEnvUtils;
   import org.apache.tools.ant.util.LoaderUtils;
   
  @@ -45,6 +46,8 @@
    */
   public class AntClassLoader extends ClassLoader implements BuildListener {
   
  +    private static final FileUtils fileUtils = FileUtils.newFileUtils();
  +
       /**
        * An enumeration of all resources of a given name found within the
        * classpath of this class loader. This enumeration is used by the
  @@ -888,7 +891,7 @@
   
                   if (resource.exists()) {
                       try {
  -                        return new URL("file:" + resource.toString());
  +                        return fileUtils.getFileURL(resource);
                       } catch (MalformedURLException ex) {
                           return null;
                       }
  @@ -903,7 +906,7 @@
                   ZipEntry entry = zipFile.getEntry(resourceName);
                   if (entry != null) {
                       try {
  -                        return new URL("jar:file:" + file.toString()
  +                        return new URL("jar:" + fileUtils.getFileURL(file)
                               + "!/" + entry);
                       } catch (MalformedURLException ex) {
                           return null;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to