-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
jetty#11789 run list distinct on the generated resources list during startup #11790
base: jetty-12.0.x
Are you sure you want to change the base?
Conversation
@@ -485,7 +486,8 @@ public void resolve(WebAppContext context) | |||
resources.add(null); //always apply annotations with no resource first | |||
resources.addAll(_orderedContainerResources); //next all annotations from container path | |||
resources.addAll(_webInfClasses); //next everything from web-inf classes | |||
resources.addAll(getWebInfResources(isOrdered())); //finally annotations (in order) from webinf path | |||
resources.addAll(getWebInfResources(isOrdered())); //finally annotations (in order) from webinf path | |||
resources = resources.stream().distinct().collect(Collectors.toList()); // filter out possible duplicates |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@janbartel @jackeri I'm not opposed to defensively removing duplicates, but I think we should warn. Somethine like:
resources = resources.stream().distinct().collect(Collectors.toList()); // filter out possible duplicates | |
List<Resource> nodups = resources.stream().distinct().collect(Collectors.toList()); // filter out possible duplicates | |
if (nodups.length() < resources.length()) | |
{ | |
LOG.warning("Duplicate jars: " + resources); | |
resources = nodups; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not keen on this, as it is an error to have duplicates on the classpath, which is where this derives from.
@jackeri I hate not to accept a contribution, but I really think it's a mistake to try and filter out duplicates: this is an important indication that there is something wrong with the configuration of the webapp. The most that I think we should do is to simply log that there are duplicates - it is up to the user to fix the configuration of their webapp. So if you change your PR to just log which are duplications, then OK with that. |
Fixes the duplicate resource issue described in the ticket #11789