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 NPE during report aggregation when multiple modules are specified using -pl arg #104

Merged
merged 3 commits into from
Dec 28, 2023

Conversation

sumeetgajjar
Copy link
Contributor

Fixes #103

What changes were proposed in this pull request?

This PR proposes to set topLevelModule variable to the current execution root when topLevelModule is null.
We achieve this by traversing upwards in the maven module hierarchy unless we find a module that returns true for module.isExecutionRoot().

After this fix, the aggregated report will be available in the current execution root matching the execution behavior of the when -pl is not specified.

Why are the changes needed?

When report aggregation is run against multiple modules are specified using -pl arg, topLevelModule is never set to a non-null value since non of the reactor projects return true for module.isExecutionRoot().

How was this patch tested?

Tested the patch manually on the example mentioned in #103

@sumeetgajjar
Copy link
Contributor Author

Hi @gslowikowski, could you please review this PR?

@sumeetgajjar
Copy link
Contributor Author

Gentle ping @gslowikowski :)

@jozic
Copy link
Collaborator

jozic commented Dec 23, 2023

Hi @sumeetgajjar
we now have integration tests here in the repo!
would you be interested in rebasing and updating your PR with a test?
thank you!

Copy link
Collaborator

@jozic jozic left a comment

Choose a reason for hiding this comment

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

@sumeetgajjar
I've added the test myself. It was failing without your changes, and is passing with the changes.
Thank you for your contribution!

@jozic jozic merged commit 2644e30 into scoverage:master Dec 28, 2023
4 checks passed
@sumeetgajjar
Copy link
Contributor Author

Hi @jozic,

I am travelling as of now thus my responses are delayed.

Thanks for rebasing the changes and adding the integration tests 😄
P.S. The tests look awesome!!!

@sumeetgajjar sumeetgajjar deleted the aggregate-report-NPE-fix branch December 28, 2023 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NPE during report aggregation when multiple modules are specified using -pl arg
2 participants