You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2009/12/07 02:43:30 UTC

svn commit: r887816 - /geronimo/server/trunk/framework/modules/geronimo-common/src/main/java/org/apache/geronimo/common/FileUtils.java

Author: gawor
Date: Mon Dec  7 01:43:28 2009
New Revision: 887816

URL: http://svn.apache.org/viewvc?rev=887816&view=rev
Log:
some jars don't have manifest file

Modified:
    geronimo/server/trunk/framework/modules/geronimo-common/src/main/java/org/apache/geronimo/common/FileUtils.java

Modified: geronimo/server/trunk/framework/modules/geronimo-common/src/main/java/org/apache/geronimo/common/FileUtils.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-common/src/main/java/org/apache/geronimo/common/FileUtils.java?rev=887816&r1=887815&r2=887816&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-common/src/main/java/org/apache/geronimo/common/FileUtils.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-common/src/main/java/org/apache/geronimo/common/FileUtils.java Mon Dec  7 01:43:28 2009
@@ -29,17 +29,16 @@
  * @version $Rev$ $Date$
  */
 public class FileUtils {
+    
     /**
-     * Determine whether a file is a JAR File.
+     * Determine whether a file is a JAR File. 
+     * 
+     * Note: Jar file is a zip file with an *optional* META-INF directory.
+     * Therefore, there is no reliable way to check if a file is a Jar file.  
+     * So this functions returns the same as calling isZipFile(File).
      */
     public static boolean isJarFile(File file) throws IOException {
-        if(!isZipFile(file)) {
-            return false;
-        }
-        ZipFile zip = new ZipFile(file);
-        boolean manifest = zip.getEntry("META-INF/MANIFEST.MF") != null;
-        zip.close();
-        return manifest;
+        return isZipFile(file);
     }
 
     /**