-
Notifications
You must be signed in to change notification settings - Fork 324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stop using deprecated Util#join
#855
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't merge as-is as it seems to break the unit-tests.
@@ -193,7 +193,7 @@ private void invokeBody(DockerTransientNode node, TaskListener listener) { | |||
env.overrideExpandingAll(computer.buildEnvironment(listener)); | |||
env.put("NODE_NAME", computer.getName()); | |||
env.put("EXECUTOR_NUMBER", "0"); | |||
env.put("NODE_LABELS", Util.join(node.getAssignedLabels(), " ")); | |||
env.put("NODE_LABELS", node.getAssignedLabels().stream().map(Object::toString).collect(Collectors.joining(" "))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I'm unsure of the cause, it looks like this change breaks the unit-tests.
...also, I'm not a big fan of having so many method calls daisy-chained on the same line - it makes debugging a NPE nigh-on impossible.
I'd suggest implementing a join
method (possibly in this plugin's utils package, maybe as a new class unless it fits well in another), and adding a unit-test for it (to prove it'll cope with a null input, or an input containing nulls, as well as normal non-null stuff), and then call that instead of Util.join
.
I suspect that such a unit-test would then reveal that Util.join
was more null-safe than this new code and fixing that would then fix the failing unit-tests.
The same unit tests that are broken in the PR build of #857, which does nothing but change a comment in |
Thank you for bringing that to my attention. |
FYI I found one issue which I fixed in #858 (the official docker image had changed, which broke the unit tests that used it). @basil I've (re)implemented your suggested changes in #862 (which is now merged), so you can cross this plugin off the TODO list in jenkinsci/jenkins#5467 |
This method was deprecated in jenkinsci/jenkins#5467, so migrate away from it in favor of native Java Platform functionality.