提交 2feb19ef 编写于 作者: J Julian Schmidt

[FIXED JENKINS-15156] Initialize AbstractLazyLoadRunMap.dir for newly created jobs

上级 dbd6b530
......@@ -162,7 +162,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
* {@link Run#getPreviousBuild()}
*/
@Restricted(NoExternalUse.class)
protected transient RunMap<R> builds = new RunMap<R>();
protected transient RunMap<R> builds;
/**
* The quiet period. Null to delegate to the system default.
......@@ -271,6 +271,12 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
super.onCreatedFromScratch();
// solicit initial contributions, especially from TransientProjectActionFactory
updateTransientActions();
assert builds==null;
builds = new RunMap<R>(getBuildDir(), new Constructor<R>() {
public R create(File dir) throws IOException {
return loadBuild(dir);
}
});
}
@Override
......
......@@ -203,8 +203,8 @@ public abstract class AbstractLazyLoadRunMap<R> extends AbstractMap<Integer,R> i
private void loadIdOnDisk() {
String[] buildDirs = dir.list(createDirectoryFilter());
if (buildDirs==null) {
// the job may just have been created
buildDirs=EMPTY_STRING_ARRAY;
LOGGER.log(Level.WARNING, "failed to load list of builds from {0}", dir);
}
// wrap into ArrayList to enable mutation
Arrays.sort(buildDirs);
......@@ -625,6 +625,7 @@ public abstract class AbstractLazyLoadRunMap<R> extends AbstractMap<Integer,R> i
protected R load(String id, Index editInPlace) {
assert dir != null;
R v = load(new File(dir, id), editInPlace);
if (v==null && editInPlace!=null) {
// remember the failure.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册