Skip to content

Commit

Permalink
Restore the finalize() method
Browse files Browse the repository at this point in the history
  • Loading branch information
markt-asf committed Sep 16, 2023
1 parent e25c076 commit 43b882b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java
Expand Up @@ -531,6 +531,21 @@ public File getStoreLocation() {

// ------------------------------------------------------ Protected methods

/**
* Removes the file contents from the temporary storage.
*/
@Override
protected void finalize() {
if (dfos == null || dfos.isInMemory()) {
return;
}
final File outputFile = dfos.getFile();

if (outputFile != null && outputFile.exists()) {
outputFile.delete();
}
}

/**
* Creates and returns a {@link java.io.File File} representing a uniquely
* named temporary file in the configured repository path. The lifetime of
Expand Down

0 comments on commit 43b882b

Please sign in to comment.