Skip to content
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

Stacktrace analyzer window fixes #6841

Merged
merged 1 commit into from Dec 17, 2023

Conversation

mbien
Copy link
Member

@mbien mbien commented Dec 14, 2023

example: this trace isn't parsed properly NB 20 (note: the space before '('):

java.util.zip.ZipException: zip file is empty
    at java.util.zip.ZipFile$Source.zerror (ZipFile.java:1769)
    at java.util.zip.ZipFile$Source.findEND (ZipFile.java:1565)
    at java.util.zip.ZipFile$Source.initCEN (ZipFile.java:1659)
    at java.util.zip.ZipFile$Source.<init> (ZipFile.java:1463)
    at java.util.zip.ZipFile$Source.get (ZipFile.java:1426)
    at java.util.zip.ZipFile$CleanableResource.<init> (ZipFile.java:742)
    at java.util.zip.ZipFile$CleanableResource.get (ZipFile.java:859)
    at java.util.zip.ZipFile.<init> (ZipFile.java:257)
    at java.util.zip.ZipFile.<init> (ZipFile.java:186)
    at java.util.zip.ZipFile.<init> (ZipFile.java:200)

image

even if the space is manually removed the result could be better (missing <init>, broken indentation on at-lines which can't be linked):
image

with this PR applied:
image

@mbien mbien added Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) UI User Interface labels Dec 14, 2023
@mbien mbien added this to the NB21 milestone Dec 14, 2023
Copy link
Member Author

@mbien mbien Dec 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

recommend to enable ignore whitespace changes for reviewing this one - sorry about this

@mbien
Copy link
Member Author

mbien commented Dec 14, 2023

@mbien mbien added ci:all-tests [ci] enable all tests ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) labels Dec 17, 2023
@mbien mbien removed the ci:all-tests [ci] enable all tests label Dec 17, 2023
Comment on lines 57 to +63
private static final Pattern LINE_PATTERN = Pattern.compile(
"at\\s" + // initial at // NOI18N
"at\\s+" + // initial at // NOI18N
"("+IDENTIFIER+"(?:\\."+IDENTIFIER+")*/)?" + // optional module name // NOI18N
"(("+IDENTIFIER+"(\\."+IDENTIFIER+")*)\\.)?("+IDENTIFIER+")" + // class name // NOI18N
"\\.("+IDENTIFIER+"|\\<init\\>|\\<clinit\\>)\\((?:"+IDENTIFIER+"(?:\\."+IDENTIFIER+")*/)?" +IDENTIFIER+"\\.?("+IDENTIFIER+ // method and file name // NOI18N
")\\:([0-9]*)\\)"); // line number // NOI18N
"\\.("+IDENTIFIER+"|\\<init\\>|\\<clinit\\>)\\s*"+ // method name
"\\((?:"+IDENTIFIER+"(?:\\."+IDENTIFIER+")*/)?"+IDENTIFIER+"(\\.(?:\\p{javaJavaIdentifierPart}+))?"+ // '(File.java' // NOI18N
"\\:([0-9]*)\\)"); // ':123)' // NOI18N
Copy link
Member Author

@mbien mbien Dec 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the original goal was to add a few optional \\s* but this does also include a fix for https://github.com/apache/netbeans/pull/6640/files#r1377502665, since this didn't work before as pointed out by @dbalek in the linked review.

The file extension group is now optional (\\.(?:\\p{javaJavaIdentifierPart}+))? and matches more character types since extensions aren't real java identifiers. Tests cover this now too.

@mbien mbien marked this pull request as ready for review December 17, 2023 08:13
Copy link
Contributor

@matthiasblaesing matthiasblaesing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sane to me. I left two inline comments, but these are nitpicks.

 - update matcher to be more forgiving when traces are pasted from ANSI
   decorated sources (some loggers use colors for exception elements)
 - some loggers add extra spaces to stack trace lines
 - properly escape angle brackets in cell renderer
 - some indentation fixes for lines which are rendered without link
   (e.g native code calls)
 - avoid using deprecated methods
@mbien mbien merged commit 5e3d779 into apache:master Dec 17, 2023
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) UI User Interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants