提交 fef59606 编写于 作者: O Oleg Nenashev

[JENKINS-51955] - Prevent NPE in SlaveComputer#setChannel(Channel,OutputStream...

[JENKINS-51955] - Prevent NPE in SlaveComputer#setChannel(Channel,OutputStream launchLog,Channel.Listener,) when null launchLog is passed from API
上级 e6403b98
......@@ -578,14 +578,18 @@ public class SlaveComputer extends Computer {
/**
* Sets up the connection through an existing channel.
* @param channel the channel to use; <strong>warning:</strong> callers are expected to have called {@link ChannelConfigurator} already
* @param channel the channel to use; <strong>warning:</strong> callers are expected to have called {@link ChannelConfigurator} already.
* @param launchLog Launch log. If not {@code null}, will receive launch log messages
* @param listener Channel event listener to be attached (if not {@code null})
* @since 1.444
*/
public void setChannel(Channel channel, OutputStream launchLog, Channel.Listener listener) throws IOException, InterruptedException {
public void setChannel(@Nonnull Channel channel,
@CheckForNull OutputStream launchLog,
@CheckForNull Channel.Listener listener) throws IOException, InterruptedException {
if(this.channel!=null)
throw new IllegalStateException("Already connected");
final TaskListener taskListener = new StreamTaskListener(launchLog);
final TaskListener taskListener = launchLog != null ? new StreamTaskListener(launchLog) : TaskListener.NULL;
PrintStream log = taskListener.getLogger();
channel.setProperty(SlaveComputer.class, this);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册