Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 330188

Summary: Reject web-fragment.xml with same <name> as another already loaded one
Product: [RT] Jetty Reporter: Michael Vorburger <mike>
Component: serverAssignee: Jan Bartel <janb>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: janb, jetty-inbox
Version: unspecified   
Target Milestone: 8.0.0.M2   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Michael Vorburger CLA 2010-11-13 17:46:11 EST
Build Identifier: 8.0.0.M1

It would be "nice", convenient for development, if when during the loading web-fragment.xml, the fragment has a  <name> that has already been seen, the fragment would get rejected.

I've noticed that while Jetty appears to be just happy with a WAR having two fragments with the same name, Apache Tomcat 7.0.4 ignores one of them, without warning log - leading to a kind of hard to detect & confusing "problem" (which is easily fixed, by changing one of the names - once you know about the problem).

It's probably fairly easy to implement this, may just be something like an  if (_webFragmentNameMap.containsKey(descriptor.getName())) throw new ...Exception() in MetaData.addFragment() before _webFragmentNameMap.put(descriptor.getName(), descriptor);? Haven't tried.

Reproducible: Always
Comment 1 Michael Vorburger CLA 2010-11-13 17:48:22 EST
PS, actually sorry, correcting myself: The best behavior IMHO would actually not be that "the fragment would get rejected" as I wrote, but to refuse the entire WebApp, with a clear log & exception as to why.
Comment 2 Jan Bartel CLA 2010-11-14 21:37:44 EST
Fixed in jetty-8 trunk rev 2500.
Comment 3 Jesse McConnell CLA 2011-09-20 15:52:07 EDT
Resolved -> Closed