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

NullPointerException when deserializing TestIdentifier #3819

Closed
1 task done
dmlloyd opened this issue May 16, 2024 · 0 comments · Fixed by #3820
Closed
1 task done

NullPointerException when deserializing TestIdentifier #3819

dmlloyd opened this issue May 16, 2024 · 0 comments · Fixed by #3820

Comments

@dmlloyd
Copy link
Contributor

dmlloyd commented May 16, 2024

The class org.junit.platform.launcher.TestIdentifier contains a customized serialization strategy that uses a separate object class to represent the object serialized form. However, the deserialization part of that class wrongly assumes that the parentId property, which is clearly optional (i.e. nullable), is not null (by way of unconditionally dereferencing it in order to call toString). This causes a NullPointerException in certain kinds of Quarkus tests (see quarkusio/quarkus#23612, specifically this comment) which lately have begun to use serialization to transport objects to the Quarkus class loader during testing.

Steps to reproduce

  • Build Quarkus (skip tests with mvn install -DskipTests; warning: this takes a while)
  • Check out Quarkus Super Heroes Demo
  • Go to rest-fights directory
  • Edit the pom.xml to change quarkus.platform.groupId to io.quarkus and quarkus.platform.version to 999-SNAPSHOT
  • mvn install, observe NPE test failures

Context

  • Used versions (Jupiter/Vintage/Platform): 5.10.2, but bug also occurs in HEAD
  • Build Tool/IDE: Maven (plus Quarkus)

Deliverables

  • Fix NPE by correcting deserialization logic (patch will be supplied)
dmlloyd added a commit to dmlloyd/junit5 that referenced this issue May 16, 2024
@marcphilipp marcphilipp added this to the 5.11 M2 milestone May 16, 2024
@marcphilipp marcphilipp linked a pull request May 16, 2024 that will close this issue
6 tasks
@marcphilipp marcphilipp changed the title NPE in org.junit.platform.launcher.TestIdentifier NPE when deserializing org.junit.platform.launcher.TestIdentifier May 16, 2024
@marcphilipp marcphilipp changed the title NPE when deserializing org.junit.platform.launcher.TestIdentifier NPE when deserializing TestIdentifier May 16, 2024
dmlloyd added a commit to dmlloyd/junit5 that referenced this issue May 16, 2024
@sbrannen sbrannen changed the title NPE when deserializing TestIdentifier NullPointerException when deserializing TestIdentifier May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants