Avoid printing stack trace for `ClosedChannelException` in agent launch log (#10927)

This commit is contained in:
Jesse Glick 2025-08-08 12:54:18 -04:00 committed by GitHub
parent 7455ceb97d
commit a8ae2fab77
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 2 deletions

View File

@ -66,6 +66,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.nio.channels.ClosedChannelException;
import java.nio.charset.Charset;
import java.security.Security;
import java.util.ArrayList;
@ -641,9 +642,11 @@ public class SlaveComputer extends Computer {
// Orderly shutdown will have null exception
if (cause != null) {
offlineCause = new ChannelTermination(cause);
Functions.printStackTrace(cause, taskListener.error("Connection terminated"));
} else {
}
if (cause == null || cause instanceof ClosedChannelException) {
taskListener.getLogger().println("Connection terminated");
} else {
Functions.printStackTrace(cause, taskListener.error("Connection terminated"));
}
closeChannel();
try {