bodewig     2003/02/03 07:43:57

  Modified:    src/main/org/apache/tools/ant/taskdefs Tag: ANT_15_BRANCH
                        Jar.java
  Log:
  merge from HEAD
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.51.2.13 +10 -1     
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Jar.java
  
  Index: Jar.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Jar.java,v
  retrieving revision 1.51.2.12
  retrieving revision 1.51.2.13
  diff -u -r1.51.2.12 -r1.51.2.13
  --- Jar.java  17 Jan 2003 12:50:28 -0000      1.51.2.12
  +++ Jar.java  3 Feb 2003 15:43:57 -0000       1.51.2.13
  @@ -167,8 +167,9 @@
       public void setDestFile(File jarFile) {
           super.setDestFile(jarFile);
           if (jarFile.exists()) {
  +            ZipFile zf = null;
               try {
  -                ZipFile zf = new ZipFile(jarFile);
  +                zf = new ZipFile(jarFile);
   
                   // must not use getEntry as "well behaving" applications
                   // must accept the manifest in any capitalization
  @@ -184,6 +185,14 @@
               } catch (Throwable t) {
                   log("error while reading original manifest: " + 
t.getMessage(),
                       Project.MSG_WARN);
  +            } finally {
  +                if (zf != null) {
  +                    try {
  +                        zf.close();
  +                    } catch (IOException e) {
  +                        // XXX - log an error?  throw an exception?
  +                    }
  +                }
               }
           }
       }
  
  
  

Reply via email to