Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49721
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 23 Aug 2010 19:37:25 +0000 (19:37 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 23 Aug 2010 19:37:25 +0000 (19:37 +0000)
All JARs can be resource JARs. Although the spec defines no order, use ordered JARs in order then the remaining JARs in any order.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@988266 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/startup/ContextConfig.java

index ad63834..c142da9 100644 (file)
@@ -37,6 +37,7 @@ import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Properties;
@@ -1269,7 +1270,18 @@ public class ContextConfig
             
             // Step 8. Look for static resources packaged in JARs
             if (ok) {
-                processResourceJARs(orderedFragments);
+                // Spec does not define an order.
+                // Use ordered JARs followed by remaining JARs
+                Set<WebXml> resourceJars = new LinkedHashSet<WebXml>();
+                for (WebXml fragment : orderedFragments) {
+                    resourceJars.add(fragment);
+                }
+                for (WebXml fragment : fragments.values()) {
+                    if (!resourceJars.contains(fragment)) {
+                        resourceJars.add(fragment);
+                    }
+                }
+                processResourceJARs(resourceJars);
             }
             
             // Step 9. Apply the ServletContainerInitializer config to the