[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-core-libs-dev
Subject:    Re: JDK 14 RFR of JDK-8226809: Circular reference in printed stack trace is not correctly indented &
From:       Brian Burkhalter <brian.burkhalter () oracle ! com>
Date:       2019-06-29 0:09:04
Message-ID: C33754EA-F057-47E7-9EF3-28E13CB07B21 () oracle ! com
[Download RAW message or body]

Hi Joe,

I think this patch and its revised output looks OK and agree about not adding a test \
for it.

Brian

> On Jun 28, 2019, at 4:42 PM, Joe Darcy <joe.darcy@oracle.com> wrote:
> […]
> 
> and the revised code prints this more helpfully as
> 
> java.lang.Exception: first
> at DejaVuStackTrace.main(DejaVuStackTrace.java:3)
> Suppressed: java.lang.Exception: second
> at DejaVuStackTrace.main(DejaVuStackTrace.java:4)
> Suppressed: java.lang.Exception: third
> at DejaVuStackTrace.main(DejaVuStackTrace.java:6)
> Suppressed: java.lang.Exception: fourth
> at DejaVuStackTrace.main(DejaVuStackTrace.java:8)
> Suppressed: [CIRCULAR REFERENCE: java.lang.Exception: first]
> Suppressed: java.lang.Exception: fifth
> at DejaVuStackTrace.main(DejaVuStackTrace.java:14)
> Caused by: [CIRCULAR REFERENCE: java.lang.Exception: second]
> 
> The format of the printed stack trace is not specified and I don't think it is \
> worthwhile to write a regression test for this change. 
> Cheers,
> 
> -Joe
> 
> diff -r c9093341cfe2 src/java.base/share/classes/java/lang/Throwable.java
> --- a/src/java.base/share/classes/java/lang/Throwable.java    Fri Jun 28 13:02:18 \
>                 2019 -0700
> +++ b/src/java.base/share/classes/java/lang/Throwable.java    Fri Jun 28 16:34:15 \
> 2019 -0700 @@ -693,7 +693,7 @@
> Set<Throwable> dejaVu) {
> assert Thread.holdsLock(s.lock());
> if (dejaVu.contains(this)) {
> -            s.println("\t[CIRCULAR REFERENCE:" + this + "]");
> +            s.println(prefix + caption + "[CIRCULAR REFERENCE: " + this + "]");
> } else {
> dejaVu.add(this);
> // Compute number of frames in common between this and enclosing trace
> 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic