Skip to content

Commit

Permalink
[FIXED JENKINS-13515] FingerprintingCopyMethod.copyOne can fail on Wi…
Browse files Browse the repository at this point in the history
…ndows due to timestamp.
  • Loading branch information
jglick committed Sep 21, 2012
1 parent c587a69 commit d86690c
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import hudson.Extension;
import hudson.FilePath;
import hudson.Functions;
import hudson.Util;
import hudson.model.AbstractBuild;
import hudson.model.Fingerprint;
Expand All @@ -17,6 +18,7 @@
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger;

/**
* Performs fingerprinting during the copy.
Expand Down Expand Up @@ -76,7 +78,16 @@ public void copyOne(FilePath s, FilePath d) throws IOException, InterruptedExcep
out.close();
}
d.chmod(s.mode());
d.touch(s.lastModified());
// FilePath.setLastModifiedIfPossible private; copyToWithPermission OK but would have to calc digest separately:
try {
d.touch(s.lastModified());
} catch (IOException x) {
if (Functions.isWindows()) {
Logger.getLogger(FingerprintingCopyMethod.class.getName()).warning(x.getMessage());
} else {
throw x;
}
}
String digest = Util.toHexString(md5.digest());

FingerprintMap map = Jenkins.getInstance().getFingerprintMap();
Expand Down

0 comments on commit d86690c

Please sign in to comment.