Skip to content

Commit

Permalink
[FIXED JENKINS-15869]
Browse files Browse the repository at this point in the history
revisiting the fix by vetting the deserialized NodeMonitors to make sure they are valid.
  • Loading branch information
kohsuke committed Nov 19, 2012
1 parent 6465ba0 commit 5eada31
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion core/src/main/java/hudson/model/ComputerSet.java
Expand Up @@ -47,6 +47,7 @@
import java.io.File;
import java.io.IOException;
import java.util.AbstractList;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -388,7 +389,16 @@ public static void initialize() {}
if(xf.exists()) {
DescribableList<NodeMonitor,Descriptor<NodeMonitor>> persisted =
(DescribableList<NodeMonitor,Descriptor<NodeMonitor>>) xf.read();
r.replaceBy(persisted.toList());
List<NodeMonitor> sanitized = new ArrayList<NodeMonitor>();
for (NodeMonitor nm : persisted) {
try {
nm.getDescriptor();
sanitized.add(nm);
} catch (Throwable e) {
// the descriptor didn't load? see JENKINS-15869
}
}
r.replaceBy(sanitized);
}

// if we have any new monitors, let's add them
Expand Down

0 comments on commit 5eada31

Please sign in to comment.