Skip to content
Permalink
Browse files

Merge pull request #112 from jglick/NPE-JENKINS-42367

[JENKINS-42367] Missing null check
  • Loading branch information...
jglick committed Mar 2, 2017
2 parents 7e0b274 + 2ee7ab7 commit 3c8755890ba2bb0e52b67499a4a42cd434d66486
@@ -82,7 +82,7 @@

private static void addValue(Map<String, Object> values, ParameterValue parameterValue) {
Object value = parameterValue.getValue();
if (!(value instanceof Serializable)) {
if (value != null && !(value instanceof Serializable)) {
boolean canPickle = false;
for (PickleFactory pf : PickleFactory.all()) {
if (pf.writeReplace(value) != null) {
@@ -60,4 +60,12 @@
r.assertLogContains("PASS=s3cr3t", b);
}

@Issue("JENKINS-42367")
@Test public void nullValue() throws Exception {
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
p.setDefinition(new CpsFlowDefinition("echo(/TEXT=${params.TEXT}/)",true));
p.addProperty(new ParametersDefinitionProperty(new StringParameterDefinition("TEXT", "")));
r.assertLogContains("TEXT=null", r.assertBuildStatusSuccess(p.scheduleBuild2(0, new ParametersAction(new StringParameterValue("TEXT", /* not possible via UI, but to simulate other ParameterValue impls */null)))));
}

}

0 comments on commit 3c87558

Please sign in to comment.
You can’t perform that action at this time.