johnzon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Romain Manni-Bucau (Jira)" <j...@apache.org>
Subject [jira] [Commented] (JOHNZON-311) Create.diff is only fetching the last new element
Date Thu, 30 Apr 2020 05:41:00 GMT

    [ https://issues.apache.org/jira/browse/JOHNZON-311?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17096148#comment-17096148
] 

Romain Manni-Bucau commented on JOHNZON-311:
--------------------------------------------

Hi [~DPFSM], isn't it the same issue than JOHNZON-304 and therefore isn't it fixed on master?

> 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
>
>
> 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)

Mime
View raw message