ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject [2/2] ant git commit: remove re-implementations of FileUtils.close()
Date Mon, 28 Mar 2016 12:08:07 GMT
remove re-implementations of FileUtils.close()


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/a8d6367d
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/a8d6367d
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/a8d6367d

Branch: refs/heads/1.9.x
Commit: a8d6367ddc214b4956b2a7d6b779930df5e43515
Parents: cd1ff35
Author: Stefan Bodewig <bodewig@apache.org>
Authored: Mon Mar 28 14:07:23 2016 +0200
Committer: Stefan Bodewig <bodewig@apache.org>
Committed: Mon Mar 28 14:07:46 2016 +0200

----------------------------------------------------------------------
 .../tools/ant/ArgumentProcessorRegistry.java    |  7 ++----
 .../org/apache/tools/ant/DefaultLogger.java     |  4 +---
 .../org/apache/tools/ant/DemuxOutputStream.java |  7 ++----
 .../tools/ant/listener/AnsiColorLogger.java     |  9 ++-----
 src/main/org/apache/tools/ant/taskdefs/Ant.java |  6 +----
 .../org/apache/tools/ant/taskdefs/CVSPass.java  |  8 +------
 .../org/apache/tools/ant/taskdefs/Javadoc.java  |  8 ++-----
 .../org/apache/tools/ant/taskdefs/Property.java |  8 +------
 .../tools/ant/taskdefs/PumpStreamHandler.java   |  8 +++----
 .../apache/tools/ant/taskdefs/Redirector.java   | 17 +++----------
 .../ant/taskdefs/optional/EchoProperties.java   |  8 +------
 .../optional/ejb/GenericDeploymentTool.java     | 25 ++++----------------
 .../ant/taskdefs/optional/ejb/IPlanetEjbc.java  |  8 +++----
 .../optional/ejb/WeblogicDeploymentTool.java    |  7 +-----
 .../optional/ejb/WebsphereDeploymentTool.java   |  7 +-----
 .../optional/extension/JarLibManifestTask.java  |  9 ++-----
 .../ant/taskdefs/optional/jlink/jlink.java      |  8 +------
 .../junit/SummaryJUnitResultFormatter.java      |  7 ++----
 .../optional/net/FTPTaskMirrorImpl.java         | 16 ++-----------
 .../tools/ant/types/resources/TarResource.java  |  4 +---
 20 files changed, 36 insertions(+), 145 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/a8d6367d/src/main/org/apache/tools/ant/ArgumentProcessorRegistry.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/ArgumentProcessorRegistry.java b/src/main/org/apache/tools/ant/ArgumentProcessorRegistry.java
index bdb7c0a..ae95c3b 100644
--- a/src/main/org/apache/tools/ant/ArgumentProcessorRegistry.java
+++ b/src/main/org/apache/tools/ant/ArgumentProcessorRegistry.java
@@ -27,6 +27,7 @@ import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.List;
 
+import org.apache.tools.ant.util.FileUtils;
 import org.apache.tools.ant.util.LoaderUtils;
 
 /**
@@ -159,11 +160,7 @@ public class ArgumentProcessorRegistry {
                 return getProcessor(processorClassName);
             }
         } finally {
-            try {
-                isr.close();
-            } catch (IOException e) {
-                // ignore
-            }
+            FileUtils.close(isr);
         }
         return null;
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/a8d6367d/src/main/org/apache/tools/ant/DefaultLogger.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/DefaultLogger.java b/src/main/org/apache/tools/ant/DefaultLogger.java
index dbc6048..e0cd651 100644
--- a/src/main/org/apache/tools/ant/DefaultLogger.java
+++ b/src/main/org/apache/tools/ant/DefaultLogger.java
@@ -293,9 +293,7 @@ public class DefaultLogger implements BuildLogger {
                     // shouldn't be possible
                     message.append(label).append(event.getMessage());
                 } finally {
-                    if (r != null) {
-                        FileUtils.close(r);
-                    }
+                    FileUtils.close(r);
                 }
 
             } else {

http://git-wip-us.apache.org/repos/asf/ant/blob/a8d6367d/src/main/org/apache/tools/ant/DemuxOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/DemuxOutputStream.java b/src/main/org/apache/tools/ant/DemuxOutputStream.java
index bd39913..e69c3a4 100644
--- a/src/main/org/apache/tools/ant/DemuxOutputStream.java
+++ b/src/main/org/apache/tools/ant/DemuxOutputStream.java
@@ -23,6 +23,7 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.util.WeakHashMap;
 
+import org.apache.tools.ant.util.FileUtils;
 
 /**
  * Logs content written by a thread and forwards the buffers onto the
@@ -113,11 +114,7 @@ public class DemuxOutputStream extends OutputStream {
     private void resetBufferInfo() {
         Thread current = Thread.currentThread();
         BufferInfo bufferInfo = (BufferInfo) buffers.get(current);
-        try {
-            bufferInfo.buffer.close();
-        } catch (IOException e) {
-            // Shouldn't happen
-        }
+        FileUtils.close(bufferInfo.buffer);
         bufferInfo.buffer = new ByteArrayOutputStream();
         bufferInfo.crSeen = false;
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/a8d6367d/src/main/org/apache/tools/ant/listener/AnsiColorLogger.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/listener/AnsiColorLogger.java b/src/main/org/apache/tools/ant/listener/AnsiColorLogger.java
index 2e69500..7519a7e 100644
--- a/src/main/org/apache/tools/ant/listener/AnsiColorLogger.java
+++ b/src/main/org/apache/tools/ant/listener/AnsiColorLogger.java
@@ -25,6 +25,7 @@ import java.util.Properties;
 
 import org.apache.tools.ant.DefaultLogger;
 import org.apache.tools.ant.Project;
+import org.apache.tools.ant.util.FileUtils;
 
 /**
  * Uses ANSI Color Code Sequences to colorize messages
@@ -193,13 +194,7 @@ public class AnsiColorLogger extends DefaultLogger {
         } catch (IOException ioe) {
             //Ignore - we will use the defaults.
         } finally {
-            if (in != null) {
-                try {
-                    in.close();
-                } catch (IOException e) {
-                    //Ignore - We do not want this to stop the build.
-                }
-            }
+            FileUtils.close(in);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/a8d6367d/src/main/org/apache/tools/ant/taskdefs/Ant.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Ant.java b/src/main/org/apache/tools/ant/taskdefs/Ant.java
index eba4731..793d16c 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Ant.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Ant.java
@@ -456,11 +456,7 @@ public class Ant extends Task {
             }
 
             if (output != null && out != null) {
-                try {
-                    out.close();
-                } catch (final Exception ex) {
-                    //ignore
-                }
+                FileUtils.close(out);
             }
             dir = savedDir;
             antFile = savedAntFile;

http://git-wip-us.apache.org/repos/asf/ant/blob/a8d6367d/src/main/org/apache/tools/ant/taskdefs/CVSPass.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/CVSPass.java b/src/main/org/apache/tools/ant/taskdefs/CVSPass.java
index 53f5d3e..af24504 100644
--- a/src/main/org/apache/tools/ant/taskdefs/CVSPass.java
+++ b/src/main/org/apache/tools/ant/taskdefs/CVSPass.java
@@ -123,13 +123,7 @@ public class CVSPass extends Task {
         } catch (IOException e) {
             throw new BuildException(e);
         } finally {
-            if (reader != null) {
-                try {
-                    reader.close();
-                } catch (IOException e) {
-                    // ignore
-                }
-            }
+            FileUtils.close(reader);
             FileUtils.close(writer);
         }
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/a8d6367d/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
index 7637be7..f3c16ce 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
@@ -1823,12 +1823,8 @@ public class Javadoc extends Task {
 
             out.logFlush();
             err.logFlush();
-            try {
-                out.close();
-                err.close();
-            } catch (final IOException e) {
-                // ignore
-            }
+            FileUtils.close(out);
+            FileUtils.close(err);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/a8d6367d/src/main/org/apache/tools/ant/taskdefs/Property.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Property.java b/src/main/org/apache/tools/ant/taskdefs/Property.java
index 4aee3d0..ccfb356 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Property.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Property.java
@@ -630,13 +630,7 @@ public class Property extends Task {
         } catch (IOException ex) {
             throw new BuildException(ex, getLocation());
         } finally {
-            if (is != null) {
-                try {
-                    is.close();
-                } catch (IOException e) {
-                    // ignore
-                }
-            }
+            FileUtils.close(is);
             if (cleanup && cL != null) {
                 ((AntClassLoader) cL).cleanup();
             }

http://git-wip-us.apache.org/repos/asf/ant/blob/a8d6367d/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java b/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java
index 42ba0f4..0f64544 100644
--- a/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java
+++ b/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java
@@ -22,6 +22,8 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 
+import org.apache.tools.ant.util.FileUtils;
+
 /**
  * Copies standard output and error of subprocesses to standard output and
  * error of the parent process.
@@ -119,11 +121,7 @@ public class PumpStreamHandler implements ExecuteStreamHandler {
         if (input != null) {
             inputThread = createPump(input, os, true, nonBlockingRead);
         } else {
-            try {
-                os.close();
-            } catch (IOException e) {
-                //ignore
-            }
+            FileUtils.close(os);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/a8d6367d/src/main/org/apache/tools/ant/taskdefs/Redirector.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Redirector.java b/src/main/org/apache/tools/ant/taskdefs/Redirector.java
index 3b35d23..5b99d34 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Redirector.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Redirector.java
@@ -39,6 +39,7 @@ import org.apache.tools.ant.Task;
 import org.apache.tools.ant.filters.util.ChainReaderHelper;
 import org.apache.tools.ant.types.FilterChain;
 import org.apache.tools.ant.util.ConcatFileInputStream;
+import org.apache.tools.ant.util.FileUtils;
 import org.apache.tools.ant.util.KeepAliveOutputStream;
 import org.apache.tools.ant.util.LazyFileOutputStream;
 import org.apache.tools.ant.util.LeadPipeInputStream;
@@ -983,22 +984,10 @@ public class Redirector {
      */
     public void setProperties() {
         synchronized (outMutex) {
-            if (baos != null) {
-                try {
-                    baos.close();
-                } catch (final IOException eyeOhEx) {
-                    // Ignore exception
-                }
-            }
+            FileUtils.close(baos);
         }
         synchronized (errMutex) {
-            if (errorBaos != null) {
-                try {
-                    errorBaos.close();
-                } catch (final IOException eyeOhEx) {
-                    // Ignore exception
-                }
-            }
+            FileUtils.close(errorBaos);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/a8d6367d/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java b/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java
index b63ef93..d8ef51a 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java
@@ -362,13 +362,7 @@ public class EchoProperties extends Task {
                 log(ioe.getMessage(), Project.MSG_INFO);
             }
         } finally {
-            if (os != null) {
-                try {
-                    os.close();
-                } catch (IOException ex) {
-                    //ignore
-                }
-            }
+            FileUtils.close(os);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/a8d6367d/src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java
b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java
index 069bdfc..43b9237 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java
@@ -40,6 +40,7 @@ import org.apache.tools.ant.Project;
 import org.apache.tools.ant.Task;
 import org.apache.tools.ant.types.FileSet;
 import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.util.FileUtils;
 import org.apache.tools.ant.util.depend.DependencyAnalyzer;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
@@ -353,13 +354,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool {
                 + "-" + ioe.getMessage(), Project.MSG_WARN);
         } finally {
             // Close up the file input stream for the class file
-            if (iStream != null) {
-                try {
-                    iStream.close();
-                } catch (IOException closeException) {
-                    // ignore
-                }
-            }
+            FileUtils.close(iStream);
         }
     }
 
@@ -535,13 +530,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool {
             ejbFiles = handler.getFiles();
 
         } finally {
-            if (descriptorStream != null) {
-                try {
-                    descriptorStream.close();
-                } catch (IOException closeException) {
-                    // ignore
-                }
-            }
+            FileUtils.close(descriptorStream);
         }
 
         return ejbFiles;
@@ -858,13 +847,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool {
                 + ioe.getMessage();
             throw new BuildException(msg, ioe);
         } finally {
-            if (jarStream != null) {
-                try {
-                    jarStream.close();
-                } catch (IOException closeException) {
-                    // ignore
-                }
-            }
+            FileUtils.close(jarStream);
         }
     } // end of writeJar
 

http://git-wip-us.apache.org/repos/asf/ant/blob/a8d6367d/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java
index ed799d3..41e90d0 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java
@@ -42,6 +42,8 @@ import org.xml.sax.HandlerBase;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 
+import org.apache.tools.ant.util.FileUtils;
+
 /**
  * Compiles EJB stubs and skeletons for the iPlanet Application
  * Server (iAS).  The class will read a standard EJB descriptor (as well as an
@@ -1483,11 +1485,7 @@ public class IPlanetEjbc {
             } catch (IOException e) {
                 e.printStackTrace();
             } finally {
-                try {
-                    reader.close();
-                } catch (IOException e) {
-                    // Do nothing
-                }
+                FileUtils.close(reader);
             }
         }
     }  // End of RedirectOutput inner class

http://git-wip-us.apache.org/repos/asf/ant/blob/a8d6367d/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java
b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java
index 550f59c..7fae8b3 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java
@@ -883,14 +883,9 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool {
                 }
             }
 
+            FileUtils.close(newJarStream);
             if (newJarStream != null) {
                 try {
-                    newJarStream.close();
-                } catch (IOException closeException) {
-                    // empty
-                }
-
-                try {
                     FILE_UTILS.rename(newWLJarFile, weblogicJarFile);
                 } catch (IOException renameException) {
                     log(renameException.getMessage(), Project.MSG_WARN);

http://git-wip-us.apache.org/repos/asf/ant/blob/a8d6367d/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WebsphereDeploymentTool.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WebsphereDeploymentTool.java
b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WebsphereDeploymentTool.java
index d15f9f5..7114610 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WebsphereDeploymentTool.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WebsphereDeploymentTool.java
@@ -848,14 +848,9 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool {
                 }
             }
 
+            FileUtils.close(newJarStream);
             if (newJarStream != null) {
                 try {
-                    newJarStream.close();
-                } catch (IOException closeException) {
-                    // Ignore
-                }
-
-                try {
                     FILE_UTILS.rename(newwasJarFile, websphereJarFile);
                 } catch (IOException renameException) {
                     log(renameException.getMessage(), Project.MSG_WARN);

http://git-wip-us.apache.org/repos/asf/ant/blob/a8d6367d/src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibManifestTask.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibManifestTask.java
b/src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibManifestTask.java
index 5afc57f..401dcfb 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibManifestTask.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibManifestTask.java
@@ -29,6 +29,7 @@ import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.MagicNames;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.Task;
+import org.apache.tools.ant.util.FileUtils;
 
 /**
  * Generates a manifest that declares all the dependencies.
@@ -219,13 +220,7 @@ public final class JarLibManifestTask extends Task {
             manifest.write(output);
             output.flush();
         } finally {
-            if (null != output) {
-                try {
-                    output.close();
-                } catch (IOException e) {
-                    // ignore
-                }
-            }
+            FileUtils.close(output);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/a8d6367d/src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java b/src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java
index 499cca2..a788727 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java
@@ -312,13 +312,7 @@ public class jlink {
             } catch (IOException ioe) {
                 //do nothing
             } finally {
-                if (input != null) {
-                    try {
-                        input.close();
-                    } catch (IOException e) {
-                        //do nothing
-                    }
-                }
+                FileUtils.close(input);
             }
         }
         System.out.println("From " + file.getPath() + " and prefix " + prefix

http://git-wip-us.apache.org/repos/asf/ant/blob/a8d6367d/src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java
b/src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java
index 0b09fa2..4eb30fb 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java
@@ -26,6 +26,7 @@ import junit.framework.AssertionFailedError;
 import junit.framework.Test;
 
 import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.util.FileUtils;
 
 /**
  * Prints short summary output of the test to Ant's logging system.
@@ -202,11 +203,7 @@ public class SummaryJUnitResultFormatter
             writeOutputLine(sb.toString().getBytes());
         } finally {
             if (out != System.out && out != System.err) {
-                try {
-                    out.close();
-                } catch (IOException e) {
-                    // ignore
-                }
+                FileUtils.close(out);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/a8d6367d/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java
index a4f2413..81752b3 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java
@@ -1564,13 +1564,7 @@ public class FTPTaskMirrorImpl implements FTPTaskMirror {
                 transferred++;
             }
         } finally {
-            if (instream != null) {
-                try {
-                    instream.close();
-                } catch (IOException ex) {
-                    // ignore it
-                }
-            }
+            FileUtils.close(instream);
         }
     }
 
@@ -1702,13 +1696,7 @@ public class FTPTaskMirrorImpl implements FTPTaskMirror {
                 }
             }
         } finally {
-            if (outstream != null) {
-                try {
-                    outstream.close();
-                } catch (IOException ex) {
-                    // ignore it
-                }
-            }
+            FileUtils.close(outstream);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/a8d6367d/src/main/org/apache/tools/ant/types/resources/TarResource.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/resources/TarResource.java b/src/main/org/apache/tools/ant/types/resources/TarResource.java
index 62f1f26..b906a65 100644
--- a/src/main/org/apache/tools/ant/types/resources/TarResource.java
+++ b/src/main/org/apache/tools/ant/types/resources/TarResource.java
@@ -171,9 +171,7 @@ public class TarResource extends ArchiveResource {
             log(e.getMessage(), Project.MSG_DEBUG);
             throw new BuildException(e);
         } finally {
-            if (i != null) {
-                FileUtils.close(i);
-            }
+            FileUtils.close(i);
         }
         setEntry(null);
     }


Mime
View raw message