Skip to content

Commit

Permalink
[FIXED JENKINS-11073] handle failure to set timestamp on Windows plat…
Browse files Browse the repository at this point in the history
…forms more gracefully
  • Loading branch information
kutzi committed Nov 12, 2011
1 parent 8f41302 commit a7ce870
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions core/src/main/java/hudson/FilePath.java
Expand Up @@ -61,8 +61,6 @@
import org.apache.commons.io.input.CountingInputStream;
import org.apache.commons.fileupload.FileItem;
import org.kohsuke.stapler.Stapler;
import org.jvnet.robust_http_client.RetryableHttpStream;

import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileFilter;
Expand Down Expand Up @@ -1426,7 +1424,17 @@ public void copyToWithPermission(FilePath target) throws IOException, Interrupte
copyTo(target);
// copy file permission
target.chmod(mode());
target.touch(lastModified());

try {
target.touch(lastModified());
} catch (IOException e) {
// On Windows this seems to fail often. See JENKINS-11073
if (!isUnix()) {
LOGGER.warning("Failed to set timestamp on " + target.getRemote());
} else { // rethrow
throw new IOException2(e);
}
}
}

/**
Expand Down

0 comments on commit a7ce870

Please sign in to comment.