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 2024/06/13 12:12:12 UTC

(tomcat) branch 9.0.x updated (84f13f968f -> 0201c60b1a)

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 84f13f968f Fix static resources in a JAR file when using a bloom filter.
     new c9f0d989c4 Code clean-up - formatting. No functional change.
     new 0201c60b1a Align with 10.1.x and 11.0.x - no functional change

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/webresources/AbstractArchiveResourceSet.java  | 13 ++++++-------
 .../catalina/webresources/AbstractFileResourceSet.java     | 13 ++++++-------
 .../webresources/AbstractSingleArchiveResourceSet.java     |  2 +-
 java/org/apache/catalina/webresources/Cache.java           | 14 +++++++-------
 java/org/apache/catalina/webresources/CachedResource.java  |  4 ++--
 .../apache/catalina/webresources/JarWarResourceSet.java    | 10 +++++-----
 .../catalina/webresources/LocalStrings_ko.properties       |  1 -
 .../catalina/webresources/LocalStrings_zh_CN.properties    |  1 -
 8 files changed, 27 insertions(+), 31 deletions(-)


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


(tomcat) 02/02: Align with 10.1.x and 11.0.x - no functional change

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 0201c60b1a651ad7748fcea820271bdf1ac3f04b
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Jun 13 13:12:06 2024 +0100

    Align with 10.1.x and 11.0.x - no functional change
---
 .../catalina/webresources/AbstractFileResourceSet.java      | 13 ++++++-------
 .../apache/catalina/webresources/LocalStrings_ko.properties |  1 -
 .../catalina/webresources/LocalStrings_zh_CN.properties     |  1 -
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/java/org/apache/catalina/webresources/AbstractFileResourceSet.java b/java/org/apache/catalina/webresources/AbstractFileResourceSet.java
index 7a81b943b0..951f41d58e 100644
--- a/java/org/apache/catalina/webresources/AbstractFileResourceSet.java
+++ b/java/org/apache/catalina/webresources/AbstractFileResourceSet.java
@@ -99,13 +99,12 @@ public abstract class AbstractFileResourceSet extends AbstractResourceSet {
             return null;
         }
 
-        // Ensure that the file is not outside the fileBase. This should not be
-        // possible for standard requests (the request is normalized early in
-        // the request processing) but might be possible for some access via the
-        // Servlet API (RequestDispatcher, HTTP/2 push etc.) therefore these
-        // checks are retained as an additional safety measure
-        // absoluteBase has been normalized so absPath needs to be normalized as
-        // well.
+        /*
+         * Ensure that the file is not outside the fileBase. This should not be possible for standard requests (the
+         * request is normalized early in the request processing) but might be possible for some access via the Servlet
+         * API (e.g. RequestDispatcher, HTTP/2 push etc.) therefore these checks are retained as an additional safety
+         * measure absoluteBase has been normalized so absPath needs to be normalized as well.
+         */
         String absPath = normalize(file.getAbsolutePath());
         if (absPath == null || absoluteBase.length() > absPath.length()) {
             return null;
diff --git a/java/org/apache/catalina/webresources/LocalStrings_ko.properties b/java/org/apache/catalina/webresources/LocalStrings_ko.properties
index eb2a113123..6ac49eaedd 100644
--- a/java/org/apache/catalina/webresources/LocalStrings_ko.properties
+++ b/java/org/apache/catalina/webresources/LocalStrings_ko.properties
@@ -57,5 +57,4 @@ standardRoot.invalidPath=리소스 경로 [{0}]은(는) 유효하지 않습니
 standardRoot.invalidPathNormal=리소스 경로 [{0}]이(가) [{1}](으)로 정규화되어 있는데, 이는 유효하지 않습니다.
 standardRoot.lockedFile=웹 애플리케이션 [{0}]이(가) 파일 [{1}]을(를) 닫지 못했습니다. 해당 파일은 다음과 같은 스택 트레이스 내에서 열렸었습니다.
 standardRoot.noContext=컨텍스트가 이 WebResourceRoot를 위해 설정되지 않았습니다.
-standardRoot.startInvalidMain=지정된 주요 리소스셋 [{0}]은(는) 유효하지 않습니다.
 standardRoot.unsupportedProtocol=URL 프로토콜 [{0}]은(는), 이 웹 리소스 구현에 의해 지원되지 않습니다.
diff --git a/java/org/apache/catalina/webresources/LocalStrings_zh_CN.properties b/java/org/apache/catalina/webresources/LocalStrings_zh_CN.properties
index f1aaabde5f..7f87c2441b 100644
--- a/java/org/apache/catalina/webresources/LocalStrings_zh_CN.properties
+++ b/java/org/apache/catalina/webresources/LocalStrings_zh_CN.properties
@@ -57,5 +57,4 @@ standardRoot.invalidPath=资源路径[{0}]无效
 standardRoot.invalidPathNormal=资源路径[{0}]已规范化为无效的[{1}]
 standardRoot.lockedFile=Web应用程序[{0}]无法关闭通过以下堆栈跟踪打开的文件[{1}]
 standardRoot.noContext=尚未为WebResourceRoot配置上下文
-standardRoot.startInvalidMain=指定的主资源集 [{0}] 无效
 standardRoot.unsupportedProtocol=此web资源实现不支持URL协议[{0}]


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


(tomcat) 01/02: Code clean-up - formatting. No functional change.

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 c9f0d989c4e45332790d1909bb868d4b6e721ff0
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Jun 13 13:08:56 2024 +0100

    Code clean-up - formatting. No functional change.
---
 .../catalina/webresources/AbstractArchiveResourceSet.java  | 13 ++++++-------
 .../webresources/AbstractSingleArchiveResourceSet.java     |  2 +-
 java/org/apache/catalina/webresources/Cache.java           | 14 +++++++-------
 java/org/apache/catalina/webresources/CachedResource.java  |  4 ++--
 .../apache/catalina/webresources/JarWarResourceSet.java    | 10 +++++-----
 5 files changed, 21 insertions(+), 22 deletions(-)

diff --git a/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java b/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java
index 4f3c092f42..52ec4e9dbf 100644
--- a/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java
+++ b/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java
@@ -37,7 +37,7 @@ public abstract class AbstractArchiveResourceSet extends AbstractResourceSet {
     private URL baseUrl;
     private String baseUrlString;
     private JarFile archive = null;
-    protected Map<String, JarEntry> archiveEntries = null;
+    protected Map<String,JarEntry> archiveEntries = null;
     protected final Object archiveLock = new Object();
     private long archiveUseCount = 0;
     private JarContents jarContents;
@@ -163,7 +163,7 @@ public abstract class AbstractArchiveResourceSet extends AbstractResourceSet {
      *
      * @return The archives entries mapped to their names or null if {@link #getArchiveEntry(String)} should be used.
      */
-    protected abstract Map<String, JarEntry> getArchiveEntries(boolean single);
+    protected abstract Map<String,JarEntry> getArchiveEntries(boolean single);
 
 
     /**
@@ -205,10 +205,9 @@ public abstract class AbstractArchiveResourceSet extends AbstractResourceSet {
          * If jarContents reports that this resource definitely does not contain the path, we can end this method and
          * move on to the next jar.
          */
-        if (jarContents != null &&
-                !jarContents.mightContainResource(getInternalPath().isEmpty() ? path : getInternalPath() + path,
-                         webAppMount)) {
-                return new EmptyResource(root, path);
+        if (jarContents != null && !jarContents
+                .mightContainResource(getInternalPath().isEmpty() ? path : getInternalPath() + path, webAppMount)) {
+            return new EmptyResource(root, path);
         }
 
         /*
@@ -245,7 +244,7 @@ public abstract class AbstractArchiveResourceSet extends AbstractResourceSet {
                     // Calls JarFile.getJarEntry() which is multi-release aware
                     jarEntry = getArchiveEntry(pathInJar);
                 } else {
-                    Map<String, JarEntry> jarEntries = getArchiveEntries(true);
+                    Map<String,JarEntry> jarEntries = getArchiveEntries(true);
                     if (!(pathInJar.charAt(pathInJar.length() - 1) == '/')) {
                         if (jarEntries == null) {
                             jarEntry = getArchiveEntry(pathInJar + '/');
diff --git a/java/org/apache/catalina/webresources/AbstractSingleArchiveResourceSet.java b/java/org/apache/catalina/webresources/AbstractSingleArchiveResourceSet.java
index 13efaa3c2e..fb731e38f2 100644
--- a/java/org/apache/catalina/webresources/AbstractSingleArchiveResourceSet.java
+++ b/java/org/apache/catalina/webresources/AbstractSingleArchiveResourceSet.java
@@ -62,7 +62,7 @@ public abstract class AbstractSingleArchiveResourceSet extends AbstractArchiveRe
 
 
     @Override
-    protected Map<String, JarEntry> getArchiveEntries(boolean single) {
+    protected Map<String,JarEntry> getArchiveEntries(boolean single) {
         synchronized (archiveLock) {
             if (archiveEntries == null && !single) {
                 JarFile jarFile = null;
diff --git a/java/org/apache/catalina/webresources/Cache.java b/java/org/apache/catalina/webresources/Cache.java
index 467a43bf2e..03e933d37c 100644
--- a/java/org/apache/catalina/webresources/Cache.java
+++ b/java/org/apache/catalina/webresources/Cache.java
@@ -52,7 +52,7 @@ public class Cache {
     private LongAdder lookupCount = new LongAdder();
     private LongAdder hitCount = new LongAdder();
 
-    private final ConcurrentMap<String, CachedResource> resourceCache = new ConcurrentHashMap<>();
+    private final ConcurrentMap<String,CachedResource> resourceCache = new ConcurrentHashMap<>();
 
     public Cache(StandardRoot root) {
         this.root = root;
@@ -83,8 +83,8 @@ public class Cache {
         if (cacheEntry == null) {
             // Local copy to ensure consistency
             int objectMaxSizeBytes = getObjectMaxSizeBytes();
-            CachedResource newCacheEntry = new CachedResource(this, root, path, getTtl(), objectMaxSizeBytes,
-                    useClassLoaderResources);
+            CachedResource newCacheEntry =
+                    new CachedResource(this, root, path, getTtl(), objectMaxSizeBytes, useClassLoaderResources);
 
             // Concurrent callers will end up with the same CachedResource
             // instance
@@ -161,8 +161,8 @@ public class Cache {
         if (cacheEntry == null) {
             // Local copy to ensure consistency
             int objectMaxSizeBytes = getObjectMaxSizeBytes();
-            CachedResource newCacheEntry = new CachedResource(this, root, path, getTtl(), objectMaxSizeBytes,
-                    useClassLoaderResources);
+            CachedResource newCacheEntry =
+                    new CachedResource(this, root, path, getTtl(), objectMaxSizeBytes, useClassLoaderResources);
 
             // Concurrent callers will end up with the same CachedResource
             // instance
@@ -207,8 +207,8 @@ public class Cache {
         // Create an ordered set of all cached resources with the least recently
         // used first. This is a background process so we can afford to take the
         // time to order the elements first
-        TreeSet<CachedResource> orderedResources = new TreeSet<>(
-                Comparator.comparingLong(CachedResource::getNextCheck));
+        TreeSet<CachedResource> orderedResources =
+                new TreeSet<>(Comparator.comparingLong(CachedResource::getNextCheck));
         orderedResources.addAll(resourceCache.values());
 
         Iterator<CachedResource> iter = orderedResources.iterator();
diff --git a/java/org/apache/catalina/webresources/CachedResource.java b/java/org/apache/catalina/webresources/CachedResource.java
index f82b368851..0b7543ce30 100644
--- a/java/org/apache/catalina/webresources/CachedResource.java
+++ b/java/org/apache/catalina/webresources/CachedResource.java
@@ -339,8 +339,8 @@ public class CachedResource implements WebResource {
             return null;
         }
         try {
-            CachedResourceURLStreamHandler handler = new CachedResourceURLStreamHandler(resourceURL, root, webAppPath,
-                    usesClassLoaderResources);
+            CachedResourceURLStreamHandler handler =
+                    new CachedResourceURLStreamHandler(resourceURL, root, webAppPath, usesClassLoaderResources);
             URL result = new URL(null, resourceURL.toExternalForm(), handler);
             handler.setCacheURL(result);
             return result;
diff --git a/java/org/apache/catalina/webresources/JarWarResourceSet.java b/java/org/apache/catalina/webresources/JarWarResourceSet.java
index f9d1d968f1..974a8da595 100644
--- a/java/org/apache/catalina/webresources/JarWarResourceSet.java
+++ b/java/org/apache/catalina/webresources/JarWarResourceSet.java
@@ -87,7 +87,7 @@ public class JarWarResourceSet extends AbstractArchiveResourceSet {
      * JarWar can't optimise for a single resource so the Map is always returned.
      */
     @Override
-    protected Map<String, JarEntry> getArchiveEntries(boolean single) {
+    protected Map<String,JarEntry> getArchiveEntries(boolean single) {
         synchronized (archiveLock) {
             if (archiveEntries == null) {
                 JarFile warFile = null;
@@ -157,10 +157,10 @@ public class JarWarResourceSet extends AbstractArchiveResourceSet {
 
         int targetVersion = JreCompat.getInstance().jarFileRuntimeMajorVersion();
 
-        Map<String, VersionedJarEntry> versionedEntries = new HashMap<>();
-        Iterator<Entry<String, JarEntry>> iter = archiveEntries.entrySet().iterator();
+        Map<String,VersionedJarEntry> versionedEntries = new HashMap<>();
+        Iterator<Entry<String,JarEntry>> iter = archiveEntries.entrySet().iterator();
         while (iter.hasNext()) {
-            Entry<String, JarEntry> entry = iter.next();
+            Entry<String,JarEntry> entry = iter.next();
             String name = entry.getKey();
             if (name.startsWith("META-INF/versions/")) {
                 // Remove the multi-release version
@@ -194,7 +194,7 @@ public class JarWarResourceSet extends AbstractArchiveResourceSet {
             }
         }
 
-        for (Entry<String, VersionedJarEntry> versionedJarEntry : versionedEntries.entrySet()) {
+        for (Entry<String,VersionedJarEntry> versionedJarEntry : versionedEntries.entrySet()) {
             archiveEntries.put(versionedJarEntry.getKey(), versionedJarEntry.getValue().getJarEntry());
         }
     }


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