This is an automated email from the ASF dual-hosted git repository.
fanningpj pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/poi.git
The following commit(s) were added to refs/heads/trunk by this push:
new 03fc1ddea1 [github-911] close DataSource before deleting temp file
03fc1ddea1 is described below
commit 03fc1ddea1be6defeca7de71705def32a5ea740b
Author: PJ Fanning <[email protected]>
AuthorDate: Fri Sep 26 19:22:32 2025 +0100
[github-911] close DataSource before deleting temp file
---
.../apache/poi/poifs/filesystem/TempFilePOIFSFileSystem.java | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git
a/poi/src/main/java/org/apache/poi/poifs/filesystem/TempFilePOIFSFileSystem.java
b/poi/src/main/java/org/apache/poi/poifs/filesystem/TempFilePOIFSFileSystem.java
index 5cb52b07ba..28f5f9d299 100644
---
a/poi/src/main/java/org/apache/poi/poifs/filesystem/TempFilePOIFSFileSystem.java
+++
b/poi/src/main/java/org/apache/poi/poifs/filesystem/TempFilePOIFSFileSystem.java
@@ -47,12 +47,15 @@ public class TempFilePOIFSFileSystem extends
POIFSFileSystem {
@Override
public void close() throws IOException {
- if (tempFile != null && tempFile.exists()) {
- if (!tempFile.delete()) {
- LOG.atDebug().log("temp file was already deleted (probably due
to previous call to close this resource)");
+ try {
+ super.close();
+ } finally {
+ if (tempFile != null && tempFile.exists()) {
+ if (!tempFile.delete()) {
+ LOG.atDebug().log("temp file was already deleted (probably
due to previous call to close this resource)");
+ }
}
}
- super.close();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]