eclipse-ee4j / eclipse-ee4j/parsson
Wrong operation order in patch when updating arrays
- Dominant language
- Java
- Stars
- 17
- Forks
- 25
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
Generating a patch from two JSON-files, where the target extends an array of the source, yields an array of operations on the extended array in reverse. A subsequent application of the patch to the source then produces an exception:
javax.json.JsonException: An array item index is out of range. Index: 3, Size: 1
at org.glassfish.json.NodeReference$ArrayReference.add(NodeReference.java:282)
at org.glassfish.json.NodeReference$ArrayReference.add(NodeReference.java:248)
at org.glassfish.json.JsonPointerImpl.execute(JsonPointerImpl.java:234)
at org.glassfish.json.JsonPointerImpl.add(JsonPointerImpl.java:190)
at org.glassfish.json.JsonPatchImpl.apply(JsonPatchImpl.java:169)
at org.glassfish.json.JsonPatchImpl.apply(JsonPatchImpl.java:136)
at Patch.main(Patch.java:20)
With the attached files you can reproduce this.
Best regards,
Werner.
[test.zip](https://github.com/javaee/jsonp/files/1352298/test.zip)
Contributor guide
Assessment
This issue has not been assessed yet.