提交 06b92a49 编写于 作者: J Jesse Glick

[FIXED JENKINS-15587] Do not issue a warning about unparsable build timestamps...

[FIXED JENKINS-15587] Do not issue a warning about unparsable build timestamps if it is just a number, i.e. failed symlink.
上级 91a62d65
......@@ -110,6 +110,7 @@ import org.kohsuke.stapler.export.Exported;
import org.kohsuke.stapler.export.ExportedBean;
import com.thoughtworks.xstream.XStream;
import hudson.model.Run.RunExecution;
import java.io.ByteArrayInputStream;
import org.kohsuke.stapler.interceptor.RequirePOST;
......@@ -340,7 +341,13 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
((RunAction) a).onAttached(this);
}
/*package*/ static long parseTimestampFromBuildDir(File buildDir) throws IOException {
static class InvalidDirectoryNameException extends IOException {
InvalidDirectoryNameException(File buildDir) {
super("Invalid directory name " + buildDir);
}
}
/*package*/ static long parseTimestampFromBuildDir(File buildDir) throws IOException, InvalidDirectoryNameException {
try {
if(Util.isSymlink(buildDir)) {
// "Util.resolveSymlink(file)" resolves NTFS symlinks.
......@@ -354,7 +361,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
buildDir = buildDir.getCanonicalFile();
return ID_FORMATTER.get().parse(buildDir.getName()).getTime();
} catch (ParseException e) {
throw new IOException2("[JENKINS-15587] Invalid directory name "+buildDir,e);
throw new InvalidDirectoryNameException(buildDir);
} catch (InterruptedException e) {
throw new IOException2("Interrupted while resolving symlink directory "+buildDir,e);
}
......
......@@ -227,6 +227,17 @@ public final class RunMap<R extends Run<?,R>> extends AbstractLazyLoadRunMap<R>
if (LOGGER.isLoggable(FINE))
LOGGER.log(FINE,"Loaded " + b.getFullDisplayName(),new ThisIsHowItsLoaded());
return b;
} catch (Run.InvalidDirectoryNameException x) {
Level lvl;
try {
Integer.parseInt(d.getName());
// JENKINS-15587: just an mangled symlink
lvl = Level.FINE;
} catch (NumberFormatException x2) {
// potentially a real build dir, maybe a bug
lvl = Level.WARNING;
}
LOGGER.log(lvl, "skipping non-build directory {0}", d);
} catch (IOException e) {
LOGGER.log(Level.WARNING, "could not load " + d, e);
} catch (InstantiationError e) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册