Author: markt
Date: Wed Feb 15 20:57:36 2012
New Revision: 1244718

URL: http://svn.apache.org/viewvc?rev=1244718&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=52669
Correct regression introduced by the invalid assumptions made in the
hack for Eclipse to address 
https://issues.apache.org/bugzilla/show_bug.cgi?id=51741

Modified:
    tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
    tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties

Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1244718&r1=1244717&r2=1244718&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Wed Feb 15 
20:57:36 2012
@@ -1156,6 +1156,8 @@ public class ContextConfig implements Li
         parseWebXml(contextWebXml, webXml, false);
 
         if (webXml.getMajorVersion() >= 3) {
+            ServletContext sContext = context.getServletContext();
+
             // Ordering is important here
 
             // Step 1. Identify all the JARs packaged with the application
@@ -1178,6 +1180,9 @@ public class ContextConfig implements Li
                 // Step 4. Process /WEB-INF/classes for annotations
                 // This will add any matching classes to the typeInitializerMap
                 if (ok) {
+                    // Hack required by Eclipse's "serve modules without
+                    // publishing" feature since this backs WEB-INF/classes by
+                    // multiple locations rather than one.
                     NamingEnumeration<Binding> listBindings = null;
                     try {
                         try {
@@ -1190,9 +1195,20 @@ public class ContextConfig implements Li
                                 listBindings.hasMoreElements()) {
                             Binding binding = listBindings.nextElement();
                             if (binding.getObject() instanceof FileDirContext) 
{
-                                File webInfCLassDir = new File(
+                                File webInfClassDir = new File(
                                         ((FileDirContext) 
binding.getObject()).getDocBase());
-                                processAnnotationsFile(webInfCLassDir, webXml);
+                                processAnnotationsFile(webInfClassDir, webXml);
+                            } else {
+                                String resource =
+                                        "/WEB-INF/classes/" + 
binding.getName();
+                                try {
+                                    URL url = sContext.getResource(resource);
+                                    processAnnotationsUrl(url, webXml);
+                                } catch (MalformedURLException e) {
+                                    log.error(sm.getString(
+                                            "contextConfig.webinfClassesUrl",
+                                            resource), e);
+                                }
                             }
                         }
                     } catch (NamingException e) {
@@ -1236,9 +1252,9 @@ public class ContextConfig implements Li
                     // from having to re-generate it.
                     // TODO Use a ServletContainerInitializer for Jasper
                     String mergedWebXml = webXml.toXml();
-                    context.getServletContext().setAttribute(
+                    sContext.setAttribute(
                            
org.apache.tomcat.util.scan.Constants.MERGED_WEB_XML,
-                            mergedWebXml);
+                           mergedWebXml);
                     if (context.getLogEffectiveWebXml()) {
                         log.info("web.xml:\n" + mergedWebXml);
                     }

Modified: tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties?rev=1244718&r1=1244717&r2=1244718&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties 
(original)
+++ tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties Wed 
Feb 15 20:57:36 2012
@@ -60,7 +60,7 @@ contextConfig.stop=ContextConfig: Proces
 contextConfig.unavailable=Marking this application unavailable due to previous 
error(s)
 contextConfig.unknownUrlProtocol=The URL protocol [{0}] was not recognised 
during annotation processing. URL [{1}] was ignored.
 contextConfig.urlPatternValue=Both the UrlPattern and value attribute were set 
for the WebServlet annotation on class [{0}]
-contextConfig.webinfClassesUrl=Unable to determine URL for WEB-INF/classes
+contextConfig.webinfClassesUrl=Unable to determine URL for [{0}]
 contextConfig.xmlSettings=Context [{0}] will parse web.xml and 
web-fragment.xml files with validation:{1} and namespaceAware:{2}
 embedded.noEngines=No engines have been defined yet
 embedded.notmp=Cannot find specified temporary folder at {0}



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to