提交 6763eb88 编写于 作者: B Bruno Kühnen Meneguello 提交者: Vojtech Juranek

[FIXED JENKINS-21239] Trend Graph NPE when no builds

上级 a41be86f
...@@ -1216,7 +1216,7 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R ...@@ -1216,7 +1216,7 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
} }
public Graph getBuildTimeGraph() { public Graph getBuildTimeGraph() {
return new Graph(getLastBuild().getTimestamp(),500,400) { return new Graph(getLastBuildTime(),500,400) {
@Override @Override
protected JFreeChart createGraph() { protected JFreeChart createGraph() {
class ChartLabel implements Comparable<ChartLabel> { class ChartLabel implements Comparable<ChartLabel> {
...@@ -1350,6 +1350,16 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R ...@@ -1350,6 +1350,16 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
}; };
} }
private Calendar getLastBuildTime() {
final RunT lastBuild = getLastBuild();
if (lastBuild ==null) {
final GregorianCalendar neverBuiltCalendar = new GregorianCalendar();
neverBuiltCalendar.setTimeInMillis(0);
return neverBuiltCalendar;
}
return lastBuild.getTimestamp();
}
/** /**
* Renames this job. * Renames this job.
*/ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册