Indent overridden Throwable#printStackTrace output#25969
Indent overridden Throwable#printStackTrace output#25969Suvrat1629 wants to merge 1 commit intojenkinsci:masterfrom
Conversation
|
/label bug |
|
This needs to have test coverage. Also, please include before/after screenshots of the output to ensure that it's better, rather than worse, wrt. alternating Caused/Caused by lines. (Screenshots of text are usually inappropriate, but since this is about formatting more than actual content, I'd consider it preferable to text.) |
|
This needs to have a changelog entry that describes the issue in a way that a Jenkins user reading the changelog will understand what changed and how they might have seen the issue before the change. The comments in the pull request template provide more details on the phrasing of the changelog entry. This needs to have more description of the interactive testing that was performed. What actions in Jenkins did you take in order to see the badly formatted stack trace before this change? The original issue says that it happens in rare circumstances. Describe at least one of those rare circumstances. |
Sorry about that being vague. This just refers to it being unusual for exceptions to override these methods. I removed the only common occurrence in the ecosystem that I'm aware of in jenkinsci/jelly#125. |
Fixes #16544
Summary
When a Throwable overrides printStackTrace(PrintWriter) its multi-line output was appended raw by Functions.printThrowable, which could break indentation and interleave confusing "Caused"/"Caused by" lines and produce an extra blank line. The change captures the overridden output, splits it by line, and prefixes each line with the existing prefix so custom implementations are formatted consistently. The split avoids preserving a trailing empty element to prevent an extra blank line.
Testing done
Manual validation:
Proposed changelog entries
Proposed changelog category
/label
Proposed upgrade guidelines
N/A
Submitter checklist
@Restrictedor have@since TODOJavadocs, as appropriate.@Deprecated(since = "TODO")or@Deprecated(forRemoval = true, since = "TODO"), if applicable.evalto ease future introduction of Content Security Policy (CSP) directives (see documentation).Desired reviewers
@daniel-beck
Before the changes are marked as
ready-for-merge:Maintainer checklist
upgrade-guide-neededlabel is set and there is a Proposed upgrade guidelines section in the pull request title (see example).lts-candidateto be considered.