You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2020/01/16 11:34:19 UTC

[tomcat] branch 9.0.x updated (956be6c -> 0585e5a)

This is an automated email from the ASF dual-hosted git repository.

markt pushed a change to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


    from 956be6c  Clarify expected return value
     new 6cea73b  https://bz.apache.org/bugzilla/show_bug.cgi?id=64021 SCI ordering
     new 0585e5a  Correct ordering

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../catalina/startup/WebappServiceLoader.java      | 29 ++++++++++++++++------
 webapps/docs/changelog.xml                         | 29 +++++++++++++++-------
 2 files changed, 42 insertions(+), 16 deletions(-)


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


[tomcat] 01/02: https://bz.apache.org/bugzilla/show_bug.cgi?id=64021 SCI ordering

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 6cea73b33d9c17293fb5266ef3ffa56581d04e6c
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Jan 16 11:10:13 2020 +0000

    https://bz.apache.org/bugzilla/show_bug.cgi?id=64021 SCI ordering
    
    Ensure that container provided SCIs are always loaded before application
    provided SCIs. Where both container and application provide the same
    SCI, the application takes priority.
    SCI definitions from JARS unpacked into WEB-INF/classes are now handled
    consistently and will always be found irrespective of whether the web
    application defines a JAR ordering or not.
---
 .../catalina/startup/WebappServiceLoader.java      | 29 ++++++++++++++++------
 webapps/docs/changelog.xml                         | 11 ++++++++
 2 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/java/org/apache/catalina/startup/WebappServiceLoader.java b/java/org/apache/catalina/startup/WebappServiceLoader.java
index a47a8f9..d6b7623 100644
--- a/java/org/apache/catalina/startup/WebappServiceLoader.java
+++ b/java/org/apache/catalina/startup/WebappServiceLoader.java
@@ -34,6 +34,7 @@ import java.util.regex.Pattern;
 import javax.servlet.ServletContext;
 
 import org.apache.catalina.Context;
+import org.apache.catalina.WebResource;
 import org.apache.tomcat.util.scan.JarFactory;
 
 /**
@@ -58,6 +59,7 @@ import org.apache.tomcat.util.scan.JarFactory;
  * @see java.util.ServiceLoader
  */
 public class WebappServiceLoader<T> {
+    private static final String CLASSES = "/WEB-INF/classes/";
     private static final String LIB = "/WEB-INF/lib/";
     private static final String SERVICES = "META-INF/services/";
 
@@ -99,10 +101,23 @@ public class WebappServiceLoader<T> {
         // if the ServletContext has ORDERED_LIBS, then use that to specify the
         // set of JARs from WEB-INF/lib that should be used for loading services
         @SuppressWarnings("unchecked")
-        List<String> orderedLibs =
-                (List<String>) servletContext.getAttribute(ServletContext.ORDERED_LIBS);
-        if (orderedLibs != null) {
-            // handle ordered libs directly, ...
+        List<String> orderedLibs = (List<String>) servletContext.getAttribute(ServletContext.ORDERED_LIBS);
+
+        // Handle application SCIs directly...
+        if (orderedLibs == null) {
+            // No ordered libs, so use every service definition we can find
+            WebResource[] resources = context.getResources().getClassLoaderResources("/" + configFile);
+            for (WebResource resource : resources) {
+                if (resource.isFile()) {
+                    parseConfigFile(applicationServicesFound, resource.getURL());
+                }
+            }
+        } else {
+            // Ordered libs so only use services defined in those libs and any
+            // in WEB-INF/classes
+            URL unpacked = servletContext.getResource(CLASSES + configFile);
+            parseConfigFile(applicationServicesFound, unpacked);
+
             for (String lib : orderedLibs) {
                 URL jarUrl = servletContext.getResource(LIB + lib);
                 if (jarUrl == null) {
@@ -123,11 +138,11 @@ public class WebappServiceLoader<T> {
                     // no provider file found, this is OK
                 }
             }
-
-            // and the parent ClassLoader for all others
-            loader = context.getParentClassLoader();
         }
 
+        // and use the parent ClassLoader for all other SCIs
+        loader = context.getParentClassLoader();
+
         Enumeration<URL> resources;
         if (loader == null) {
             resources = ClassLoader.getSystemResources(configFile);
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 7006a2f..abf3bd2 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -80,6 +80,17 @@
         (michaelo)
       </fix>
       <fix>
+        <bug>64021</bug>: Ensure that container provided SCIs are always loaded
+        before application provided SCIs. Note that where both the container and
+        the application provide the same SCI, it is the application provided SCI
+        that will be used. (markt)
+      </fix>
+      <fix>
+        SCI definitions from JARs unpacked into <code>WEB-INF/classes</code> are
+        now handled consistently and will always be found irrespective of
+        whether the web application defines a JAR ordering or not. (markt)
+      </fix>
+      <fix>
         <bug>64023</bug>: Skip null-valued session attributes when deserializing
         sessions. (schultz)
       </fix>


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


[tomcat] 02/02: Correct ordering

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 0585e5a9bdffd703c23c590a91f7737a567268da
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Jan 16 11:11:59 2020 +0000

    Correct ordering
---
 webapps/docs/changelog.xml | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index abf3bd2..1bc44c3 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -56,6 +56,15 @@
         in JNDIRealm. (remm)
       </fix>
       <fix>
+        <bug>58577</bug>: Respect the argument-count when searching for MBean
+        operations to invoke via the JMXProxyServlet. (schultz)
+      </fix>
+      <update>
+        <bug>63691</bug>: Skip all jar and directory scanning when the wildcard
+        pattern &quot;*&quot; or &quot;*.jar&quot; is set or added to
+        <code>tomcat.util.scan.StandardJarScanFilter.jarsToSkip</code>. (isapir)
+      </update>
+      <fix>
         <bug>64005</bug>: Correct a regression in the static resource caching
         changes introduced in 9.0.28. Avoid a <code>NullPointerException</code>
         when working with the URL provided for the root of a packed WAR. (markt)
@@ -94,19 +103,10 @@
         <bug>64023</bug>: Skip null-valued session attributes when deserializing
         sessions. (schultz)
       </fix>
-      <update>
-        <bug>63691</bug>: Skip all jar and directory scanning when the wildcard
-        pattern &quot;*&quot; or &quot;*.jar&quot; is set or added to
-        <code>tomcat.util.scan.StandardJarScanFilter.jarsToSkip</code>. (isapir)
-      </update>
       <fix>
         Do not throw a NullPointerException when an MBean or operation cannot
         be found by the JMXProxyServlet. (schultz)
       </fix>
-      <fix>
-        <bug>58577</bug>: Respect the argument-count when searching for MBean
-        operations to invoke via the JMXProxyServlet. (schultz)
-      </fix>
       <update>
         <bug>64067</bug>: Allow more than one parameter when defining RewriteMaps.
         (fschumacher)


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