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

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


The following commit(s) were added to refs/heads/10.1.x by this push:
     new 729859f2cb Avoid unchecked exception for very large files
729859f2cb is described below

commit 729859f2cb97627ebbb379a14b42c687211787e2
Author: remm <r...@apache.org>
AuthorDate: Wed Nov 20 12:14:47 2024 +0100

    Avoid unchecked exception for very large files
    
    This works because there's a cache on top returning null for cached
    files, but the javadoc is explicit that null should be returned when the
    file is too big.
---
 java/org/apache/catalina/webresources/FileResource.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/webresources/FileResource.java 
b/java/org/apache/catalina/webresources/FileResource.java
index 354022f909..9b7db00d6d 100644
--- a/java/org/apache/catalina/webresources/FileResource.java
+++ b/java/org/apache/catalina/webresources/FileResource.java
@@ -216,8 +216,10 @@ public class FileResource extends AbstractResource {
 
         if (len > Integer.MAX_VALUE) {
             // Can't create an array that big
-            throw new ArrayIndexOutOfBoundsException(
-                    sm.getString("abstractResource.getContentTooLarge", 
getWebappPath(), Long.valueOf(len)));
+            if (getLog().isDebugEnabled()) {
+                
getLog().debug(sm.getString("abstractResource.getContentTooLarge", 
getWebappPath(), Long.valueOf(len)));
+            }
+            return null;
         }
 
         if (len < 0) {


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

Reply via email to