-
Notifications
You must be signed in to change notification settings - Fork 823
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
fix output window stacktrace parsing when mvnd is used. #5099
Conversation
92cabca
to
2968ee0
Compare
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.
Is there no test coverage for these utilities? It is hard for me to follow the impact from code inspection.
java/maven/src/org/netbeans/modules/maven/api/output/OutputUtils.java
Outdated
Show resolved
Hide resolved
java/maven/src/org/netbeans/modules/maven/execute/CommandLineOutputHandler.java
Show resolved
Hide resolved
BTW a before-and-after screenshot would be really helpful in the PR description as I am not positive I know what sort of output you are referring to here. |
of course. Should have done that right away. The description is a bit cryptic I have to admit. Somewhere between NB 8 and 9 the output window is also posting the |
1e03f1b
to
7cbfd4c
Compare
if (stackTraceElement.matcher(line).find()) { | ||
if (line.endsWith(")") && stackTraceElement.matcher(line).matches()) { |
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.
now I remember why i switched it to find()
in the first place: the folding code was already using find()
using the same pattern :)
updated the regexp and switched everything to matches()
+ added a fast path for even less overhead.
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.
Looks right. For now this is just tested interactively I guess.
@@ -50,7 +50,9 @@ | |||
* @author mkleint | |||
*/ | |||
public final class OutputUtils { | |||
public static final Pattern linePattern = Pattern.compile("(?:\\[catch\\])?\\sat (.*)\\((?:Native Method|(.*)\\.java\\:(\\d+))\\)"); //NOI18N | |||
|
|||
// example: '[WARN] at java.base/java.util.ImmutableCollections.uoe(ImmutableCollections.java:142)' |
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.
❤️
mvnd is using WARN instead of WARNING and prints the output type (stderr|stdout) on exceptions. Improvements to some regex patterns so that the faster match() can be used instead of find(), which improves parsing speed of long lines.
7cbfd4c
to
b2856f4
Compare
java/maven/src/org/netbeans/modules/maven/output/DependencyAnalyzeOutputProcessor.java
Show resolved
Hide resolved
@jglick thank you or your reviews! |
mvnd is using
WARN
instead ofWARNING
(switched to SLF4J it seems) and prints the output type(stderr|stdout)
on exceptions which causes stack traces to be not parsed.The
Level
enum is public api so we can't really change that. Instead,WARN
is simply mapped to theWARNING
enum.As side effect this also fixes some of the log level parsing which means that some of the maven output is now painted in a yellowish color. This looks good with the dark theme but might need some tweaks for the light theme.
test snippet:
NB 16:
PR applied: