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

Configurations.add(Configuration) results in UnsupportedOperationException #7613

Closed
joakime opened this issue Feb 17, 2022 · 1 comment · Fixed by #7631
Closed

Configurations.add(Configuration) results in UnsupportedOperationException #7613

joakime opened this issue Feb 17, 2022 · 1 comment · Fixed by #7631
Assignees
Labels
Bug For general bugs on Jetty side

Comments

@joakime
Copy link
Contributor

joakime commented Feb 17, 2022

Jetty version(s)
10.0.x+

Java version/vendor (use: java -version)
All

OS type/version
All

Description
While troubleshooting the issue reported at jetty-project/embedded-servlet-server#51

I discovered that if the following line of code is used ...

Configurations.setServerDefault(server).add(new AnnotationConfiguration());

It results in an exception ...

java.lang.UnsupportedOperationException
	at java.base/java.util.AbstractList.add(AbstractList.java:153)
	at java.base/java.util.AbstractList.add(AbstractList.java:111)
	at org.eclipse.jetty.demos.EmbedMe.createServer(EmbedMe.java:61)

This is because the Configurations class only has an overridden add() method that supports Configuration arrays, not single Configuration instances.

https://github.com/eclipse/jetty.project/blob/716c7afd8e40d8f645b32aff06945a249d6eb511/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/Configurations.java#L269

We should also override the AbstractList.add(Configuration) to allow single Configuration instances to be added easier.

@joakime joakime added the Bug For general bugs on Jetty side label Feb 17, 2022
@joakime joakime self-assigned this Feb 17, 2022
janbartel added a commit that referenced this issue Feb 21, 2022
@janbartel
Copy link
Contributor

I'm not totally convinced of the necessity for this, as we don't override most of the AbstractList methods. However FWIW here's a PR: #7631

janbartel added a commit that referenced this issue Feb 22, 2022
joakime pushed a commit that referenced this issue Feb 25, 2022
Signed-off-by: Jan Bartel <[email protected]>
(cherry picked from commit 3d9f346)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For general bugs on Jetty side
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants