Author: billbarker
Date: Fri May 19 19:52:46 2006
New Revision: 407942

URL: http://svn.apache.org/viewvc?rev=407942&view=rev
Log:
Try and fix once and for all the compatibility issue between Tomcat and Sun's 
totally broken RMI spec.

Since 5.5 is 1.4+ only, I've removed the now unneeded calls to JdkCompat.  I 
believe that I've caught all of the code-base problems (but not really tested 
:).  I'll port to 6.0 as soon as I know that there are no vetos outstanding.

Fix for Bug #39619


Modified:
    
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java

Modified: 
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
URL: 
http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java?rev=407942&r1=407941&r2=407942&view=diff
==============================================================================
--- 
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
 (original)
+++ 
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
 Fri May 19 19:52:46 2006
@@ -62,7 +62,6 @@
 import org.apache.naming.resources.Resource;
 import org.apache.naming.resources.ResourceAttributes;
 import org.apache.tomcat.util.IntrospectionUtils;
-import org.apache.tomcat.util.compat.JdkCompat;
 
 /**
  * Specialized web application class loader.
@@ -142,10 +141,6 @@
         "javax.servlet.Servlet"                     // Servlet API
     };
 
-    /** 
-     * Jdk Compatibility Support.
-     */
-    protected static JdkCompat jdkCompat = JdkCompat.getJdkCompat();
 
     /**
      * Set of package names which are not allowed to be loaded from a webapp
@@ -555,7 +550,7 @@
         } catch (MalformedURLException e) {
             IllegalArgumentException iae = new IllegalArgumentException
                 ("Invalid repository: " + repository); 
-            jdkCompat.chainException(iae, e);
+            iae.initCause(e);
             throw iae;
         }
 
@@ -1077,7 +1072,7 @@
                             && (!(name.endsWith(".class")))) {
                         // Copy binary content to the work directory if not 
present
                         File resourceFile = new File(loaderDir, name);
-                        url = resourceFile.toURL();
+                        url = getURI(resourceFile);
                     }
                 } catch (Exception e) {
                     // Ignore
@@ -1414,9 +1409,9 @@
             URL[] urls = new URL[length];
             for (i = 0; i < length; i++) {
                 if (i < filesLength) {
-                    urls[i] = getURL(files[i]);
+                    urls[i] = getURL(files[i], true);
                 } else if (i < filesLength + jarFilesLength) {
-                    urls[i] = getURL(jarRealFiles[i - filesLength]);
+                    urls[i] = getURL(jarRealFiles[i - filesLength], true);
                 } else {
                     urls[i] = external[i - filesLength - jarFilesLength];
                 }
@@ -1844,7 +1839,7 @@
         ResourceEntry entry = new ResourceEntry();
         try {
             entry.source = getURI(new File(file, path));
-            entry.codeBase = getURL(new File(file, path));
+            entry.codeBase = getURL(new File(file, path), false);
         } catch (MalformedURLException e) {
             return null;
         }   
@@ -1970,7 +1965,7 @@
 
                     entry = new ResourceEntry();
                     try {
-                        entry.codeBase = getURL(jarRealFiles[i]);
+                        entry.codeBase = getURL(jarRealFiles[i], false);
                         String jarFakeUrl = getURI(jarRealFiles[i]).toString();
                         jarFakeUrl = "jar:" + jarFakeUrl + "!/" + path;
                         entry.source = new URL(jarFakeUrl);
@@ -2287,7 +2282,7 @@
     /**
      * Get URL.
      */
-    protected URL getURL(File file)
+    protected URL getURL(File file, boolean encoded)
         throws MalformedURLException {
 
         File realFile = file;
@@ -2296,7 +2291,11 @@
         } catch (IOException e) {
             // Ignore
         }
-        return realFile.toURL();
+        if(encoded) {
+            return getURI(realFile);
+        } else {
+            return realFile.toURL();
+        }
 
     }
 
@@ -2307,7 +2306,7 @@
     protected URL getURI(File file)
         throws MalformedURLException {
 
-        return jdkCompat.getURI(file);
+        return file.toURI().toURL();
 
     }
 



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

Reply via email to