From 63a8adbed27f77b5e3f5f0c40254e42d5e698255 Mon Sep 17 00:00:00 2001 From: kohsuke Date: Thu, 22 Jan 2009 02:12:31 +0000 Subject: [PATCH] ant throws an exception if the base dir doesn't exist. This breaks some of the error checks in places like ArtifactArchiver or JavadocArchiver, so return 0 instead of IOException. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@14704 71c3de6d-444a-0410-be80-ed276b4c234a --- core/src/main/java/hudson/FilePath.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/hudson/FilePath.java b/core/src/main/java/hudson/FilePath.java index a8b48d6d2f..a47bce7b83 100644 --- a/core/src/main/java/hudson/FilePath.java +++ b/core/src/main/java/hudson/FilePath.java @@ -865,6 +865,7 @@ public final class FilePath implements Serializable { // local to local copy. return act(new FileCallable() { public Integer invoke(File base, VirtualChannel channel) throws IOException { + if(!base.exists()) return 0; assert target.channel==null; try { @@ -966,8 +967,13 @@ public final class FilePath implements Serializable { TarOutputStream tar = new TarOutputStream(new GZIPOutputStream(new BufferedOutputStream(pipe.getOut()))); tar.setLongFileMode(TarOutputStream.LONGFILE_GNU); - DirectoryScanner ds = fs.getDirectoryScanner(new org.apache.tools.ant.Project()); - String[] files = ds.getIncludedFiles(); + String[] files; + if(baseDir.exists()) { + DirectoryScanner ds = fs.getDirectoryScanner(new org.apache.tools.ant.Project()); + files = ds.getIncludedFiles(); + } else { + files = new String[0]; + } for( String f : files) { if(Functions.isWindows()) f = f.replace('\\','/'); -- GitLab