DomainObjectReader doMerge fails for writable @JsonAnySetter properties
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Hi!
When using PATCH for objects that use @JsonAnySetter for deserialization and therefore don't have a corresponding property in MappedProperties, DomainObjectReader#doMerge fails. This used to work in previous versions of this class, when
if (!mappedProperties.hasPersistentPropertyForField(fieldName))
was used (without removing the field from deserialization, see changes in commit and commit ). Now
if (!mappedProperties.isWritableProperty(fieldName)) {
checks whether the property is writable (which is an improvement). But this also returns true if the class to merge contains an @JsonAnySetter. This means that the following call
PersistentProperty<?> property = mappedProperties.getPersistentProperty(fieldName);
returns null and the call after this
Optional<Object> rawValue = Optional.ofNullable(accessor.getProperty(property));
Throws the error.
The solution IMHO is a simple null check before the accessor.getProperty call like
if (property == null) {
continue;
}
This lets @JsonAnySetter handle the further deserialization, as I understand was the intention in previous versions and should be now.
I confirmed this fix with a test case, see referenced pull request.
- Lingua principale
- Java
- Stelle
- 957
- Fork
- 570
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di spring-projects/spring-data-rest
-
Release 5.0.9 (2025.1.9)Apertatype: task
Difficoltà 4/5 3-5 giorni Idoneità per principianti 20/100
spring-projects/spring-data-rest#2624 ·
-
Release 5.1.3 (2026.0.3)Apertatype: task
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
spring-projects/spring-data-rest#2623 ·
-
Release 5.2.0 (2026.1.0)Apertatype: task
Difficoltà 4/5 3-5 giorni Idoneità per principianti 15/100
spring-projects/spring-data-rest#2622 ·
-
Merge patch drops linkable associations of existing array elements since 4.3Forse già presa @odrotbohm l’ha presa 35 giorni fa. Apertastatus: feedback-provided status: waiting-for-triage
Difficoltà 3/5 1-2 giorni Idoneità per principianti 78/100
spring-projects/spring-data-rest#2596 · 3 commenti · 1 assegnatario ·
-
Querydsl filtering silently ignores nested property paths since GH-2572Forse già presa @odrotbohm l’ha presa 35 giorni fa. Apertatype: regression
Difficoltà 3/5 1-2 giorni Idoneità per principianti 76/100
spring-projects/spring-data-rest#2579 · 1 reazione · 1 assegnatario ·
Tutte le issue di spring-projects/spring-data-rest
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 3 giorni
-
A proxy that fails to start logs a RejectedExecutionException stack trace from its shutdown hookApertafollow-up
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
Sanne/incus-spawn#1953 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
Shweit/EtherealPortals#30 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 70/100
checkstyle/checkstyle#22398 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Typo in jakartaee-bom 12.0.0-SNAPSHOT with cdiForse già presa @ElectLive l’ha presa oggi. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 80/100
jakartaee/jakartaee-api#205 · 1 commento ·