Skip to content

Commit

Permalink
[JENKINS-48634] - implement more robust form handling in Status#doBui…
Browse files Browse the repository at this point in the history
…ld()
  • Loading branch information
oleg-nenashev committed Feb 2, 2018
1 parent 41412fb commit 7520623
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/main/java/hudson/plugins/promoted_builds/Status.java
Expand Up @@ -12,6 +12,7 @@
import hudson.plugins.promoted_builds.conditions.ManualCondition;
import hudson.util.Iterators;
import net.sf.json.JSONArray;
import net.sf.json.JSONNull;
import net.sf.json.JSONObject;

import org.kohsuke.stapler.StaplerRequest;
Expand Down Expand Up @@ -398,7 +399,15 @@ public void doBuild(StaplerRequest req, StaplerResponse rsp) throws IOException,
JSONArray a = JSONArray.fromObject(formData.get("parameter"));

for (Object o : a) {
JSONObject jo = (JSONObject) o;
final JSONObject jo;
if (o instanceof JSONObject) {
jo = (JSONObject) o;
} else if (o instanceof JSONNull) {
continue; // ignore nulls
} else {
throw new IllegalArgumentException("Array type is not supported " + o);
}

String name = jo.getString("name");

ParameterDefinition d = manualCondition.getParameterDefinition(name);
Expand Down

0 comments on commit 7520623

Please sign in to comment.