This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new 2810ac2340 69528: Add multi-release support to JarContents
2810ac2340 is described below
commit 2810ac234084e92b3282b0d2364deed4d03c7c21
Author: remm <[email protected]>
AuthorDate: Mon Jan 13 14:53:33 2025 +0100
69528: Add multi-release support to JarContents
---
java/org/apache/catalina/webresources/JarContents.java | 14 ++++++++++++++
.../apache/catalina/webresources/TestJarContents.java | 3 +++
test/webresources/dir1.jar | Bin 778 -> 1372 bytes
webapps/docs/changelog.xml | 5 +++++
4 files changed, 22 insertions(+)
diff --git a/java/org/apache/catalina/webresources/JarContents.java
b/java/org/apache/catalina/webresources/JarContents.java
index e5a5d9d69c..87c0693ea6 100644
--- a/java/org/apache/catalina/webresources/JarContents.java
+++ b/java/org/apache/catalina/webresources/JarContents.java
@@ -67,6 +67,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 <= Runtime.version().feature()) {
+ 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/test/org/apache/catalina/webresources/TestJarContents.java
b/test/org/apache/catalina/webresources/TestJarContents.java
index 6d55281a53..46434c2f12 100644
--- a/test/org/apache/catalina/webresources/TestJarContents.java
+++ b/test/org/apache/catalina/webresources/TestJarContents.java
@@ -70,6 +70,9 @@ public class TestJarContents {
Assert.assertTrue(testJarContentsObject.mightContainResource(
"d1/d1-f1.txt", jar.getAbsolutePath()));
+ Assert.assertTrue(testJarContentsObject.mightContainResource(
+ "f9.txt", jar.getAbsolutePath()));
+
Assert.assertFalse(testJarContentsObject.mightContainResource(
"/d7/d1-f1.txt", jar.getAbsolutePath()));
diff --git a/test/webresources/dir1.jar b/test/webresources/dir1.jar
index 1f81af0cec..ec0dee36c0 100644
Binary files a/test/webresources/dir1.jar and b/test/webresources/dir1.jar
differ
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index b478676dde..5d649c0e56 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -158,6 +158,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: [email protected]
For additional commands, e-mail: [email protected]