This is an automated email from the ASF dual-hosted git repository.
tilman pushed a commit to branch branch_3x
in repository https://gitbox.apache.org/repos/asf/tika.git
The following commit(s) were added to refs/heads/branch_3x by this push:
new d36787372f [TIKA-4704] add delete on exit in case delete fails (#2717)
d36787372f is described below
commit d36787372f61745ef9490688b5571dd995242484
Author: Tilman Hausherr <[email protected]>
AuthorDate: Sun Mar 29 15:32:23 2026 +0200
[TIKA-4704] add delete on exit in case delete fails (#2717)
* TIKA-4704: delete on exit in case delete fails
* delete on exit only if really needed
Co-authored-by: Copilot <[email protected]>
---------
Co-authored-by: Copilot <[email protected]>
---
tika-core/src/main/java/org/apache/tika/fork/ForkClient.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tika-core/src/main/java/org/apache/tika/fork/ForkClient.java
b/tika-core/src/main/java/org/apache/tika/fork/ForkClient.java
index f1a47206d9..8bacaf83f0 100644
--- a/tika-core/src/main/java/org/apache/tika/fork/ForkClient.java
+++ b/tika-core/src/main/java/org/apache/tika/fork/ForkClient.java
@@ -323,7 +323,9 @@ class ForkClient {
}
}
if (jar != null) {
- jar.delete();
+ if (!jar.delete()) {
+ jar.deleteOnExit();
+ }
}
}