You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2024/11/20 11:22:34 UTC
(tomcat) branch 9.0.x updated: Avoid unchecked exception for very large files
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 09753487d4 Avoid unchecked exception for very large files
09753487d4 is described below
commit 09753487d4e9f76b9830fa90a1ad3bbc2775ff6a
Author: remm <re...@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org