DATAREST-1068 - Resize array during merge.

When merging new data into a PersistentEntity, JsonNodes of array types were deserialized into immutable Lists, but the list is later mutated if the source and target arrays are of different sizes. This commit ensures that an array is deserialized into a mutable list.

Original pull request: #371.
This commit is contained in:
Thomas Mrozinski
2020-02-18 18:48:36 -05:00
committed by Oliver Drotbohm
parent 55a70093db
commit 07039a2838
2 changed files with 20 additions and 1 deletions

View File

@@ -62,6 +62,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
* @author Mark Paluch
* @author Craig Andrews
* @author Mathias Düsterhöft
* @author Thomas Mrozinski
* @since 2.2
*/
@RequiredArgsConstructor
@@ -510,7 +511,7 @@ public class DomainObjectReader {
}
if (source.getClass().isArray()) {
return Arrays.asList((Object[]) source);
return new ArrayList<>(Arrays.asList((Object[]) source));
}
return null;