Skip to content
Permalink
Browse files
[FIXED JENKINS-15869]
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 5eada311c640663a2dbe40c69a7257e80be9ffca
Showing with 11 additions and 1 deletion.
  1. +11 −1 core/src/main/java/hudson/model/ComputerSet.java
@@ -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;
@@ -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

0 comments on commit 5eada31

Please sign in to comment.