johnzon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel (Jira)" <j...@apache.org>
Subject [jira] [Updated] (JOHNZON-311) Create.diff is only fetching the last new element
Date Tue, 28 Apr 2020 18:41:00 GMT

     [ https://issues.apache.org/jira/browse/JOHNZON-311?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Daniel updated JOHNZON-311:
---------------------------
    Description: 
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;

}

  was:
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;
}


> 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
>            Priority: Critical
>         Attachments: image-2020-04-28-19-37-14-933.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;
> }



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Mime
View raw message