You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by di...@apache.org on 2007/01/28 07:44:26 UTC

svn commit: r500746 - /geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/classloader/UrlResourceFinder.java

Author: dims
Date: Sat Jan 27 22:44:26 2007
New Revision: 500746

URL: http://svn.apache.org/viewvc?view=rev&rev=500746
Log:
i keep forgetting that javax.servlet.UnavailableException is actually caused by failure to load jars when the path is long. So, added a log to tell the user that we are not able to load the jars

Modified:
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/classloader/UrlResourceFinder.java

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/classloader/UrlResourceFinder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/classloader/UrlResourceFinder.java?view=diff&rev=500746&r1=500745&r2=500746
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/classloader/UrlResourceFinder.java (original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/classloader/UrlResourceFinder.java Sat Jan 27 22:44:26 2007
@@ -16,6 +16,9 @@
  */
 package org.apache.geronimo.kernel.classloader;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
 import java.io.File;
 import java.io.IOException;
 import java.io.FileNotFoundException;
@@ -32,6 +35,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.StringTokenizer;
+import java.util.zip.ZipException;
 import java.util.jar.Attributes;
 import java.util.jar.Manifest;
 import java.util.jar.JarFile;
@@ -40,6 +44,7 @@
  * @version $Rev$ $Date$
  */
 public class UrlResourceFinder implements ResourceFinder {
+    private static final Log log = LogFactory.getLog(UrlResourceFinder.class);
     private final Object lock = new Object();
 
     private final LinkedHashSet urls = new LinkedHashSet();
@@ -253,7 +258,16 @@
             // do not user the DirectoryResourceLocation for non file based urls
             resourceLocation = new DirectoryResourceLocation(cacheFile);
         } else {
-            resourceLocation = new JarResourceLocation(codeSource, new JarFile(cacheFile));
+            JarFile jarFile;
+            try {
+                jarFile = new JarFile(cacheFile);
+            } catch (ZipException ze){
+                // We get this exception on windows when the
+                // path to the jar file gets too long (Bug ID: 6374379)
+                log.info("File is unusable: " + cacheFile.getAbsolutePath());
+                throw ze;
+            }
+            resourceLocation = new JarResourceLocation(codeSource, jarFile);
         }
         return resourceLocation;
     }