From c67d3aa8d16185b3388b4807c0732b0a964bf996 Mon Sep 17 00:00:00 2001 From: Mike Dillon Date: Wed, 21 Sep 2016 17:24:32 -0700 Subject: [PATCH] Retain compatibility with old build records --- .../rubyMetrics/AbstractRubyMetricsProjectAction.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/hudson/plugins/rubyMetrics/AbstractRubyMetricsProjectAction.java b/src/main/java/hudson/plugins/rubyMetrics/AbstractRubyMetricsProjectAction.java index 3bcce13..b1d430e 100644 --- a/src/main/java/hudson/plugins/rubyMetrics/AbstractRubyMetricsProjectAction.java +++ b/src/main/java/hudson/plugins/rubyMetrics/AbstractRubyMetricsProjectAction.java @@ -9,7 +9,8 @@ @SuppressWarnings("unchecked") public abstract class AbstractRubyMetricsProjectAction extends Actionable implements ProminentProjectAction { - protected final Job job; + protected Job job; + private transient AbstractProject project; // Retain backwards compatibility with old build records public AbstractRubyMetricsProjectAction(Job job) { this.job = job; @@ -66,4 +67,10 @@ public Integer getLastResultBuild() { return null; } + private Object readResolve() { + if (job == null) { + job = project; + } + return this; + } }