GeezerVison is showing github.com — [core] Fix #7306: Don't close System.out in DeterministicOutputListenerWrapperTest by UncleOwen · Pull Request #7346 · pmd/pmd
Conversation
UncleOwen
commented
Nov 13, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Describe the PR
DeterministicOutputListenerWrapperTest passes the global System.out as the renderer writer:
setWriter(new PrintWriter(System.out));
At the end of PmdAnalysis.performAnalysis(), the renderer listener is closed and AbstractRenderer.flush() closes its writer. That closes the JVM-global System.out for the rest of the process.
With Maven/Surefire this is harmless, because test results are reported over Surefire's own channel. In IntelliJ, however, the JUnit runner relies on the output stream and can no longer report results once it is closed: the test and all subsequent tests in the same fork are marked as "terminated"/aborted (see IDEA-120628).
This change uses a throwaway StringWriter instead, so the test no longer touches global state. The test logic itself is unchanged.
Related issues
Ready?
- [n/a] Added unit tests for fixed bug/feature
- Passing all unit tests
- Complete build
./mvnw clean verify passes (checked automatically by github actions)
- [n/a] Added (in-code) documentation (if needed)
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Replace the PrintWriter in MyRendererSpy with a StringWriter, so that
System.out doesn't get closed.
|
Documentation Preview
No relevant source code has been changed, pmdtester skipped.
(comment created at 2026-11-27 19:35:21+00:00 for 102ec28)
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
# Conflicts:
# docs/pages/release_notes.md
This branch has not been deployed
No deployments
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.