geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject cvs commit: incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/scanner URLType.java
Date Wed, 03 Sep 2003 10:40:54 GMT
jdillon     2003/09/03 03:40:54

  Modified:    modules/core/src/java/org/apache/geronimo/deployment/scanner
                        URLType.java
  Log:
   o Applied patch GERONIMO-44
  
  Revision  Changes    Path
  1.2       +14 -7     incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/scanner/URLType.java
  
  Index: URLType.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/scanner/URLType.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- URLType.java	12 Aug 2003 07:10:15 -0000	1.1
  +++ URLType.java	3 Sep 2003 10:40:53 -0000	1.2
  @@ -58,9 +58,11 @@
   import java.io.File;
   import java.io.IOException;
   import java.io.InputStream;
  +
   import java.net.JarURLConnection;
   import java.net.URL;
   import java.net.URLConnection;
  +
   import java.util.jar.JarFile;
   import java.util.zip.ZipException;
   
  @@ -69,8 +71,10 @@
    *
    * @version $Revision$ $Date$
    */
  -public class URLType {
  -    private final String desc;
  +public class URLType
  +{
  +    public static final String MANIFEST_LOCATON = "META-INF/MANIFEST.MF";
  +    
       public static final URLType RESOURCE = new URLType("RESOURCE");
       public static final URLType COLLECTION = new URLType("COLLECTION");
       public static final URLType PACKED_ARCHIVE = new URLType("PACKED_ARCHIVE");
  @@ -80,7 +84,7 @@
           if (file.isDirectory()) {
               // file is a directory - see if it has a manifest
               // we check for an actual manifest file to keep things consistent with a packed
archive
  -            if (new File(file, "META-INF/MANIFEST.MF").exists()) {
  +            if (new File(file, MANIFEST_LOCATON).exists()) {
                   return UNPACKED_ARCHIVE;
               } else {
                   return COLLECTION;
  @@ -90,6 +94,7 @@
               try {
                   JarFile jar = new JarFile(file);
                   jar.getManifest();
  +                jar.close();
                   return PACKED_ARCHIVE;
               } catch (ZipException e) {
                   return RESOURCE;
  @@ -99,7 +104,7 @@
   
       public static URLType getType(URL url) throws IOException {
           if (url.toString().endsWith("/")) {
  -            URL metaInfURL = new URL(url, "META-INF/MANIFEST.MF");
  +            URL metaInfURL = new URL(url, MANIFEST_LOCATON);
               URLConnection urlConnection = metaInfURL.openConnection();
               urlConnection.connect();
               try {
  @@ -120,8 +125,10 @@
               }
           }
       }
  -
  -    private URLType(String desc) {
  +    
  +    private final String desc;
  +    
  +    private URLType(final String desc) {
           this.desc = desc;
       }
   
  
  
  

Mime
View raw message