-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix property value conversion in query mapper for nested values. #4517
Conversation
@@ -455,6 +455,15 @@ public <T> T getPropertyValue(MongoPersistentProperty property) { | |||
return collection.stream().map(it -> valueConverter.write(it, conversionContext)).collect(Collectors.toList()); | |||
} | |||
|
|||
if(!documentField.getProperty().isMap() && sourceValue instanceof Document document) { | |||
return new Document(document.entrySet().stream().collect(Collectors.toMap(entry -> entry.getKey(), entry -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor suggestion: .collect(Collectors.toMap(Entry::getKey, entry -> {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had a second look and using the stream API here bears some risks. Entry order may not be preserved and the usage of Collectors API can cause NPE due to JDK-8148463.
02f5819
to
98cea43
Compare
98cea43
to
75959f6
Compare
Refine nullability declarations and NPE guards. Reformat code.
Resolves: #4510