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-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java
Date Thu, 07 Nov 2002 17:24:37 GMT
remm        2002/11/07 09:24:37

  Modified:    catalina/src/share/org/apache/catalina/loader
                        WebappClassLoader.java
  Log:
  - Experimental change: add getURI method to properly encode codebase URLs.
  
  Revision  Changes    Path
  1.11      +25 -8     jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- WebappClassLoader.java	16 Oct 2002 16:08:29 -0000	1.10
  +++ WebappClassLoader.java	7 Nov 2002 17:24:37 -0000	1.11
  @@ -945,7 +945,7 @@
                   // Note : Not getting an exception here means the resource was
                   // found
                   try {
  -                    result.addElement(getURL(new File(files[i], name)));
  +                    result.addElement(getURI(new File(files[i], name)));
                   } catch (MalformedURLException e) {
                       // Ignore
                   }
  @@ -958,7 +958,7 @@
               JarEntry jarEntry = jarFiles[i].getJarEntry(name);
               if (jarEntry != null) {
                   try {
  -                    String jarFakeUrl = getURL(jarRealFiles[i]).toString();
  +                    String jarFakeUrl = getURI(jarRealFiles[i]).toString();
                       jarFakeUrl = "jar:" + jarFakeUrl + "!/" + name;
                       result.addElement(new URL(jarFakeUrl));
                   } catch (MalformedURLException e) {
  @@ -1563,7 +1563,7 @@
       private ResourceEntry findResourceInternal(File file, String path){
           ResourceEntry entry = new ResourceEntry();
           try {
  -            entry.source = getURL(new File(file, path));
  +            entry.source = getURI(new File(file, path));
               entry.codeBase = entry.source;
           } catch (MalformedURLException e) {
               return null;
  @@ -1676,7 +1676,7 @@
   
                   entry = new ResourceEntry();
                   try {
  -                    entry.codeBase = getURL(jarRealFiles[i]);
  +                    entry.codeBase = getURI(jarRealFiles[i]);
                       String jarFakeUrl = entry.codeBase.toString();
                       jarFakeUrl = "jar:" + jarFakeUrl + "!/" + path;
                       entry.source = new URL(jarFakeUrl);
  @@ -1939,6 +1939,23 @@
               // Ignore
           }
           return realFile.toURL();
  +
  +    }
  +
  +
  +    /**
  +     * Get URL.
  +     */
  +    protected URL getURI(File file)
  +        throws MalformedURLException {
  +
  +        File realFile = file;
  +        try {
  +            realFile = realFile.getCanonicalFile();
  +        } catch (IOException e) {
  +            // Ignore
  +        }
  +        return realFile.toURI().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