-
Notifications
You must be signed in to change notification settings - Fork 415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Separate Multiple Frames With a Newline #433
Conversation
Thanks for the PR @alonalbert . It looks like the issue was introduced in #200: there were two places where |
result.append(trimmedLine); | ||
if (retracedFrames.hasNext()) { | ||
result.append("\n"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the change in #200: it looks like this should be like the following to revert to the previous behaviour:
result.append(trimmedLine); | |
if (retracedFrames.hasNext()) { | |
result.append("\n"); | |
} | |
result.append(trimmedLine); | |
result.append(System.lineSeparator()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 245 also had a similar change, which no longer adds a newline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the use of System.lineSeparator()
instead of "\n"
but if I accept your suggesion, we would end up with a newline separating each batch of frames. For example:
09-10 17:57:52.303 9066 9066 D Foobar : at S0.a.e(SourceFile:30)
09-10 17:57:52.303 9066 9066 D Foobar : at H.a.k(SourceFile:160)
09-10 17:57:52.303 9066 9066 D Foobar : at m.n.m(SourceFile:132)
09-10 17:57:52.303 9066 9066 D Foobar : at Z0.a.d(SourceFile:9)
09-10 17:57:52.303 9066 9066 D Foobar : at o1.v.n(SourceFile:81)
Will become:
09-10 17:57:52.303 9066 9066 D Foobar : at com.example.myapplication.Foo.foo(Foo.java:7)
09-10 17:57:52.303 9066 9066 D Foobar : at com.example.myapplication.MainActivity.onClick(MainActivity.java:38)
09-10 17:57:52.303 9066 9066 D Foobar : at com.example.myapplication.MainActivity.Greeting$lambda$1$lambda$0(MainActivity.java:43)
09-10 17:57:52.303 9066 9066 D Foobar : at S0.MainActivity$$ExternalSyntheticLambda0.invoke(MainActivity.java:0)
09-10 17:57:52.303 9066 9066 D Foobar : at androidx.compose.foundation.ClickablePointerInputNode$pointerInput$3.invoke-k-4lQ0M(ClickablePointerInputNode.java:987)
09-10 17:57:52.303 9066 9066 D Foobar : at androidx.compose.foundation.ClickablePointerInputNode$pointerInput$3.invoke(ClickablePointerInputNode.java:981)
09-10 17:57:52.303 9066 9066 D Foobar : at androidx.compose.foundation.gestures.TapGestureDetectorKt$detectTapAndPress$2$1.invokeSuspend(TapGestureDetectorKt.java:255)
09-10 17:57:52.303 9066 9066 D Foobar : at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(BaseContinuationImpl.java:33)
09-10 17:57:52.303 9066 9066 D Foobar : at kotlinx.coroutines.DispatchedTaskKt.resume(DispatchedTaskKt.java:179)
We need to either use an if (retracedFrames.hasNext())
as in my PR or maybe better, to change line 182 to use print
instead of println
:
stackTraceWriter.print(deobf);
I'm not sure what you mean about line 25. It seems to work without changing it.
I'm updating the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what you mean about line 25. It seems to work without changing it.
I meant the line here:
// Print out the original line.
result.append(obfuscatedLine);
which used to add a newline before #200 :
// Print out the original line.
stackTraceWriter.println(obfuscatedLine);
With the other changes, I'm not sure this is required to be changed though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With your latest change, if I take the following simple stacktrace and mapping, everything is printed on one line, so your original suggestion of adding the new line only if (retracedFrames.hasNext())
seems to be correct.
Caused by: java.lang.RuntimeException: AAA
at com.example.demo.sub.TestComponent2.a(Unknown Source)
at com.example.demo.DemoApplication.main(Unknown Source)
com.example.demo.DemoApplication -> com.example.demo.DemoApplication:
void <init>() -> <init>
void main(java.lang.String[]) -> main
com.example.demo.TestComponent -> com.example.demo.TestComponent:
void <init>() -> <init>
int getAnswer() -> a
com.example.demo.sub.TestComponent2 -> com.example.demo.sub.TestComponent2:
void <init>() -> <init>
java.lang.String getMessage() -> a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, for me, it works fine with the latest version.
I'm on a Linux machine. What system are you on?
@mrjameshamilton @alonalbert does current version look good to be merged or do we need to make more changes for this issue? |
When an obfuscated frame resolves to multiple clear frames, separate them with a newline.
Quality Gate passedIssues Measures |
I re-pushed the original version which I think is safer. |
Thanks! This version seems to work well on my sample as well. |
@mrjameshamilton what is the expected timeline when the fix can be released? Just to plan around approximate schedule. Thanks a lot for your efforts reviewing this. |
I'll make a release within the next week, we need a release for Java 23 support anyway. |
When an obfuscated frame resolves to multiple clear frames, separate them with a newline.
See #432