Fix for duplicate key violation for exposed ports by ctoestreich · Pull Request #1392 · docker-java/docker-java
Conversation
Found an issue where ports are being added duplicately to the map and causing an exception. I am still investigating how this situation arose, but this code will prevent the exception.
@ctoestreich please sync with the latest master to fix the CI
| public Map<String, Object> toPrimitive() { | ||
| return Stream.of(exposedPorts).collect(Collectors.toMap( | ||
| return Stream.of(exposedPorts) | ||
| .distinct() |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of distinct(), we can use a merge strategy (3rd argument of toMap) that does not throw, but uses the previously set value
@ctoestreich could you please allow maintainers to make edits? (there is a checkbox in PR's settings)
@bsideup looking for checkbox to allow don’t see it atm.
@ctoestreich ok, this is weird :D Could you please apply the change then? (3rd argument of toMap instead of distinct)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters