From 60396c109dfa019f5930f2525734d89e58ed7211 Mon Sep 17 00:00:00 2001 From: Wenshuai Hou Date: Tue, 6 Apr 2021 17:57:00 -0400 Subject: [PATCH] bugfix --- .../java/com/github/fge/jsonpatch/diff/DiffProcessor.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/com/github/fge/jsonpatch/diff/DiffProcessor.java b/src/main/java/com/github/fge/jsonpatch/diff/DiffProcessor.java index 299d29a1..c5c8805a 100644 --- a/src/main/java/com/github/fge/jsonpatch/diff/DiffProcessor.java +++ b/src/main/java/com/github/fge/jsonpatch/diff/DiffProcessor.java @@ -59,9 +59,7 @@ void valueAdded(final JsonPointer pointer, final JsonNode value) final int removalIndex = findPreviouslyRemoved(value); if (removalIndex != -1) { final DiffOperation removed = diffs.get(removalIndex); - diffs.remove(removalIndex); - diffs.add(DiffOperation.move(removed.getFrom(), - value, pointer, value)); + diffs.set(removalIndex, DiffOperation.move(removed.getFrom(), value, pointer, value)); return; } final JsonPointer ptr = findUnchangedValue(value);