geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r811979 - /geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/classloader/JarFileUrlConnection.java
Date Mon, 07 Sep 2009 03:09:50 GMT
Author: xuhaihong
Date: Mon Sep  7 03:09:50 2009
New Revision: 811979

URL: http://svn.apache.org/viewvc?rev=811979&view=rev
Log:
GERONIMO-4785 "useCaches" property of JarFileUrlConnection doesn't work (Patch from Jack Cai)

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

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/classloader/JarFileUrlConnection.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/classloader/JarFileUrlConnection.java?rev=811979&r1=811978&r2=811979&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/classloader/JarFileUrlConnection.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/classloader/JarFileUrlConnection.java
Mon Sep  7 03:09:50 2009
@@ -67,7 +67,11 @@
     }
 
     public JarFile getJarFile() throws IOException {
-        return jarFile;
+        if (getUseCaches()) {
+            return jarFile;
+        } else {
+            return new JarFile(jarFile.getName());
+        }
     }
 
     public synchronized void connect() {
@@ -86,7 +90,13 @@
     }
 
     public JarEntry getJarEntry() {
-        return jarEntry;
+        if (getUseCaches()) {
+            return jarEntry;
+        } else {
+            //return (JarEntry) jarEntry.clone();
+            // There is a clone method, but the below way might be safer.
+            return jarFile.getJarEntry(jarEntry.getName());
+        }
     }
 
     public Attributes getAttributes() throws IOException {
@@ -122,7 +132,7 @@
     }
 
     public Permission getPermission() throws IOException {
-        URL jarFileUrl = new File(jarFile.getName()).toURL();
+        URL jarFileUrl = new File(jarFile.getName()).toURI().toURL();
         return jarFileUrl.openConnection().getPermission();
     }
 



Mime
View raw message