bodewig 2003/02/17 05:48:35
Modified: src/main/org/apache/tools/ant/taskdefs Zip.java src/main/org/apache/tools/ant/types ZipScanner.java Log: remove logging from ZipScanner. Revision Changes Path 1.96 +0 -2 ant/src/main/org/apache/tools/ant/taskdefs/Zip.java Index: Zip.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Zip.java,v retrieving revision 1.95 retrieving revision 1.96 diff -u -r1.95 -r1.96 --- Zip.java 13 Feb 2003 13:19:28 -0000 1.95 +++ Zip.java 17 Feb 2003 13:48:35 -0000 1.96 @@ -665,8 +665,6 @@ 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; 1.17 +7 -52 ant/src/main/org/apache/tools/ant/types/ZipScanner.java Index: ZipScanner.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/ZipScanner.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- ZipScanner.java 17 Feb 2003 12:59:23 -0000 1.16 +++ ZipScanner.java 17 Feb 2003 13:48:35 -0000 1.17 @@ -64,9 +64,9 @@ 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, @@ -85,10 +85,6 @@ */ protected File srcFile; /** - * The current task, used to report errors, ... - */ - private Task task; - /** * to record the last scanned zip file with its modification date */ private Resource lastScannedResource; @@ -106,17 +102,6 @@ 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 @@ 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 @@ 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 } } }