Skip to content

Commit

Permalink
Merge pull request #38 from jglick/printStackTrace-JDK-6507809
Browse files Browse the repository at this point in the history
Use Functions.printThrowable to provide more legible stack traces in 2.43+
  • Loading branch information
jglick committed Feb 27, 2017
2 parents 1d4c60f + 4944ae2 commit 08a7978
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import hudson.Extension;
import hudson.ExtensionList;
import hudson.FilePath;
import hudson.Functions;
import hudson.Launcher;
import hudson.init.InitMilestone;
import hudson.init.Initializer;
Expand Down Expand Up @@ -641,7 +642,7 @@ public void replaceAction(Action a) {
} catch (AbortException x) {
listener.error("polling failed in " + co.workspace + " on " + co.node + ": " + x.getMessage());
} catch (Exception x) {
x.printStackTrace(listener.error("polling failed in " + co.workspace + " on " + co.node));
listener.error("polling failed in " + co.workspace + " on " + co.node).println(Functions.printThrowable(x).trim()); // TODO 2.43+ use Functions.printStackTrace
}
}
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import hudson.EnvVars;
import hudson.Extension;
import hudson.FilePath;
import hudson.Functions;
import hudson.XmlFile;
import hudson.console.AnnotatedLargeText;
import hudson.console.LineTransformationOutputStream;
Expand Down Expand Up @@ -621,7 +622,7 @@ private void finish(@Nonnull Result r, @CheckForNull Throwable t) {
} else if (t instanceof FlowInterruptedException) {
((FlowInterruptedException) t).handle(this, listener);
} else if (t != null) {
t.printStackTrace(listener.getLogger());
listener.getLogger().println(Functions.printThrowable(t).trim()); // TODO 2.43+ use Functions.printStackTrace
}
listener.finished(getResult());
listener.closeQuietly();
Expand Down

0 comments on commit 08a7978

Please sign in to comment.