Skip to content

Improve duplicate Id with different associated object error message #293

@moutyque

Description

@moutyque

Hello,
Working with Jackson I fell upon this exception:

throw new IllegalStateException("Already had POJO for id (" + id.key.getClass().getName() + ") [" + id

It gave me a hard time to understand the issue until I look into the code.
IMO the exception message is unclear. The issue is that we Already had POJO for id and the new and old object are different (the second part is no explicit in the exception hence can be tricky to debug.

Propostion:

throw new IllegalStateException("Different POJO share the same id (" + id.key.getClass().getName() + ") [" + id
                        + "]");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions