[
https://issues.apache.org/jira/browse/JOHNZON-311?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17097280#comment-17097280
]
Daniel commented on JOHNZON-311:
--------------------------------
Hi [~romain.manni-bucau] I tried it with latest code in git, and yes this is
also solved.
Sorry the behavior was a bit different so didn't know this was also fixed in
JOHNZON-304, this issue can be ignored
!image-2020-05-01-11-03-25-945.png!
> Create.diff is only fetching the last new element
> -------------------------------------------------
>
> Key: JOHNZON-311
> URL: https://issues.apache.org/jira/browse/JOHNZON-311
> Project: Johnzon
> Issue Type: Bug
> Components: Core
> Affects Versions: 1.2.4
> Reporter: Daniel
> Assignee: Romain Manni-Bucau
> Priority: Critical
> Attachments: image-2020-04-28-19-37-14-933.png,
> image-2020-04-28-19-42-01-283.png, image-2020-05-01-11-03-25-945.png
>
>
> Create.diff is only fetching the last new element and ignoring the others.
> This will cause an error when applying the diference
> Ex:
> !image-2020-04-28-19-37-14-933.png!
>
> Code used:
>
> {"eventLogs": [
> {"event": "event1"}
> ]}
> {"eventLogs": [
> {"event": "event1"}
> ,\{"event": "event2"},\{"event": "event3"}]}
>
> JsonValue source = readValues("{\"eventLogs\": [
> {\"event\": \"event1\"}
> ]}");
> JsonValue target = readValues("{\"eventLogs\": [
> {\"event\": \"event1\"}
> ,\{\"event\": \"event2\"},\{\"event\": \"event3\"}]}");
> JsonPatch diff = Json.createDiff(source.asJsonObject(),
> target.asJsonObject());
>
> private JsonValue readValues(String valuesToRead)
> { JsonReader reader = Json.createReader(new StringReader(valuesToRead));
> JsonValue value = reader.readValue(); reader.close(); return value; }
>
> Exception received
> !image-2020-04-28-19-42-01-283.png!
--
This message was sent by Atlassian Jira
(v8.3.4#803005)