Author: bodewig Date: Fri Jul 18 02:07:25 2008 New Revision: 677860 URL: http://svn.apache.org/viewvc?rev=677860&view=rev Log: more explicit existence chacks in unzip/tar. PR 44843
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Untar.java Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java?rev=677860&r1=677859&r2=677860&view=diff ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java Fri Jul 18 02:07:25 2008 @@ -122,6 +122,10 @@ if (source.isDirectory()) { throw new BuildException("Src must not be a directory." + " Use nested filesets instead.", getLocation()); + } else if (!source.exists()) { + throw new BuildException("src '" + source + "' doesn't exist."); + } else if (!source.canRead()) { + throw new BuildException("src '" + source + "' cannot be read."); } else { expandFile(FILE_UTILS, source, dest); } @@ -130,6 +134,7 @@ while (iter.hasNext()) { Resource r = (Resource) iter.next(); if (!r.isExists()) { + log("Skipping '" + r.getName() + "' because it doesn't exist."); continue; } Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Untar.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Untar.java?rev=677860&r1=677859&r2=677860&view=diff ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Untar.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Untar.java Fri Jul 18 02:07:25 2008 @@ -118,6 +118,13 @@ * @since Ant 1.7 */ protected void expandResource(Resource srcR, File dir) { + if (!srcR.isExists()) { + throw new BuildException("Unable to untar " + + srcR.getName() + + " as the it does not exist", + getLocation()); + } + InputStream i = null; try { i = srcR.getInputStream();