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

Avoid NullPointerException when deserializing TestIdentifier #3820

Merged
merged 3 commits into from
May 16, 2024

Conversation

dmlloyd
Copy link
Contributor

@dmlloyd dmlloyd commented May 16, 2024

Overview

Fix NullPointerException when a TestIdentifier with no parentId is deserialized.

Issue: #3819


I hereby agree to the terms of the JUnit Contributor License Agreement.


Definition of Done

@marcphilipp marcphilipp linked an issue May 16, 2024 that may be closed by this pull request
1 task
Copy link
Member

@marcphilipp marcphilipp left a comment

Choose a reason for hiding this comment

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

Thanks for reporting and providing a fix! Could you please add a test to org.junit.platform.launcher.TestIdentifierTests to cover this scenario? It should suffice to serialize and deserialize TestIdentifier.from(engineDescriptor).

@dmlloyd
Copy link
Contributor Author

dmlloyd commented May 16, 2024

I've pushed up a test (and good thing too, because it uncovered a second place where the problem occurs). I don't really understand how the descriptors and identifiers work together though so I just created an anonymous instance of TestDescriptors with the exact characteristics that trigger the problem. Is that OK?

@dmlloyd
Copy link
Contributor Author

dmlloyd commented May 16, 2024

Hmm CI is failing due to a spotless check for a file I didn't touch: https://github.com/junit-team/junit5/actions/runs/9114769155/job/25059506872?pr=3820#step:3:731

Did I mess something up somehow?

To quote the great man: "I wasn't even in aisle seven!"

@dmlloyd
Copy link
Contributor Author

dmlloyd commented May 16, 2024

Also one more question... is there any chance that this change could be backported into a 5.10.3 release?

@marcphilipp
Copy link
Member

I don't really understand how the descriptors and identifiers work together though so I just created an anonymous instance of TestDescriptors with the exact characteristics that trigger the problem. Is that OK?

I polished the test to make it more like the others in that class in 85a300c.

Hmm CI is failing due to a spotless check for a file I didn't touch: junit-team/junit5/actions/runs/9114769155/job/25059506872?pr=3820#step:3:731

Did I mess something up somehow?

That was my bad. Earlier today, I pushed something to main that broke that. I just fixed it and merged the fix into your branch. Should be good now.

Also one more question... is there any chance that this change could be backported into a 5.10.3 release?

Would a 5.11.0-M2 release also work for you?

@dmlloyd
Copy link
Contributor Author

dmlloyd commented May 16, 2024

I don't really understand how the descriptors and identifiers work together though so I just created an anonymous instance of TestDescriptors with the exact characteristics that trigger the problem. Is that OK?

I polished the test to make it more like the others in that class in 85a300c.

Great! Thanks.

Hmm CI is failing due to a spotless check for a file I didn't touch: junit-team/junit5/actions/runs/9114769155/job/25059506872?pr=3820#step:3:731
Did I mess something up somehow?

That was my bad. Earlier today, I pushed something to main that broke that. I just fixed it and merged the fix into your branch. Should be good now.

Awesome!

Also one more question... is there any chance that this change could be backported into a 5.10.3 release?

Would a 5.11.0-M2 release also work for you?

I'm not sure; I'll follow up once I've consulted with the team.

@geoand
Copy link

geoand commented May 16, 2024

Would a 5.11.0-M2 release also work for you?

Is there any chance we can see a preliminary changelog for 5.11?
We have never encountered any issues upgrading in the past, but I would nevertheless like us to do our due diligence :)

@marcphilipp
Copy link
Member

marcphilipp commented May 16, 2024

Sure, here are the release notes for M1 and the preliminary ones for M2.

@geoand
Copy link

geoand commented May 16, 2024

Thanks!

@marcphilipp marcphilipp merged commit bc55d0e into junit-team:main May 16, 2024
14 checks passed
@dmlloyd dmlloyd deleted the fix-3819 branch May 16, 2024 15:56
@marcphilipp
Copy link
Member

@dmlloyd @geoand We just released 5.11.0-M2

@geoand
Copy link

geoand commented May 17, 2024

🙏

@geoand
Copy link

geoand commented May 22, 2024

@marcphilipp thanks again, for the release!
We tried and it and this fix works expected, however because the milestone release has some other effects that we would ideally like to avoid dealing with until a GA, release, is there any chance we could get a 5.10.3?

Thanks a lot

@dmlloyd
Copy link
Contributor Author

dmlloyd commented May 29, 2024

And relatedly, would it be useful if I put up a backport of this PR to the 5.10.x branch?

@dmlloyd
Copy link
Contributor Author

dmlloyd commented May 30, 2024

Just in case, I've opened #3837.

@sbrannen
Copy link
Member

@dmlloyd and @geoand,

I've opened #3838 so the team can consider backporting selected bug fixes to 5.10.x.

@geoand
Copy link

geoand commented May 31, 2024

Thanks a lot @sbrannen!

@sbrannen sbrannen changed the title Fix NPE when deserializing TestIdentifier Fix NullPointerException when deserializing TestIdentifier May 31, 2024
@sbrannen sbrannen changed the title Fix NullPointerException when deserializing TestIdentifier Avoid NullPointerException when deserializing TestIdentifier May 31, 2024
marcphilipp pushed a commit that referenced this pull request Jun 17, 2024
An NPE was thrown when (de)serializing `TestIdentifiers` without a parent.

Fixes #3819.

Co-authored-by: Marc Philipp <[email protected]>

(cherry picked from commit bc55d0e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NullPointerException when deserializing TestIdentifier
4 participants