Skip to content

Commit

Permalink
[FIXED JENKINS-48364] Treat null first vararg param properly.
Browse files Browse the repository at this point in the history
  • Loading branch information
abayer committed Dec 5, 2017
1 parent ab44ba3 commit deda81c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Expand Up @@ -102,7 +102,7 @@ private static Object[] parametersForVarargs(Class<?>[] parameterTypes, Object[]
if (arrayLength == 1 && parameterTypes[fixedLen].isInstance(parameters[fixedLen])) {
// not a varargs call
return parameters;
} else if ((arrayLength > 0 && componentType.isInstance(parameters[fixedLen])) ||
} else if ((arrayLength > 0 && (componentType.isInstance(parameters[fixedLen]) || parameters[fixedLen] == null)) ||
arrayLength == 0) {
Object array = DefaultTypeTransformation.castToVargsArray(parameters, fixedLen, parameterTypes[fixedLen]);
Object[] parameters2 = new Object[fixedLen + 1];
Expand Down
Expand Up @@ -969,4 +969,15 @@ public void varArgsWithOtherArgs() throws Exception {
String expected = "4-true-a-b-c";
assertEvaluate(wl, expected, script);
}

@Issue("JENKINS-48364")
@Test
public void nullFirstVarArg() throws Exception {
ProxyWhitelist wl = new ProxyWhitelist(new GenericWhitelist(), new AnnotatedWhitelist());
String uv = UsesVarargs.class.getName();

String script = "return " + uv + ".join(':', null, 'def', 'ghi')\n";
String expected = ":def:ghi";
assertEvaluate(wl, expected, script);
}
}

0 comments on commit deda81c

Please sign in to comment.