[
https://issues.apache.org/jira/browse/GROOVY-12732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18140605#comment-18140605
]
ASF GitHub Bot commented on GROOVY-12732:
-----------------------------------------
codecov-commenter commented on PR #3267:
URL: https://github.com/apache/groovy/pull/3267#issuecomment-6719059302
##
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3267?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 74.4173%. Comparing base
([`cb1b208`](https://app.codecov.io/gh/apache/groovy/commit/cb1b208fbbf57eac3cee52eb786eadc9277ec1c2?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
to head
([`bad60e6`](https://app.codecov.io/gh/apache/groovy/commit/bad60e6de503d1296a5b6ae9b89f9ba2ec9b70bc?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 1 commits behind head on master.
<details><summary>Additional details and impacted files</summary>
[](https://app.codecov.io/gh/apache/groovy/pull/3267?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #3267 +/- ##
==================================================
+ Coverage 74.4126% 74.4173% +0.0047%
- Complexity 44372 44379 +7
==================================================
Files 1699 1699
Lines 151051 151067 +16
Branches 28783 28790 +7
==================================================
+ Hits 112401 112420 +19
+ Misses 28376 28373 -3
Partials 10274 10274
```
| [Files with missing
lines](https://app.codecov.io/gh/apache/groovy/pull/3267?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
| Coverage Δ | |
|---|---|---|
|
[src/main/java/groovy/ui/GroovyMain.java](https://app.codecov.io/gh/apache/groovy/pull/3267?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Fgroovy%2Fui%2FGroovyMain.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9ncm9vdnkvdWkvR3Jvb3Z5TWFpbi5qYXZh)
| `68.8406% <100.0000%> (+1.8116%)` | :arrow_up: |
|
[...java/org/codehaus/groovy/control/XStreamUtils.java](https://app.codecov.io/gh/apache/groovy/pull/3267?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fcontrol%2FXStreamUtils.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NvbnRyb2wvWFN0cmVhbVV0aWxzLmphdmE=)
| `58.5366% <100.0000%> (+7.3171%)` | :arrow_up: |
... and [16 files with indirect coverage
changes](https://app.codecov.io/gh/apache/groovy/pull/3267/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test
Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests,
report on failures, and find test suite problems.
- :package: [JS Bundle
Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save
yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
> groovy command logs "Caught: {0}" without filling the placeholder and prints
> the stack trace twice
> --------------------------------------------------------------------------------------------------
>
> Key: GROOVY-12732
> URL: https://issues.apache.org/jira/browse/GROOVY-12732
> Project: Groovy
> Issue Type: Bug
> Components: command line processing
> Affects Versions: 6.0.0
> Reporter: Scott Murphy Heiberg
> Priority: Minor
>
> When a script throws, the {{groovy}} command logs its message with the
> placeholder unfilled, then prints the exception's stack trace twice: first
> unsanitized, through the logger, then sanitized, by {{printStackTrace()}}.
> Throws.groovy:
> {code:groovy}
> throw new IllegalStateException('boom')
> {code}
> Groovy 6.0.0 on JDK 25:
> {noformat}
> $ groovy Throws.groovy
> Nov 07, 2026 10:58:15 PM groovy.ui.GroovyMain run
> SEVERE: Caught: {0}
> java.lang.IllegalStateException: boom
> at Throws.run(Throws.groovy:1)
> at
> groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:322)
> at groovy.lang.GroovyShell.run(GroovyShell.java:468)
> at groovy.lang.GroovyShell.run(GroovyShell.java:457)
> at groovy.ui.GroovyMain.processOnce(GroovyMain.java:851)
> at groovy.ui.GroovyMain.run(GroovyMain.java:450)
> at groovy.ui.GroovyMain$GroovyCommand.process(GroovyMain.java:355)
> at groovy.ui.GroovyMain.processArgs(GroovyMain.java:168)
> at groovy.ui.GroovyMain.main(GroovyMain.java:127)
> at
> java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
> at java.base/java.lang.reflect.Method.invoke(Method.java:565)
> at
> org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:150)
> at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:52)
> java.lang.IllegalStateException: boom
> at Throws.run(Throws.groovy:1)
> {noformat}
> The 6.0.1-SNAPSHOT and master behave the same. Before GROOVY-11886 the
> command printed {{Caught: java.lang.IllegalStateException: boom}} and then
> the sanitized trace once.
> Cause: GROOVY-11886 replaced {{System.err.println("Caught: " + e)}} in
> {{GroovyMain.run()}} with
> {code:java}
> LOGGER.log(ERROR, "Caught: {0}", e);
> {code}
> Because {{e}} is a {{Throwable}}, Java selects {{System.Logger.log(Level,
> String, Throwable)}} rather than {{log(Level, String, Object...)}}. The
> message is not formatted, and the throwable is logged with its full stack
> trace before {{StackTraceUtils.deepSanitize}} runs, so that copy ignores the
> {{-d}} setting. The other logging calls with a \{0\} placeholder pass
> arguments that are not throwables and are not affected.
> The line was noticed, as a side note, in the description of GROOVY-12683.
> Proposed fix: log the text only, {{LOGGER.log(ERROR, "Caught: " + e)}}, and
> keep the single sanitized {{printStackTrace()}}. A pull request with a test
> in GroovyMainTest follows.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)