提交 24aa2063 编写于 作者: J Jesse Glick

Replaced other usages of printStackTrace.

上级 7f4ce02e
......@@ -831,7 +831,7 @@ public final class FilePath implements Serializable {
return true;
} catch (IOException x) {
if (listener != null) {
x.printStackTrace(listener.error("Failed to download " + archive + " from agent; will retry from master"));
listener.error("Failed to download " + archive + " from agent; will retry from master").print(Functions.printThrowable(x));
}
}
}
......
......@@ -159,7 +159,7 @@ public abstract class Proc {
kill();
}
} catch (InterruptedException | IOException | RuntimeException x) {
x.printStackTrace(listener.error("Failed to join a process"));
listener.error("Failed to join a process").print(Functions.printThrowable(x));
}
}
});
......
......@@ -1367,7 +1367,7 @@ public class Util {
PrintStream log = listener.getLogger();
log.printf("ln %s %s failed%n",targetPath, new File(baseDir, symlinkPath));
Util.displayIOException(e,listener);
e.printStackTrace( log );
log.print(Functions.printThrowable(e));
}
}
......
......@@ -29,6 +29,7 @@ import hudson.ExtensionList;
import hudson.ExtensionPoint;
import hudson.cli.declarative.CLIMethod;
import hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson;
import hudson.Functions;
import jenkins.util.SystemProperties;
import hudson.cli.declarative.OptionHandlerExtension;
import jenkins.model.Jenkins;
......@@ -298,7 +299,7 @@ public abstract class CLICommand implements ExtensionPoint, Cloneable {
stderr.println("");
stderr.println("ERROR: " + errorMsg);
LOGGER.log(Level.WARNING, errorMsg, e);
e.printStackTrace(stderr);
stderr.print(Functions.printThrowable(e));
return 1;
} finally {
if(sc != null)
......@@ -332,7 +333,7 @@ public abstract class CLICommand implements ExtensionPoint, Cloneable {
return new ClientAuthenticationCache(channel).get();
} catch (IOException e) {
stderr.println("Failed to access the stored credential");
e.printStackTrace(stderr); // recover
stderr.print(Functions.printThrowable(e)); // recover
}
return Jenkins.ANONYMOUS;
}
......
......@@ -27,6 +27,7 @@ import hudson.AbortException;
import hudson.Extension;
import hudson.ExtensionComponent;
import hudson.ExtensionFinder;
import hudson.Functions;
import hudson.Util;
import hudson.cli.CLICommand;
import hudson.cli.CloneableCLICommand;
......@@ -269,7 +270,7 @@ public class CLIRegisterer extends ExtensionFinder {
stderr.println("");
stderr.println("ERROR: " + errorMsg);
LOGGER.log(Level.WARNING, errorMsg, e);
e.printStackTrace(stderr);
stderr.print(Functions.printThrowable(e));
return 1;
}
}
......
......@@ -633,7 +633,7 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
throw (InterruptedException)new InterruptedException().initCause(e);
} catch (IOException e) {
// checkout error not yet reported
e.printStackTrace(listener.getLogger());
listener.getLogger().print(Functions.printThrowable(e));
}
if (retryCount == 0) // all attempts failed
......@@ -749,7 +749,7 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
listener.error("Step ‘" + buildStep + "’ failed: " + e.getMessage());
} else {
String msg = "Step ‘" + buildStep + "’ aborted due to exception: ";
e.printStackTrace(listener.error(msg));
listener.error(msg).print(Functions.printThrowable(e));
LOGGER.log(WARNING, msg, e);
}
......@@ -784,8 +784,7 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
// Channel is closed, do not continue
reportBrokenChannel(listener);
} catch (RuntimeException ex) {
ex.printStackTrace(listener.error("Build step failed with exception"));
listener.error("Build step failed with exception").print(Functions.printThrowable(ex));
}
for (BuildStepListener bsl : BuildStepListener.all()) {
......
......@@ -1370,11 +1370,11 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
SCMPollListener.firePollingFailed(this, listener,e);
return NO_CHANGES;
} catch (IOException e) {
e.printStackTrace(listener.fatalError(e.getMessage()));
listener.fatalError(e.getMessage()).print(Functions.printThrowable(e));
SCMPollListener.firePollingFailed(this, listener,e);
return NO_CHANGES;
} catch (InterruptedException e) {
e.printStackTrace(listener.fatalError(Messages.AbstractProject_PollingABorted()));
listener.fatalError(Messages.AbstractProject_PollingABorted()).print(Functions.printThrowable(e));
SCMPollListener.firePollingFailed(this, listener,e);
return NO_CHANGES;
} catch (RuntimeException e) {
......
......@@ -23,6 +23,7 @@
*/
package hudson.model;
import hudson.Functions;
import hudson.security.ACL;
import hudson.util.StreamTaskListener;
import java.io.File;
......@@ -119,9 +120,9 @@ public abstract class AsyncAperiodicWork extends AperiodicWork {
execute(l);
} catch (IOException e) {
e.printStackTrace(l.fatalError(e.getMessage()));
l.fatalError(e.getMessage()).print(Functions.printThrowable(e));
} catch (InterruptedException e) {
e.printStackTrace(l.fatalError("aborted"));
l.fatalError("aborted").print(Functions.printThrowable(e));
} finally {
stopTime = System.currentTimeMillis();
try {
......
package hudson.model;
import hudson.Functions;
import hudson.security.ACL;
import hudson.util.StreamTaskListener;
import java.io.File;
......@@ -99,9 +100,9 @@ public abstract class AsyncPeriodicWork extends PeriodicWork {
execute(l);
} catch (IOException e) {
e.printStackTrace(l.fatalError(e.getMessage()));
l.fatalError(e.getMessage()).print(Functions.printThrowable(e));
} catch (InterruptedException e) {
e.printStackTrace(l.fatalError("aborted"));
l.fatalError("aborted").print(Functions.printThrowable(e));
} finally {
stopTime = System.currentTimeMillis();
try {
......
......@@ -23,6 +23,7 @@
*/
package hudson.model;
import hudson.Functions;
import hudson.Launcher;
import hudson.tasks.BuildStep;
import hudson.tasks.BuildWrapper;
......@@ -195,7 +196,7 @@ public abstract class Build <P extends Project<P,B>,B extends Build<P,B>>
performAllBuildSteps(listener, project.getPublishersList(), false);
performAllBuildSteps(listener, project.getProperties(), false);
} catch (Exception x) {
x.printStackTrace(listener.error(Messages.Build_post_build_steps_failed()));
listener.error(Messages.Build_post_build_steps_failed()).print(Functions.printThrowable(x));
}
super.cleanUp(listener);
}
......
......@@ -24,6 +24,7 @@
package hudson.model;
import hudson.FilePath;
import hudson.Functions;
import hudson.Util;
import hudson.model.Queue.Executable;
import hudson.model.queue.Executables;
......@@ -289,7 +290,7 @@ public class Executor extends Thread implements ModelObject {
} else {
pw.println("Termination trace follows:");
for (Computer.TerminationRequest request : owner.getTerminatedBy()) {
request.printStackTrace(pw);
pw.print(Functions.printThrowable(request));
}
}
}
......
......@@ -25,6 +25,7 @@ package hudson.model;
import hudson.Extension;
import hudson.ExtensionList;
import hudson.Functions;
import jenkins.model.Jenkins;
import org.jenkinsci.Symbol;
......@@ -113,7 +114,7 @@ public final class FingerprintCleanupThread extends AsyncPeriodicWork {
return fp.trim();
}
} catch (IOException e) {
e.printStackTrace(listener.error("Failed to process " + fingerprintFile));
listener.error("Failed to process " + fingerprintFile).print(Functions.printThrowable(e));
return false;
}
}
......
......@@ -73,7 +73,6 @@ import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.RandomAccessFile;
import java.io.Reader;
import java.io.StringWriter;
import java.nio.charset.Charset;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
......@@ -1865,7 +1864,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
if(e instanceof IOException)
Util.displayIOException((IOException)e,listener);
e.printStackTrace(listener.fatalError(e.getMessage()));
listener.fatalError(e.getMessage()).print(Functions.printThrowable(e));
} else {
LOGGER.log(SEVERE, getDisplayName()+" failed to build and we don't even have a listener",e);
}
......@@ -2194,9 +2193,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
delete();
}
catch(IOException ex){
StringWriter writer = new StringWriter();
ex.printStackTrace(new PrintWriter(writer));
req.setAttribute("stackTraces", writer);
req.setAttribute("stackTraces", Functions.printThrowable(ex));
req.getView(this, "delete-retry.jelly").forward(req, rsp);
return;
}
......
......@@ -23,6 +23,7 @@
*/
package hudson.model;
import hudson.Functions;
import hudson.console.AnnotatedLargeText;
import hudson.util.StreamTaskListener;
......@@ -131,7 +132,7 @@ public abstract class TaskThread extends Thread {
} catch (InterruptedException e) {
listener.getLogger().println("Aborted");
} catch (Exception e) {
e.printStackTrace(listener.getLogger());
listener.getLogger().print(Functions.printThrowable(e));
} finally {
listener = null;
isRunning =false;
......
......@@ -26,6 +26,7 @@ package hudson.model;
import hudson.Extension;
import hudson.ExtensionList;
import hudson.FilePath;
import hudson.Functions;
import jenkins.util.SystemProperties;
import hudson.Util;
import hudson.slaves.WorkspaceList;
......@@ -82,10 +83,10 @@ public class WorkspaceCleanupThread extends AsyncPeriodicWork {
try {
check = shouldBeDeleted(item, ws, node);
} catch (IOException x) {
x.printStackTrace(listener.error("Failed to check " + node.getDisplayName()));
listener.error("Failed to check " + node.getDisplayName()).print(Functions.printThrowable(x));
continue;
} catch (InterruptedException x) {
x.printStackTrace(listener.error("Failed to check " + node.getDisplayName()));
listener.error("Failed to check " + node.getDisplayName()).print(Functions.printThrowable(x));
continue;
}
if (check) {
......@@ -94,9 +95,9 @@ public class WorkspaceCleanupThread extends AsyncPeriodicWork {
ws.deleteRecursive();
WorkspaceList.tempDir(ws).deleteRecursive();
} catch (IOException x) {
x.printStackTrace(listener.error("Failed to delete " + ws + " on " + node.getDisplayName()));
listener.error("Failed to delete " + ws + " on " + node.getDisplayName()).print(Functions.printThrowable(x));
} catch (InterruptedException x) {
x.printStackTrace(listener.error("Failed to delete " + ws + " on " + node.getDisplayName()));
listener.error("Failed to delete " + ws + " on " + node.getDisplayName()).print(Functions.printThrowable(x));
}
}
}
......
......@@ -28,6 +28,7 @@ import com.sun.akuma.JavaVMArguments;
import hudson.Launcher.LocalLauncher;
import hudson.Util;
import hudson.Extension;
import hudson.Functions;
import jenkins.util.SystemProperties;
import hudson.os.SU;
import hudson.model.AdministrativeMonitor;
......@@ -228,7 +229,7 @@ public class ZFSInstaller extends AdministrativeMonitor implements Serializable
try {
datasetName = createZfsFileSystem(listener,username,password);
} catch (Exception e) {
e.printStackTrace(listener.error(e.getMessage()));
listener.error(e.getMessage()).print(Functions.printThrowable(e));
if (e instanceof ZFSException) {
ZFSException ze = (ZFSException) e;
......@@ -292,7 +293,7 @@ public class ZFSInstaller extends AdministrativeMonitor implements Serializable
}
} catch (Exception e) {
// if we let any exception from here, it will prevent Hudson from starting.
e.printStackTrace(listener.error("Migration failed"));
listener.error("Migration failed").print(Functions.printThrowable(e));
}
// migration failed
return new MigrationFailedNotice(out);
......
......@@ -28,6 +28,7 @@ import hudson.DescriptorExtensionList;
import hudson.Extension;
import hudson.ExtensionPoint;
import hudson.FilePath;
import hudson.Functions;
import hudson.Launcher;
import hudson.Util;
import hudson.model.AbstractBuild;
......@@ -673,7 +674,7 @@ public abstract class SCM implements Describable<SCM>, ExtensionPoint {
createEmptyChangeLog(changelogFile, (TaskListener) listener, rootTag);
return true;
} catch (IOException e) {
e.printStackTrace(listener.error(e.getMessage()));
listener.error(e.getMessage()).print(Functions.printThrowable(e));
return false;
}
}
......
......@@ -27,6 +27,7 @@ import hudson.AbortException;
import hudson.EnvVars;
import hudson.Util;
import hudson.Extension;
import hudson.Functions;
import hudson.model.Descriptor;
import hudson.model.Slave;
import jenkins.model.Jenkins;
......@@ -143,11 +144,11 @@ public class CommandLauncher extends ComputerLauncher {
LOGGER.info("agent launched for " + computer.getDisplayName());
} catch (InterruptedException e) {
e.printStackTrace(listener.error(Messages.ComputerLauncher_abortedLaunch()));
listener.error(Messages.ComputerLauncher_abortedLaunch()).print(Functions.printThrowable(e));
} catch (RuntimeException e) {
e.printStackTrace(listener.error(Messages.ComputerLauncher_unexpectedError()));
listener.error(Messages.ComputerLauncher_unexpectedError()).print(Functions.printThrowable(e));
} catch (Error e) {
e.printStackTrace(listener.error(Messages.ComputerLauncher_unexpectedError()));
listener.error(Messages.ComputerLauncher_unexpectedError()).print(Functions.printThrowable(e));
} catch (IOException e) {
Util.displayIOException(e, listener);
......@@ -159,14 +160,14 @@ public class CommandLauncher extends ComputerLauncher {
}
msg = hudson.model.Messages.Slave_UnableToLaunch(computer.getDisplayName(), msg);
LOGGER.log(Level.SEVERE, msg, e);
e.printStackTrace(listener.error(msg));
listener.error(msg).print(Functions.printThrowable(e));
if(_proc!=null) {
reportProcessTerminated(_proc, listener);
try {
ProcessTree.get().killAll(_proc, _cookie);
} catch (InterruptedException x) {
x.printStackTrace(listener.error(Messages.ComputerLauncher_abortedLaunch()));
listener.error(Messages.ComputerLauncher_abortedLaunch()).print(Functions.printThrowable(x));
}
}
}
......
......@@ -25,6 +25,7 @@ package hudson.slaves;
import hudson.AbortException;
import hudson.FilePath;
import hudson.Functions;
import hudson.Util;
import hudson.console.ConsoleLogFilter;
import hudson.model.Computer;
......@@ -264,13 +265,13 @@ public class SlaveComputer extends Computer {
throw e;
} catch (IOException e) {
Util.displayIOException(e,taskListener);
e.printStackTrace(taskListener.error(Messages.ComputerLauncher_unexpectedError()));
taskListener.error(Messages.ComputerLauncher_unexpectedError()).print(Functions.printThrowable(e));
throw e;
} catch (InterruptedException e) {
e.printStackTrace(taskListener.error(Messages.ComputerLauncher_abortedLaunch()));
taskListener.error(Messages.ComputerLauncher_abortedLaunch()).print(Functions.printThrowable(e));
throw e;
} catch (Exception e) {
e.printStackTrace(taskListener.error(Messages.ComputerLauncher_unexpectedError()));
taskListener.error(Messages.ComputerLauncher_unexpectedError()).print(Functions.printThrowable(e));
throw e;
}
} finally {
......@@ -494,7 +495,7 @@ public class SlaveComputer extends Computer {
// Orderly shutdown will have null exception
if (cause!=null) {
offlineCause = new ChannelTermination(cause);
cause.printStackTrace(taskListener.error("Connection terminated"));
taskListener.error("Connection terminated").print(Functions.printThrowable(cause));
} else {
taskListener.getLogger().println("Connection terminated");
}
......
......@@ -28,6 +28,7 @@ import jenkins.MasterToSlaveFileCallable;
import hudson.Launcher;
import hudson.Util;
import hudson.Extension;
import hudson.Functions;
import jenkins.util.SystemProperties;
import hudson.model.AbstractProject;
import hudson.model.Result;
......@@ -262,8 +263,7 @@ public class ArtifactArchiver extends Recorder implements SimpleBuildStep {
}
} catch (IOException e) {
Util.displayIOException(e,listener);
e.printStackTrace(listener.error(
Messages.ArtifactArchiver_FailedToArchive(artifacts)));
listener.error(Messages.ArtifactArchiver_FailedToArchive(artifacts)).print(Functions.printThrowable(e));
build.setResult(Result.FAILURE);
return;
}
......
......@@ -28,6 +28,7 @@ import hudson.Launcher;
import hudson.Proc;
import hudson.Util;
import hudson.EnvVars;
import hudson.Functions;
import hudson.model.AbstractBuild;
import hudson.model.BuildListener;
import hudson.model.Node;
......@@ -93,7 +94,7 @@ public abstract class CommandInterpreter extends Builder {
script = createScriptFile(ws);
} catch (IOException e) {
Util.displayIOException(e,listener);
e.printStackTrace(listener.fatalError(Messages.CommandInterpreter_UnableToProduceScript()));
listener.fatalError(Messages.CommandInterpreter_UnableToProduceScript()).print(Functions.printThrowable(e));
return false;
}
......@@ -113,7 +114,7 @@ public abstract class CommandInterpreter extends Builder {
}
} catch (IOException e) {
Util.displayIOException(e, listener);
e.printStackTrace(listener.fatalError(Messages.CommandInterpreter_CommandFailed()));
listener.fatalError(Messages.CommandInterpreter_CommandFailed()).print(Functions.printThrowable(e));
}
return r==0;
} finally {
......@@ -132,10 +133,10 @@ public abstract class CommandInterpreter extends Builder {
LOGGER.log(Level.FINE, "Script deletion failed", e);
} else {
Util.displayIOException(e,listener);
e.printStackTrace( listener.fatalError(Messages.CommandInterpreter_UnableToDelete(script)) );
listener.fatalError(Messages.CommandInterpreter_UnableToDelete(script)).print(Functions.printThrowable(e));
}
} catch (Exception e) {
e.printStackTrace( listener.fatalError(Messages.CommandInterpreter_UnableToDelete(script)) );
listener.fatalError(Messages.CommandInterpreter_UnableToDelete(script)).print(Functions.printThrowable(e));
}
}
}
......
......@@ -27,6 +27,7 @@ import com.google.common.collect.ImmutableMap;
import hudson.EnvVars;
import hudson.Extension;
import hudson.FilePath;
import hudson.Functions;
import jenkins.MasterToSlaveFileCallable;
import hudson.Launcher;
import jenkins.util.SystemProperties;
......@@ -137,7 +138,7 @@ public class Fingerprinter extends Recorder implements Serializable, DependencyD
Jenkins.getInstance().rebuildDependencyGraphAsync();
}
} catch (IOException e) {
e.printStackTrace(listener.error(Messages.Fingerprinter_Failed()));
listener.error(Messages.Fingerprinter_Failed()).print(Functions.printThrowable(e));
build.setResult(Result.FAILURE);
}
......
......@@ -366,7 +366,7 @@ public class Maven extends Builder {
}
} catch (IOException e) {
Util.displayIOException(e,listener);
e.printStackTrace( listener.fatalError(Messages.Maven_ExecFailed()) );
listener.fatalError(Messages.Maven_ExecFailed()).print(Functions.printThrowable(e));
return false;
}
startIndex = endIndex + 1;
......
......@@ -27,6 +27,7 @@ package hudson.triggers;
import antlr.ANTLRException;
import com.google.common.base.Preconditions;
import hudson.Extension;
import hudson.Functions;
import hudson.Util;
import hudson.console.AnnotatedLargeText;
import hudson.model.AbstractBuild;
......@@ -568,7 +569,7 @@ public class SCMTrigger extends Trigger<Item> {
logger.println("No changes");
return result;
} catch (Error | RuntimeException e) {
e.printStackTrace(listener.error("Failed to record SCM polling for "+job));
listener.error("Failed to record SCM polling for " + job).print(Functions.printThrowable(e));
LOGGER.log(Level.SEVERE,"Failed to record SCM polling for "+job,e);
throw e;
} finally {
......
......@@ -143,7 +143,7 @@ public final class RemotingDiagnostics {
if(output!=null)
pw.println("Result: "+output);
} catch (Throwable t) {
t.printStackTrace(pw);
pw.print(Functions.printThrowable(t));
}
return out.toString();
}
......
package hudson.util;
import com.trilead.ssh2.crypto.Base64;
import hudson.Functions;
import hudson.model.TaskListener;
import org.apache.commons.io.FileUtils;
......@@ -169,7 +170,7 @@ public class SecretRewriter {
rewritten++;
}
} catch (IOException e) {
e.printStackTrace(listener.error("Failed to rewrite "+child));
listener.error("Failed to rewrite " + child).print(Functions.printThrowable(e));
}
}
if (child.isDirectory()) {
......
......@@ -23,6 +23,7 @@
*/
package jenkins;
import hudson.Functions;
import hudson.Plugin;
import org.kohsuke.MetaInfServices;
......@@ -69,9 +70,7 @@ public class PluginSubtypeMarker extends AbstractProcessor {
try {
write(e);
} catch (IOException x) {
StringWriter sw = new StringWriter();
x.printStackTrace(new PrintWriter(sw));
processingEnv.getMessager().printMessage(Kind.ERROR,sw.toString(),e);
processingEnv.getMessager().printMessage(Kind.ERROR, Functions.printThrowable(x), e);
}
}
}
......
package jenkins.management;
import hudson.AbortException;
import hudson.Functions;
import hudson.console.AnnotatedLargeText;
import hudson.model.AdministrativeMonitor;
import hudson.model.TaskListener;
......@@ -125,7 +126,7 @@ public abstract class AsynchronousAdministrativeMonitor extends AdministrativeMo
} catch (AbortException e) {
listener.error(e.getMessage());
} catch (Throwable e) {
e.printStackTrace(listener.error(getName() + " failed"));
listener.error(getName() + " failed").print(Functions.printThrowable(e));
LOGGER.log(Level.WARNING, getName() + " failed", e);
}
}
......
......@@ -272,7 +272,6 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.BindException;
import java.net.HttpURLConnection;
import java.net.URL;
......@@ -3768,9 +3767,7 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
try {
r.put(e.getKey(), e.getValue().get(endTime-System.currentTimeMillis(), TimeUnit.MILLISECONDS));
} catch (Exception x) {
StringWriter sw = new StringWriter();
x.printStackTrace(new PrintWriter(sw,true));
r.put(e.getKey(), Collections.singletonMap("Failed to retrieve thread dump",sw.toString()));
r.put(e.getKey(), Collections.singletonMap("Failed to retrieve thread dump", Functions.printThrowable(x)));
}
}
return Collections.unmodifiableSortedMap(new TreeMap<String, Map<String, String>>(r));
......
package jenkins.security;
import hudson.Extension;
import hudson.Functions;
import hudson.init.InitMilestone;
import hudson.init.Initializer;
import hudson.model.TaskListener;
......@@ -152,7 +153,7 @@ public class RekeySecretAdminMonitor extends AsynchronousAdministrativeMonitor i
LOGGER.info("Secret re-keying completed");
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Fatal failure in re-keying secrets",e);
e.printStackTrace(listener.error("Fatal failure in rewriting secrets"));
listener.error("Fatal failure in rewriting secrets").print(Functions.printThrowable(e));
}
}
......
......@@ -3,6 +3,7 @@ package jenkins.slaves;
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.ClassicPluginStrategy;
import hudson.Extension;
import hudson.Functions;
import hudson.TcpSlaveAgentListener.ConnectionFromCurrentPeer;
import hudson.Util;
import hudson.model.Computer;
......@@ -171,7 +172,7 @@ public class DefaultJnlpSlaveReceiver extends JnlpAgentReceiver {
computer.setChannel(event.getChannel(), state.getLog(), null);
} catch (IOException | InterruptedException e) {
PrintWriter logw = new PrintWriter(state.getLog(), true);
e.printStackTrace(logw);
logw.print(Functions.printThrowable(e));
IOUtils.closeQuietly(event.getChannel());
}
}
......
package jenkins.slaves.restarter;
import hudson.Extension;
import hudson.Functions;
import hudson.model.Computer;
import hudson.model.TaskListener;
import hudson.remoting.Engine;
......@@ -93,7 +94,7 @@ public class JnlpSlaveRestarterInstaller extends ComputerListener implements Ser
LOGGER.log(FINE, "Effective SlaveRestarter on {0}: {1}", new Object[] {c.getName(), effective});
} catch (Throwable e) {
e.printStackTrace(listener.error("Failed to install restarter"));
listener.error("Failed to install restarter").print(Functions.printThrowable(e));
}
}
......
$t.printStackTrace($s) :: $s instance java.io.PrintStream && $t instanceof Throwable => $s.print(hudson.Functions.printThrowable($t));;
$t.printStackTrace($s) :: $s instance java.io.PrintWriter && $t instanceof Throwable => $s.print(hudson.Functions.printThrowable($t));;
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册