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 5673e087f1 BZ 68054: Optimize IO calls
5673e087f1 is described below

commit 5673e087f1e29afa97ecccf1f2b091a52b2b1b0b
Author: remm <r...@apache.org>
AuthorDate: Thu Nov 2 15:14:44 2023 +0100

    BZ 68054: Optimize IO calls
    
    Avoid some file canonicalization calls introduced by the fix for 65433.
---
 java/org/apache/catalina/webresources/DirResourceSet.java | 6 ++++--
 webapps/docs/changelog.xml                                | 4 ++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/webresources/DirResourceSet.java 
b/java/org/apache/catalina/webresources/DirResourceSet.java
index 3bd0245f0a..a221c3f1c3 100644
--- a/java/org/apache/catalina/webresources/DirResourceSet.java
+++ b/java/org/apache/catalina/webresources/DirResourceSet.java
@@ -164,8 +164,10 @@ public class DirResourceSet extends 
AbstractFileResourceSet {
                                 // path that was contributed by 'f' and check
                                 // that what is left does not contain a 
symlink.
                                 absPath = 
entry.getAbsolutePath().substring(f.getAbsolutePath().length());
-                                if (entry.getCanonicalPath().length() >= 
f.getCanonicalPath().length()) {
-                                    canPath = 
entry.getCanonicalPath().substring(f.getCanonicalPath().length());
+                                String entryCanPath = entry.getCanonicalPath();
+                                String fCanPath = f.getCanonicalPath();
+                                if (entryCanPath.length() >= 
fCanPath.length()) {
+                                    canPath = 
entryCanPath.substring(fCanPath.length());
                                     if (absPath.equals(canPath)) {
                                         symlink = false;
                                     }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 1709b1a789..0f425c1558 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -136,6 +136,10 @@
         <code>jakarta.servlet.error.exception</code> is not sufficient to
         trigger error handling for the current request and response. (markt)
       </fix>
+      <fix>
+        <bug>68054</bug>: Avoid some file canonicalization calls introduced
+        by the fix for <bug>65433</bug>. (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