You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@apache.org on 2005/05/13 10:13:50 UTC

cvs commit: ant/src/main/org/apache/tools/ant/taskdefs BUnzip2.java GUnzip.java

bodewig     2005/05/13 01:13:50

  Modified:    src/main/org/apache/tools/ant/taskdefs BUnzip2.java
                        GUnzip.java
  Log:
  Use FileUtils.close()
  
  Revision  Changes    Path
  1.18      +5 -28     ant/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java
  
  Index: BUnzip2.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- BUnzip2.java	25 Jan 2005 16:09:47 -0000	1.17
  +++ BUnzip2.java	13 May 2005 08:13:50 -0000	1.18
  @@ -23,6 +23,7 @@
   import java.io.FileOutputStream;
   import java.io.IOException;
   import org.apache.tools.ant.BuildException;
  +import org.apache.tools.ant.util.FileUtils;
   import org.apache.tools.bzip2.CBZip2InputStream;
   
   /**
  @@ -82,34 +83,10 @@
                   String msg = "Problem expanding bzip2 " + ioe.getMessage();
                   throw new BuildException(msg, ioe, getLocation());
               } finally {
  -                if (bis != null) {
  -                    try {
  -                        bis.close();
  -                    } catch (IOException ioex) {
  -                        // ignore
  -                    }
  -                }
  -                if (fis != null) {
  -                    try {
  -                        fis.close();
  -                    } catch (IOException ioex) {
  -                        // ignore
  -                    }
  -                }
  -                if (out != null) {
  -                    try {
  -                        out.close();
  -                    } catch (IOException ioex) {
  -                        // ignore
  -                    }
  -                }
  -                if (zIn != null) {
  -                    try {
  -                        zIn.close();
  -                    } catch (IOException ioex) {
  -                        // ignore
  -                    }
  -                }
  +                FileUtils.close(bis);
  +                FileUtils.close(fis);
  +                FileUtils.close(out);
  +                FileUtils.close(zIn);
               }
           }
       }
  
  
  
  1.26      +4 -21     ant/src/main/org/apache/tools/ant/taskdefs/GUnzip.java
  
  Index: GUnzip.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/GUnzip.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- GUnzip.java	11 Mar 2005 15:16:24 -0000	1.25
  +++ GUnzip.java	13 May 2005 08:13:50 -0000	1.26
  @@ -22,6 +22,7 @@
   import java.io.IOException;
   import java.util.zip.GZIPInputStream;
   import org.apache.tools.ant.BuildException;
  +import org.apache.tools.ant.util.FileUtils;
   
   /**
    * Expands a file that has been compressed with the GZIP
  @@ -70,27 +71,9 @@
                   String msg = "Problem expanding gzip " + ioe.getMessage();
                   throw new BuildException(msg, ioe, getLocation());
               } finally {
  -                if (fis != null) {
  -                    try {
  -                        fis.close();
  -                    } catch (IOException ioex) {
  -                        //ignore
  -                    }
  -                }
  -                if (out != null) {
  -                    try {
  -                        out.close();
  -                    } catch (IOException ioex) {
  -                        //ignore
  -                    }
  -                }
  -                if (zIn != null) {
  -                    try {
  -                        zIn.close();
  -                    } catch (IOException ioex) {
  -                        //ignore
  -                    }
  -                }
  +                FileUtils.close(fis);
  +                FileUtils.close(out);
  +                FileUtils.close(zIn);
               }
           }
       }
  
  
  

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