spring-projects / spring-projects/spring-data-commons

MappingContextTypeInformationMapper: No initialization and verification performed on construction [DATACMNS-1627]

Open
#2,054 3 comments 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 30, 2020.

in: core status: feedback-provided type: bug
Dominant language
Java
Stars
838
Forks
730
PR merge metrics
No merged PRs in 30d

Description

shimikano opened DATACMNS-1627 and commented

While debugging some issues with type aliases, we noticed that MappingContextTypeInformationMapper is not actually initialized with the aliases of the PersistentEntities in the MappingContext given to the constructor:

public MappingContextTypeInformationMapper(MappingContext<? extends PersistentEntity<?, ?>, ?> mappingContext) {
  Assert.notNull(mappingContext, "MappingContext must not be null!");

  this.typeMap = new ConcurrentHashMap<>();
  this.mappingContext = mappingContext;

  for (PersistentEntity<?, ?> entity : mappingContext.getPersistentEntities()) {
    verify(entity.getTypeInformation().getRawTypeInformation(), entity.getTypeAlias());
  }
}

verify(), contradictory to its javadoc, does not modify this.typeMap. Hence, neither verification nor initialization of the map is actually done.

Is this intended or am I missing something?


Affects: 2.2.2 (Moore SR2)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.