Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 330188 - Reject web-fragment.xml with same <name> as another already loaded one
Summary: Reject web-fragment.xml with same <name> as another already loaded one
Status: CLOSED FIXED
Alias: None
Product: Jetty
Classification: RT
Component: server (show other bugs)
Version: unspecified   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 enhancement (vote)
Target Milestone: 8.0.0.M2   Edit
Assignee: Jan Bartel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-13 17:46 EST by Michael Vorburger CLA
Modified: 2011-09-20 15:52 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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