diff --git a/core/src/main/java/hudson/model/Hudson.java b/core/src/main/java/hudson/model/Hudson.java index 93d2e8cfd56fbb7c0b59240093313ad2a4c988e5..5c78727a0b2cafc8e3db62ada4fbd5240037c912 100644 --- a/core/src/main/java/hudson/model/Hudson.java +++ b/core/src/main/java/hudson/model/Hudson.java @@ -1544,10 +1544,10 @@ public final class Hudson extends View implements ItemGroup, Node, boolean result = true; for( Descriptor d : BuildStep.BUILDERS ) - result &= d.configure(req,json.getJSONObject(d.getJsonSafeClassName())); + result &= configureDescriptor(req,json,d); for( Descriptor d : BuildStep.PUBLISHERS ) - result &= d.configure(req,json.getJSONObject(d.getJsonSafeClassName())); + result &= configureDescriptor(req,json,d); for( Descriptor d : BuildWrappers.WRAPPERS ) result &= d.configure(req); @@ -1574,6 +1574,13 @@ public final class Hudson extends View implements ItemGroup, Node, } } + private boolean configureDescriptor(StaplerRequest req, JSONObject json, Descriptor d) throws FormException { + // collapse the structure to remain backward compatible with the JSON structure before 1.238 + JSONObject js = json.getJSONObject(d.getJsonSafeClassName()); + json.putAll(js); + return d.configure(req, js); + } + /** * Accepts submission from the configuration page. */ diff --git a/core/src/main/java/hudson/tasks/Ant.java b/core/src/main/java/hudson/tasks/Ant.java index 4047e49828bccc02b9cc5487494f6f8a4d75efec..8aed9609d5c473c314c5961c3ba6ad01d071cf75 100644 --- a/core/src/main/java/hudson/tasks/Ant.java +++ b/core/src/main/java/hudson/tasks/Ant.java @@ -260,9 +260,10 @@ public class Ant extends Builder { return installations; } - public boolean configure(StaplerRequest req) { + @Override + public boolean configure(StaplerRequest req, JSONObject json) throws FormException { installations = req.bindJSONToList( - AntInstallation.class, req.getSubmittedForm().get("ant")).toArray(new AntInstallation[0]); + AntInstallation.class, json.get("ant")).toArray(new AntInstallation[0]); save(); return true; } diff --git a/core/src/main/java/hudson/tasks/Maven.java b/core/src/main/java/hudson/tasks/Maven.java index 88f448ae68cdcc1d73ba8786756b4fbbb43521d2..3f709cb77f261241a2b67d70f51edaf210d1919a 100644 --- a/core/src/main/java/hudson/tasks/Maven.java +++ b/core/src/main/java/hudson/tasks/Maven.java @@ -225,9 +225,9 @@ public class Maven extends Builder { return installations; } - public boolean configure(StaplerRequest req) { - this.installations = req.bindJSONToList(MavenInstallation.class, req.getSubmittedForm().get("maven")) - .toArray(new MavenInstallation[0]); + @Override + public boolean configure(StaplerRequest req, JSONObject json) throws FormException { + this.installations = req.bindJSONToList(MavenInstallation.class, json.get("maven")).toArray(new MavenInstallation[0]); save(); return true; }