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

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


The following commit(s) were added to refs/heads/9.0.x by this push:
     new ecaea7ac63 69528: Add multi-release support to JarContents
ecaea7ac63 is described below

commit ecaea7ac634d3ea780a0ee2a949f09f7f7f49eca
Author: remm <r...@apache.org>
AuthorDate: Mon Jan 13 15:11:49 2025 +0100

    69528: Add multi-release support to JarContents
---
 java/org/apache/catalina/webresources/JarContents.java | 16 ++++++++++++++++
 webapps/docs/changelog.xml                             |  5 +++++
 2 files changed, 21 insertions(+)

diff --git a/java/org/apache/catalina/webresources/JarContents.java 
b/java/org/apache/catalina/webresources/JarContents.java
index d21faabf64..8ef7a93cde 100644
--- a/java/org/apache/catalina/webresources/JarContents.java
+++ b/java/org/apache/catalina/webresources/JarContents.java
@@ -21,6 +21,8 @@ import java.util.Enumeration;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 
+import org.apache.tomcat.util.compat.JreCompat;
+
 /**
  * This class represents the contents of a jar by determining whether a given 
resource <b>might</b> be in the cache,
  * based on a bloom filter. This is not a general-purpose bloom filter because 
it contains logic to strip out characters
@@ -67,6 +69,20 @@ public final class JarContents {
                 startPos = 1;
             }
 
+            // Versioned entries should be added to the table according to 
their real name
+            if (name.startsWith("META-INF/versions/", startPos)) {
+                int i = name.indexOf('/', 18 + startPos);
+                if (i > 0) {
+                    int version = Integer.parseInt(name.substring(18 + 
startPos, i));
+                    if (version <= 
JreCompat.getInstance().jarFileRuntimeMajorVersion()) {
+                        startPos = i + 1;
+                    }
+                }
+                if (startPos == name.length()) {
+                    continue;
+                }
+            }
+
             // Find the correct table slot
             int pathHash1 = hashcode(name, startPos, HASH_PRIME_1);
             int pathHash2 = hashcode(name, startPos, HASH_PRIME_2);
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index deefeecb91..94473dd735 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -131,6 +131,11 @@
         Fix possible edge cases (such as HTTP/1.0) with trying to detect
         requests without body for WebDAV LOCK and PROPFIND. (remm)
       </fix>
+      <fix>
+        <bug>69528</bug>: Add multi-release JAR support for the
+        <code>bloom</code> <code>archiveIndexStrategy</code> of the
+        <code>Resources</code>. (remm)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">


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

Reply via email to