gnodet commented on code in PR #12695:
URL: https://github.com/apache/maven/pull/12695#discussion_r4059755508


##########
impl/maven-logging/src/main/java/org/apache/maven/slf4j/MavenSimpleLogger.java:
##########
@@ -116,24 +160,32 @@ protected void printStackTrace(Throwable t, 
Consumer<String> stream, String pref
             stream.accept(builder.toString());
             builder.setLength(0);
         }
-        for (Throwable se : t.getSuppressed()) {
-            writeThrowable(se, stream, "Suppressed", prefix + "    ");
-        }
-        Throwable cause = t.getCause();
-        if (cause != null && t != cause) {
-            writeThrowable(cause, stream, "Caused by", prefix);
+        if (depth < MAX_THROWABLE_DEPTH) {
+            for (Throwable se : t.getSuppressed()) {
+                writeThrowable(se, stream, "Suppressed", prefix + "    ", 
depth + 1);
+            }
+            Throwable cause = t.getCause();
+            if (cause != null && t != cause) {
+                writeThrowable(cause, stream, "Caused by", prefix, depth + 1);
+            }
+        } else {
+            stream.accept(prefix + "    [...cause/suppressed chain truncated 
at depth " + MAX_THROWABLE_DEPTH + "]");

Review Comment:
   Fixed in 3abb55be32 — added `writeThrowableTruncatesAtMaxDepth` test: builds 
a 21-deep cause chain and asserts the truncation notice appears in the output.



-- 
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]

Reply via email to