Skip to content

Commit

Permalink
[JENKINS-38564] One findbugs NPD warning fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
rsandell committed Oct 5, 2016
1 parent fcf9a65 commit eb24b89
Showing 1 changed file with 9 additions and 2 deletions.
Expand Up @@ -206,8 +206,10 @@ public HttpResponse doStepsToJenkinsfile(StaplerRequest req) {
continue;
}
ModelASTStep astStep = parser.parseStep((JSONObject)jsonStep);
astStep.validate(parser.getValidator());
astSteps.add(astStep);
if (astStep != null) {
astStep.validate(parser.getValidator());
astSteps.add(astStep);
}
}

if (parser.getErrorCollector().getErrorCount() > 0) {
Expand All @@ -218,6 +220,11 @@ public HttpResponse doStepsToJenkinsfile(StaplerRequest req) {
errors.add(jsonError);
}

result.accumulate("errors", errors);
} else if (astSteps.isEmpty()) {
result.accumulate("result", "failure");
JSONArray errors = new JSONArray();
errors.add("No result.");
result.accumulate("errors", errors);
} else {
result.accumulate("result", "success");
Expand Down

0 comments on commit eb24b89

Please sign in to comment.