This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push:
new 4553b44cb4 Avoid unchecked exception for very large files
4553b44cb4 is described below
commit 4553b44cb4cfc5e8b4ecd19fd752e5470396d050
Author: remm <[email protected]>
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: [email protected]
For additional commands, e-mail: [email protected]