Skip to content

NullPointerException when deserializing TestIdentifier #3819

@dmlloyd

Description

@dmlloyd

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)

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions