-
Notifications
You must be signed in to change notification settings - Fork 917
NPEs in JUnitOutputListenerProvider
#8433
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
Conversation
lkishalmi
left a comment
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.
@jglick The change seems to be fine. Could you rebase this one on delivery so this could get into NB26-rc2?
eb99157 to
98e53cd
Compare
mbien
left a comment
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 do not recall details of what this Context is (it has no Javadoc).
the lack of comments is something I also sometimes struggle with. But most of those output listeners are little log parsing state machines. So this Context seems to keep track of the project being currently built.
This all falls apart once something enables parallelism of any kind or the log patterns change.
java/maven.junit/src/org/netbeans/modules/maven/junit/JUnitOutputListenerProvider.java
Outdated
Show resolved
Hide resolved
| OutputVisitor.Context context = visitor.getContext(); | ||
| if (context != null) { | ||
| Project currentProject = context.getCurrentProject(); | ||
| if (currentProject != null) { |
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.
nitpick: you could cover both with one if chained with && like in the other comment. Those are pure field accessors with no extra code so it is ok to call them twice.
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.
| private Context context; |
final so the current idiom seems safer in the face of potential concurrent modifications.
|
just as reminder: don't merge this even when approved since merges to delivery are done by the release manager. |
Note that there is no parallelism involved in this test case. |
| Project cp = context.getCurrentProject(); | ||
| if (cp != null) { | ||
| NbMavenProject subProject = cp.getLookup().lookup(NbMavenProject.class); | ||
| if (subProject != null) { |
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.
(Ignore whitespace changes to review.)
mbien
left a comment
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.
cool, thanks! feel free to squash as usual.
yes I know. It was a general comment that the whole system is very fragile and many features have to turn themself off if |
Sorry, I have no idea what the usual workflow in this repo is these days. Best if an active maintainer merges PRs. I think I have write access for historical reasons, but triage would be more appropriate. |
|
@jglick squash and force push to your own branch. |
e501353 to
08d606f
Compare
|
Merging |
|
the NPE turned out to be a symptom of a larger regression, #8539 is a followup. |
I consistently get an error in NB 25 when testing Jenkins plugins with
mvndwhich seems to be similar to, yet distinct from, #5645. Can be reproduced by opening e.g. https://github.com/jenkinsci/workflow-job-plugin, selecting a
@Testmethod, and running it, when the Maven executable is set to https://github.com/apache/maven-mvnd rather than regular Maven. The build gets as far as printingand then this exception is thrown and the output window is abruptly marked complete. With patch (tested using
ant -f java/maven.junit run), the rest of the output starting withis printed normally.
Note that fixing the NPE reported above was not enough; I just got another NPE. Reviewing the file, I found a general lack of respect for
@CheckForNullfor two method calls so I tried to fix all occurrences just in case. I do not recall details of what thisContextis (it has no Javadoc).^Add meaningful description above
Click to collapse/expand PR instructions
By opening a pull request you confirm that, unless explicitly stated otherwise, the changes -
Please make sure (eg.
git log) that all commits have a valid name and email address for you in the Author field.If you're a first time contributor, see the Contributing guidelines for more information.
If you're a committer, please label the PR before pressing "Create pull request" so that the right test jobs can run.
PR approval and merge checklist:
If this PR targets the delivery branch: don't merge. (full wiki article)