gnodet commented on code in PR #3590:
URL: https://github.com/apache/maven-surefire/pull/3590#discussion_r4792304307
##########
surefire-providers/common-java5/src/main/java/org/apache/maven/surefire/report/SmartStackTraceParser.java:
##########
@@ -179,7 +179,7 @@ public static String
stackTraceWithFocusOnClassAsString(Throwable t, String clas
StackTraceFilter filter = new ClassNameStackTraceFilter(className);
Throwable topmost = findTopmostWithClass(t, filter);
List<StackTraceElement> stackTraceElements =
focusInsideClass(topmost.getStackTrace(), filter);
- String s = causeToString(topmost.getCause(), filter);
+ String s = suppressedToString(t, filter) +
causeToString(topmost.getCause(), filter);
Review Comment:
**Potential inconsistency between `t` and `topmost`**
This line uses `suppressedToString(t, filter)` but
`causeToString(topmost.getCause(), filter)`. This creates an inconsistency:
- Suppressed exceptions are retrieved from the original exception `t`
- Causes are retrieved from the focused exception `topmost`
When `topmost != t` (which happens when focusing on a specific class deeper
in the cause chain), this means we're mixing information from two different
exceptions in the hierarchy.
**Consideration:** Should this be `suppressedToString(topmost, filter)` to
match the `causeToString(topmost.getCause(), filter)` call? Or should both use
`t` to show complete information about the original exception?
**Note:** This inconsistency pre-existed (the original code used `topmost`
for causes), so it's not introduced by this PR. However, it's worth
investigating the intended behavior. The current change doesn't make it worse
and successfully fixes the main issue (missing suppressed exceptions).
_Claude Code on behalf of Guillaume Nodet_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]