ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r667588 - in /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs: Expand.java Untar.java
Date Fri, 13 Jun 2008 16:38:37 GMT
Author: stevel
Date: Fri Jun 13 09:38:37 2008
New Revision: 667588

URL: http://svn.apache.org/viewvc?rev=667588&view=rev
Log:
extra diags when expand and untar fail

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=667588&r1=667587&r2=667588&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 Jun 13 09:38:37
2008
@@ -133,6 +133,12 @@
         log("Expanding: " + srcF + " into " + dir, Project.MSG_INFO);
         ZipFile zf = null;
         FileNameMapper mapper = getMapper();
+        if (!srcF.exists()) {
+            throw new BuildException("Unable to expand "
+                    + srcF
+                    + " as the file does not exist",
+                    getLocation());
+        }
         try {
             zf = new ZipFile(srcF, encoding);
             Enumeration e = zf.getEntries();
@@ -296,7 +302,9 @@
 
             fileUtils.setFileLastModified(f, entryDate.getTime());
         } catch (FileNotFoundException ex) {
-            log("Unable to expand to file " + f.getPath(), Project.MSG_WARN);
+            log("Unable to expand to file " + f.getPath(),
+                    ex,
+                    Project.MSG_WARN);
         }
 
     }

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=667588&r1=667587&r2=667588&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 Jun 13 09:38:37 2008
@@ -39,8 +39,6 @@
 
 /**
  * Untar a file.
- * <p>For JDK 1.1 &quot;last modified time&quot; field is set to current time
instead of being
- * carried from the archive file.</p>
  * <p>PatternSets are used to select files to extract
  * <I>from</I> the archive.  If no patternset is used, all files are extracted.
  * </p>
@@ -94,11 +92,18 @@
     /** {@inheritDoc} */
     protected void expandFile(FileUtils fileUtils, File srcF, File dir) {
         FileInputStream fis = null;
+        if (!srcF.exists()) {
+            throw new BuildException("Unable to untar "
+                    + srcF
+                    + " as the file does not exist",
+                    getLocation());
+        }
         try {
             fis = new FileInputStream(srcF);
             expandStream(srcF.getPath(), fis, dir);
         } catch (IOException ioe) {
-            throw new BuildException("Error while expanding " + srcF.getPath(),
+            throw new BuildException("Error while expanding " + srcF.getPath()
+                                     + "\n" + ioe.toString(),
                                      ioe, getLocation());
         } finally {
             FileUtils.close(fis);



Mime
View raw message