File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
spar-wings-json-patch/src/main/java/jp/xet/sparwings/jackson/patch Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ class JsonPatches<T> implements UpdateRequest<T> {
3131
3232 private final ObjectMapper mapper ;
3333
34+ /** JSON Patch document node */
3435 private final JsonNode node ;
3536
3637
@@ -39,7 +40,8 @@ class JsonPatches<T> implements UpdateRequest<T> {
3940 public T apply (T original ) throws IllegalPatchException {
4041 try {
4142 JsonPatch patch = JsonPatch .fromJson (node );
42- JsonNode originalNode = mapper .valueToTree (original );
43+ String json = mapper .writeValueAsString (original );
44+ JsonNode originalNode = mapper .readTree (json );
4345 JsonNode patchedNode = patch .apply (originalNode );
4446 T patched = mapper .treeToValue (patchedNode , (Class <T >) original .getClass ());
4547 return patched ; // NOPMD
You can’t perform that action at this time.
0 commit comments