This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch 1.x in repository https://gitbox.apache.org/repos/asf/commons-fileupload.git
commit c79304fad827b0ac09d60c6f90f171440e3d25c2 Author: Gary D. Gregory <garydgreg...@gmail.com> AuthorDate: Sat May 3 16:19:58 2025 -0400 ast statement in DiskFileItem.finalize() method should be a call to super.finalize() --- src/changes/changes.xml | 1 + src/main/java/org/apache/commons/fileupload/disk/DiskFileItem.java | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index f29404e1..d9326915 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -53,6 +53,7 @@ The <action> type attribute can be add,update,fix,remove. <action type="fix" dev="ggregory" due-to="Gary Gregory">Port to Java 1.4 Throwable APIs (!).</action> <action type="fix" dev="ggregory" due-to="Gary Gregory">Remove -nouses directive from maven-bundle-plugin. OSGi package imports now state 'uses' definitions for package imports, this doesn't affect JPMS (from org.apache.commons:commons-parent:80).</action> <action type="fix" dev="ggregory" due-to="Gary Gregory">DiskFileItem.getInputStream() now uses NIO.</action> + <action type="fix" dev="ggregory" due-to="Gary Gregory">Last statement in DiskFileItem.finalize() method should be a call to super.finalize().</action> <!-- UPDATE --> <action type="update" dev="ggregory" due-to="Gary Gregory">Bump Java from 6 to 8.</action> <action type="update" dev="ggregory" due-to="Gary Gregory">Bump org.apache.commons:commons-parent from 62 to 83, upgrades Doxia from 1 to 2.</action> diff --git a/src/main/java/org/apache/commons/fileupload/disk/DiskFileItem.java b/src/main/java/org/apache/commons/fileupload/disk/DiskFileItem.java index 31cf3ac7..c9873fea 100644 --- a/src/main/java/org/apache/commons/fileupload/disk/DiskFileItem.java +++ b/src/main/java/org/apache/commons/fileupload/disk/DiskFileItem.java @@ -218,17 +218,19 @@ public class DiskFileItem /** * Removes the file contents from the temporary storage. + * + * @throws Throwable Thrown by {@link Object#finalize()}. */ @Override - protected void finalize() { + protected void finalize() throws Throwable { if (dfos == null || dfos.isInMemory()) { return; } final File outputFile = dfos.getFile(); - if (outputFile != null && outputFile.exists()) { outputFile.delete(); } + super.finalize(); } /**