From 88f6a102293dc1fe277ec2fc50761b798101fc3b Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Mon, 17 Feb 2003 13:48:35 +0000 Subject: [PATCH] remove logging from ZipScanner. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274101 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tools/ant/taskdefs/Zip.java | 2 - .../apache/tools/ant/types/ZipScanner.java | 59 +++---------------- 2 files changed, 7 insertions(+), 54 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/Zip.java b/src/main/org/apache/tools/ant/taskdefs/Zip.java index e6a015c72..d3fff8145 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Zip.java +++ b/src/main/org/apache/tools/ant/taskdefs/Zip.java @@ -665,8 +665,6 @@ public class Zip extends MatchingTask { private synchronized ZipScanner getZipScanner() { if (zs == null) { zs = new ZipScanner(); - // set the task of the zip scanner so that it can log properly - zs.setTask(this); zs.setSrc(zipFile); } return zs; diff --git a/src/main/org/apache/tools/ant/types/ZipScanner.java b/src/main/org/apache/tools/ant/types/ZipScanner.java index f47538670..f1487070d 100644 --- a/src/main/org/apache/tools/ant/types/ZipScanner.java +++ b/src/main/org/apache/tools/ant/types/ZipScanner.java @@ -64,9 +64,9 @@ import java.util.zip.ZipInputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipException; +import org.apache.tools.ant.BuildException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.Project; -import org.apache.tools.ant.Task; /** * ZipScanner accesses the pattern matching algorithm in DirectoryScanner, @@ -84,10 +84,6 @@ public class ZipScanner extends DirectoryScanner { * The zip file which should be scanned. */ protected File srcFile; - /** - * The current task, used to report errors, ... - */ - private Task task; /** * to record the last scanned zip file with its modification date */ @@ -106,17 +102,6 @@ public class ZipScanner extends DirectoryScanner { public void setSrc(File srcFile) { this.srcFile = srcFile; } - /** - * Sets the current task. This is used to provide proper logging - * for exceptions - * - * @param task the current task - * - * @since Ant 1.5.2 - */ - public void setTask(Task task) { - this.task = task; - } /** * Returns the names of the files which matched at least one of the @@ -245,25 +230,14 @@ public class ZipScanner extends DirectoryScanner { return; } - if (task != null) { - task.log("checking zip entries: " + srcFile, Project.MSG_VERBOSE); - } - ZipEntry entry = null; ZipInputStream in = null; myentries = new Hashtable(); try { try { in = new ZipInputStream(new FileInputStream(srcFile)); - if (task != null) { - task.log("opening input stream from " + srcFile, - Project.MSG_DEBUG); - } } catch (IOException ex) { - // XXX - throw a BuildException instead ?? - if (task != null) { - task.log("problem opening "+srcFile,Project.MSG_ERR); - } + throw new BuildException("problem opening " + srcFile, ex); } while (true) { @@ -276,39 +250,20 @@ public class ZipScanner extends DirectoryScanner { new Resource(entry.getName(), true, entry.getTime(), entry.isDirectory())); - if (task != null) { - task.log("adding entry " + entry.getName() + " from " - + srcFile, Project.MSG_DEBUG); - } - } catch (ZipException ex) { - // XXX - throw a BuildException instead ?? - if (task != null ) { - task.log("problem reading " + srcFile, - Project.MSG_ERR); - } - + throw new BuildException("problem reading " + srcFile, + ex); } catch (IOException e) { - // XXX - throw a BuildException instead ?? - if (task != null) { - task.log("problem reading zip entry from " + srcFile, - Project.MSG_ERR); - } + throw new BuildException("problem reading zip entry from " + + srcFile, e); } } } finally { if (in != null) { try { in.close(); - if (task != null) { - task.log("closing input stream from " + srcFile, - Project.MSG_DEBUG); - } } catch (IOException ex) { - if (task != null) { - task.log("problem closing input stream from " - + srcFile, Project.MSG_ERR); - } + // swallow } } }