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

Fix NullPointerException in MavenSelectionHintsTask #4994

Merged
merged 1 commit into from
Nov 23, 2022

Conversation

jglick
Copy link
Contributor

@jglick jglick commented Nov 21, 2022

Fixes #4993 by code inspection, amending mistake introduced in #3833. Both call sites require the result to be non-null:

List<ErrorDescription> errors = computeErrors(result, ss, se, cursorEvent.getCaretOffset());
HintsController.setErrors(result.getPomFile(), PomModelUtils.LAYER_POM_SELECTION, errors);
public static void setErrors(final @NonNull FileObject file, @NonNull final String layer, @NonNull Collection<? extends ErrorDescription> errors) {
Parameters.notNull("file", file);
Parameters.notNull("layer", layer);
Parameters.notNull("errors", errors);
errors = MavenSelectionHintsTask.computeErrors(result, context.getOffset(), context.getOffset(), context.getOffset());
} else {
errors = new ArrayList<>();
}
errors.addAll(PomModelUtils.findHints(result.getProjectModel(), p));

@jglick jglick requested a review from sdedic November 21, 2022 16:12
@mbien mbien added the Maven [ci] enable "build tools" tests label Nov 21, 2022
@mbien mbien added this to the NB17 milestone Nov 21, 2022
@mbien
Copy link
Member

mbien commented Nov 21, 2022

restarting CI for maven tests due to label change

@apache apache locked and limited conversation to collaborators Nov 21, 2022
@apache apache unlocked this conversation Nov 21, 2022
@sdedic sdedic merged commit 4e3c7f4 into apache:master Nov 23, 2022
@jglick jglick deleted the MavenSelectionHintsTask-NPE branch November 28, 2022 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Maven [ci] enable "build tools" tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The errors parameter cannot be null from HintsController.setErrors in MavenSelectionHintsTask
3 participants