Skip to content

Fix for duplicate key violation for exposed ports#1392

Closed
ctoestreich wants to merge 3 commits into
docker-java:masterfrom
tardisoft:master
Closed

Fix for duplicate key violation for exposed ports#1392
ctoestreich wants to merge 3 commits into
docker-java:masterfrom
tardisoft:master

Conversation

@ctoestreich

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor Author

The test failures appear to be unrelated and on mainline.

@bsideup

bsideup commented May 23, 2020

Copy link
Copy Markdown
Member

@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()

Copy link
Copy Markdown
Member

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

@bsideup

bsideup commented May 24, 2020

Copy link
Copy Markdown
Member

@ctoestreich could you please allow maintainers to make edits? (there is a checkbox in PR's settings)

@ctoestreich

Copy link
Copy Markdown
Contributor Author

@bsideup looking for checkbox to allow don’t see it atm.

@ctoestreich

Copy link
Copy Markdown
Contributor Author

Nope not on screen and not avail after close or reopen.

@bsideup

bsideup commented May 25, 2020

Copy link
Copy Markdown
Member

@ctoestreich you should find it on PR's right section:
Screenshot 2020-05-25 at 9 01 55 AM

@ctoestreich

Copy link
Copy Markdown
Contributor Author

@bsideup nope not there for me. Sorry on the iPad and the copy paste photos doesn’t want to work with github. https://share.icloud.com/photos/0lO0qcXfNzuLypHg8b_6GnGdQ

@bsideup

bsideup commented May 27, 2020

Copy link
Copy Markdown
Member

@ctoestreich ok, this is weird :D Could you please apply the change then? (3rd argument of toMap instead of distinct)

@bsideup

bsideup commented Jun 1, 2020

Copy link
Copy Markdown
Member

Superseeded by #1406

@bsideup bsideup closed this Jun 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ExposedPorts Map setting Duplicate Key

2 participants