From bd23782e281a1798dc69222fc72f27316debc76c Mon Sep 17 00:00:00 2001 From: kohsuke Date: Thu, 31 Jul 2008 23:20:23 +0000 Subject: [PATCH] Fixed the form submission error when there's no Ant or Maven configured. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@11170 71c3de6d-444a-0410-be80-ed276b4c234a --- core/src/main/java/hudson/model/Hudson.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/hudson/model/Hudson.java b/core/src/main/java/hudson/model/Hudson.java index 5c78727a0b..a30487d9f5 100644 --- a/core/src/main/java/hudson/model/Hudson.java +++ b/core/src/main/java/hudson/model/Hudson.java @@ -1575,8 +1575,9 @@ 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()); + // collapse the structure to remain backward compatible with the JSON structure before 1. + String name = d.getJsonSafeClassName(); + JSONObject js = json.has(name) ? json.getJSONObject(name) : new JSONObject(); // if it doesn't have the property, the method returns invalid null object. json.putAll(js); return d.configure(req, js); } -- GitLab