You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by st...@apache.org on 2007/04/27 22:40:14 UTC

svn commit: r533214 - /ant/core/trunk/src/main/org/apache/tools/ant/AntClassLoader.java

Author: stevel
Date: Fri Apr 27 13:40:13 2007
New Revision: 533214

URL: http://svn.apache.org/viewvc?view=rev&rev=533214
Log:
little bit of code review

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/AntClassLoader.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/AntClassLoader.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/AntClassLoader.java?view=diff&rev=533214&r1=533213&r2=533214
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/AntClassLoader.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/AntClassLoader.java Fri Apr 27 13:40:13 2007
@@ -35,6 +35,7 @@
 import java.util.Map;
 import java.util.StringTokenizer;
 import java.util.Vector;
+import java.util.Locale;
 import java.util.jar.Attributes;
 import java.util.jar.Attributes.Name;
 import java.util.jar.JarFile;
@@ -212,7 +213,7 @@
      */
     private Hashtable zipFiles = new Hashtable();
 
-    /** Static map of jar file/time to manifiest class-path entries */
+    /** Static map of jar file/time to manifest class-path entries */
     private static Map/*<String,String>*/ pathMap = Collections.synchronizedMap(new HashMap());
 
     /**
@@ -515,9 +516,7 @@
             } catch (org.apache.tools.ant.taskdefs.ManifestException e) {
                 // ignore
             } finally {
-                if (manifestStream != null) {
-                    manifestStream.close();
-                }
+                FileUtils.close(manifestStream);
                 if (jarFile != null) {
                     jarFile.close();
                 }
@@ -829,6 +828,9 @@
                 if (zipFile == null) {
                     zipFile = new ZipFile(file);
                     zipFiles.put(file, zipFile);
+                    //to eliminate a race condition, retrieve the entry
+                    //that is in the hash table under that filename
+                    zipFile = (ZipFile) zipFiles.get(file);
                 }
                 ZipEntry entry = zipFile.getEntry(resourceName);
                 if (entry != null) {
@@ -1276,7 +1278,8 @@
             }
         }
 
-        if (sealedString != null && sealedString.equalsIgnoreCase("true")) {
+        if (sealedString != null
+                && sealedString.toLowerCase(Locale.ENGLISH).equals("true")) {
             try {
                 sealBase = new URL(FileUtils.getFileUtils().toURI(container.getAbsolutePath()));
             } catch (MalformedURLException e) {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org