tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java
Date Thu, 01 Nov 2001 18:45:01 GMT
remm        01/11/01 10:45:01

  Modified:    catalina/src/share/org/apache/catalina/loader
                        WebappClassLoader.java
  Log:
  - Clean up the URLs. I don't know if it was actually causing some problems, but it may have.
  
  Revision  Changes    Path
  1.25      +27 -12    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- WebappClassLoader.java	2001/10/31 23:17:37	1.24
  +++ WebappClassLoader.java	2001/11/01 18:45:01	1.25
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
1.24 2001/10/31 23:17:37 remm Exp $
  - * $Revision: 1.24 $
  - * $Date: 2001/10/31 23:17:37 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
1.25 2001/11/01 18:45:01 remm Exp $
  + * $Revision: 1.25 $
  + * $Date: 2001/11/01 18:45:01 $
    *
    * ====================================================================
    *
  @@ -119,12 +119,10 @@
    * <p>
    * <strong>IMPLEMENTATION NOTE</strong> - No check for sealing violations or
    * security is made unless a security manager is present.
  - * <p>
  - * <strong>FIXME</strong> - Implement findResources.
    *
    * @author Remy Maucherat
    * @author Craig R. McClanahan
  - * @version $Revision: 1.24 $ $Date: 2001/10/31 23:17:37 $
  + * @version $Revision: 1.25 $ $Date: 2001/11/01 18:45:01 $
    */
   public class WebappClassLoader
       extends URLClassLoader
  @@ -1007,7 +1005,7 @@
                   // Note : Not getting an exception here means the resource was
                   // found
                   try {
  -                    result.addElement(new File(files[i], name).toURL());
  +                    result.addElement(getURL(new File(files[i], name)));
                   } catch (MalformedURLException e) {
                       // Ignore
                   }
  @@ -1020,7 +1018,7 @@
               JarEntry jarEntry = jarFiles[i].getJarEntry(name);
               if (jarEntry != null) {
                   try {
  -                    String jarFakeUrl = jarRealFiles[i].toURL().toString();
  +                    String jarFakeUrl = getURL(jarRealFiles[i]).toString();
                       jarFakeUrl = "jar:" + jarFakeUrl + "!/" + name;
                       result.addElement(new URL(jarFakeUrl));
                   } catch (MalformedURLException e) {
  @@ -1418,9 +1416,9 @@
               URL[] urls = new URL[length];
               for (i = 0; i < length; i++) {
                   if (i < filesLength) {
  -                    urls[i] = files[i].toURL();
  +                    urls[i] = getURL(files[i]);
                   } else if (i < filesLength + jarFilesLength) {
  -                    urls[i] = jarRealFiles[i - filesLength].toURL();
  +                    urls[i] = getURL(jarRealFiles[i - filesLength]);
                   } else {
                       urls[i] = external[i - filesLength - jarFilesLength];
                   }
  @@ -1652,7 +1650,7 @@
   
                   entry = new ResourceEntry();
                   try {
  -                    entry.source = new File(files[i], path).toURL();
  +                    entry.source = getURL(new File(files[i], path));
                   } catch (MalformedURLException e) {
                       return null;
                   }
  @@ -1704,7 +1702,7 @@
   
                   entry = new ResourceEntry();
                   try {
  -                    String jarFakeUrl = jarRealFiles[i].toURL().toString();
  +                    String jarFakeUrl = getURL(jarRealFiles[i]).toString();
                       jarFakeUrl = "jar:" + jarFakeUrl + "!/" + path;
                       entry.source = new URL(jarFakeUrl);
                   } catch (MalformedURLException e) {
  @@ -1884,6 +1882,23 @@
               return false;
   
           return true;
  +
  +    }
  +
  +
  +    /**
  +     * Get URL.
  +     */
  +    protected URL getURL(File file)
  +        throws MalformedURLException {
  +
  +        File realFile = file;
  +        try {
  +            realFile = realFile.getCanonicalFile();
  +        } catch (IOException e) {
  +            // Ignore
  +        }
  +        return realFile.toURL();
   
       }
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message