Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deserialize from json #724

Closed
renemeuselwitz opened this issue Oct 2, 2018 · 3 comments
Closed

Deserialize from json #724

renemeuselwitz opened this issue Oct 2, 2018 · 3 comments
Labels

Comments

@renemeuselwitz
Copy link

renemeuselwitz commented Oct 2, 2018

Hi,

when serailizing and deserializing Diffs of objects, I'm having some trouble:

Let's assume the following:

`

   Item val1 = new Item();
    Item val2 = new Item();
    val1.setId(1234);
    val2.setId(5678);

    Javers javers = JaversBuilder.javers().build();
    Diff diff = javers.compare(val1, val2);

    String json = javers.getJsonConverter().toJson(diff); // until here it works

    Diff javersDiff = javers.getJsonConverter().fromJson(json , Diff.class); // here it crashes

`

I'm getting a "java.lang.IllegalArgumentException: argument should not be null" Exception. Debugging further into it gives me a
"Method threw 'java.lang.IllegalArgumentException' exception. Cannot evaluate org.javers.core.diff.Diff.toString()"

Any way to actually nicely deserialize my values again as Diff?

Thanks,

@renemeuselwitz
Copy link
Author

renemeuselwitz commented Oct 2, 2018

PS: I am using version 3.11.5.

I also rolled back, and the code works like a charm for version.

Seems like it stopped working somewhen in version 3.8. Still works for my with old versions until 3.7.9

@bartoszwalacik
Copy link
Member

@rene try to submit a PR with a fix, we will merge

@bartoszwalacik
Copy link
Member

fix released in 3.12.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants