This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new 9ef6a6de3b Avoid unchecked exception for very large files
9ef6a6de3b is described below
commit 9ef6a6de3bdd63f2cd3459aadd6fddadfbb5800d
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]