Skip to content
This repository has been archived by the owner on Jun 16, 2018. It is now read-only.

Exception when diffing a class which uses primitive arrays (like GregorianCalendar) #13

Open
mdoninger opened this issue Nov 12, 2014 · 0 comments

Comments

@mdoninger
Copy link

I get the following exception when i create a diff between two entities which have a Calendar field:

org.springframework.sync.PatchException: Error performing diff:
    at org.springframework.sync.Diff.diff(Diff.java:56)
    at SyncCalendarTest.testCalendarUsage(SyncCalendarTest.java:30)
    at ...
Caused by: java.lang.ClassCastException: [I cannot be cast to [Ljava.lang.Object;
    at org.springframework.sync.Diff.diffNonList(Diff.java:123)
    at org.springframework.sync.Diff.diffNonList(Diff.java:126)
    at org.springframework.sync.Diff.diffList(Diff.java:74)
    at org.springframework.sync.Diff.diff(Diff.java:49)
    ... 27 more

This is caused by the cast to Object[] in the line

diffList(operations, path + "/" + field.getName(), Arrays.asList((Object[]) origValue), Arrays.asList((Object[]) modValue));

however, some array fields in the class GregorianCalendar have the type int, which then can't be casted. So this bug might also be applicable to all other classes which use primitive arrays.

@mdoninger mdoninger changed the title Exception when diffing a class which uses GregorianCalendar Exception when diffing a class which uses primitive arrays (like GregorianCalendar) Nov 12, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant