You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An IllegalStateException is occurring in the GET /owners/pets endpoint when an owner has multiple pets. This is due to the use of Collectors.toMap() which doesn't handle duplicate keys properly.
Root Cause:
The getOwnerPetsMap method uses Collectors.toMap() which throws IllegalStateException on duplicate keys
Multiple pets belonging to the same owner cause duplicate owner_id keys
Fix:
Modified the code to use Collectors.groupingBy instead of Collectors.toMap