Skip to content
This repository was archived by the owner on Jun 16, 2018. It is now read-only.
This repository was 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

Description

@mdoninger

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions