Fixed - Jenkins Global Configuration Save Option
@@ -27,6 +27,7 @@ package jenkins.management;
import hudson.Extension;
import hudson.model.AdministrativeMonitor;
import jenkins.model.GlobalConfiguration;
+import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
@@ -41,9 +42,15 @@ import java.util.logging.Logger;
public class AdministrativeMonitorsConfiguration extends GlobalConfiguration {
@Override
public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
+ JSONArray monitors = json.optJSONArray("administrativeMonitor");
for (AdministrativeMonitor am : AdministrativeMonitor.all()) {
try {
- boolean disable = !json.getJSONArray("administrativeMonitor").contains(am.id);
+ boolean disable;
+ if(monitors != null) {
+ disable = !monitors.contains(am.id);
+ }else {
+ disable = !am.id.equals(json.optString("administrativeMonitor"));
+ }
am.disable(disable);
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Failed to process form submission for " + am.id, e);
