add readResolve method to ensure that <usages ../> is
always initialized properly when deserializing a fingerprint
@@ -868,7 +868,7 @@ public class Fingerprint implements ModelObject, Saveable {
/**
* Range of builds that use this file keyed by a job full name.
*/
- private final Hashtable<String,RangeSet> usages = new Hashtable<String,RangeSet>();
+ private Hashtable<String,RangeSet> usages = new Hashtable<String,RangeSet>();
PersistedList<FingerprintFacet> facets = new PersistedList<FingerprintFacet>(this);
@@ -1031,6 +1031,14 @@ public class Fingerprint implements ModelObject, Saveable {
save();
}
+ // JENKINS-49588
+ protected Object readResolve() {
+ if (usages == null) {
+ usages = new Hashtable<String,RangeSet>();
+ }
+ return this;
+ }
+
void addWithoutSaving(@Nonnull String jobFullName, int n) {
synchronized(usages) { // TODO why not synchronized (this) like some, though not all, other accesses?
RangeSet r = usages.get(jobFullName);
