Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addExposedPort fails when called after withExposedPorts #451

Closed
orange-buffalo opened this issue Sep 3, 2017 · 0 comments
Closed

addExposedPort fails when called after withExposedPorts #451

orange-buffalo opened this issue Sep 3, 2017 · 0 comments

Comments

@orange-buffalo
Copy link
Contributor

In my use case I configure a container using withExposedPorts method and then process this container in common code by exposing one more port. I would like to call addExposedPort, but this fails with exception:

java.lang.UnsupportedOperationException
	at java.util.AbstractList.add(AbstractList.java:148)
	at java.util.AbstractList.add(AbstractList.java:108)
	at org.testcontainers.containers.GenericContainer.addExposedPort(GenericContainer.java:532)

So I have to first get all exposed ports, add new one and call withExposedPorts again.

If the code in withExposedPorts would be changed from

this.setExposedPorts(asList(ports));

to

this.setExposedPorts(new ArrayList(asList(ports)));

or to

this.setExposedPorts(Lists.newArrayList(ports));

this would solve the problem.

orange-buffalo added a commit to orange-buffalo/testcontainers-java that referenced this issue Sep 8, 2017
orange-buffalo added a commit to orange-buffalo/testcontainers-java that referenced this issue Sep 9, 2017
@rnorth rnorth closed this as completed in ecb3286 Sep 16, 2017
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

No branches or pull requests

1 participant