Skip to content

Commit

Permalink
Merge pull request #110 from oleg-nenashev/JENKINS-48634
Browse files Browse the repository at this point in the history
[JENKINS-48634] - implement more robust form handling in Status#doBuild()
  • Loading branch information
oleg-nenashev committed Feb 12, 2018
2 parents 41412fb + 7520623 commit 3849c36
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 3849c36

Please sign in to comment.