dcapwell commented on code in PR #2104:
URL: https://github.com/apache/cassandra/pull/2104#discussion_r1132707457


##########
src/java/org/apache/cassandra/streaming/StreamSession.java:
##########
@@ -1340,32 +1338,41 @@ public String toString()
                '}';
     }
 
-    public static Throwable boundStackTrace(Throwable e, int limit)
+    public static StringBuilder boundStackTrace(Throwable e, int limit)
     {
         Set<Throwable> visited = Collections.newSetFromMap(new 
IdentityHashMap<>());
-        return boundStackTrace(e, limit, visited);
+        StringBuilder out = new StringBuilder();
+        return boundStackTrace(e, limit, visited, out);
     }
 
-    public static Throwable boundStackTrace(Throwable e, int limit, 
Set<Throwable> visited)
+    public static StringBuilder boundStackTrace(Throwable e, int limit, 
Set<Throwable> visited, StringBuilder out)
     {
         if (e == null)
-            return e;
+            return null;
 
         if (!visited.add(e))
-            return e;
+            return out.append("[CIRCULAR REFERENCE: 
").append(e.getClass().getName()).append(": 
").append(e.getMessage()).append("]");
         visited.add(e);
 
         if (e.getStackTrace().length == 0 || e.getStackTrace().length < limit)
         {
-            boundStackTrace(e.getCause(), limit, visited);
-            return e;
+            out.append(e.getClass().getName()).append(": 
").append(e.getMessage()).append('\n');
+            boundStackTrace(e.getCause(), limit, visited, out);

Review Comment:
   you are not printing the stack trace of `e`, nor do you know its safe to



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to