Prevent NPE in SlaveComputer#setChannel(Channel,OutputStream launchLog,Channel.Listener,) when null launchLog is passed from API
@@ -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);
