Skip to content

Commit 011aad0

Browse files
committed
Polishing.
Fix backport to use isPresent instead of isEmpty. See #2264
1 parent 47724b3 commit 011aad0

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/DomainObjectReader.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -685,9 +685,8 @@ public void doWithPersistentProperty(PersistentProperty<?> property) {
685685
result = mergeCollections(property, sourceValue, targetValue, mapper);
686686
} else if (property.isEntity()) {
687687

688-
result = targetValue.isEmpty()
689-
? sourceValue
690-
: targetValue.flatMap(t -> sourceValue.map(s -> mergeForPut(s, t, mapper)));
688+
result = targetValue.isPresent() ? targetValue.flatMap(t -> sourceValue.map(s -> mergeForPut(s, t, mapper)))
689+
: sourceValue;
691690
} else {
692691
result = sourceValue;
693692
}

0 commit comments

Comments
 (0)