Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses TIKA-4704 by ensuring the temporary bootstrap JAR created for forked parsing is scheduled for deletion at JVM shutdown if it can’t be deleted during ForkClient.close().
Changes:
- Register the fork bootstrap JAR for
deleteOnExit()duringForkClient.close().
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| if (jar != null) { | ||
| jar.delete(); | ||
| jar.deleteOnExit(); |
There was a problem hiding this comment.
File#deleteOnExit() can throw SecurityException. Since close() currently doesn’t declare/expect to throw and is used in failure-cleanup paths, this new call can cause unexpected runtime failure during cleanup. Please guard the deleteOnExit() call (and any conditional logic around it) to keep close() best-effort.
| jar.deleteOnExit(); | |
| try { | |
| jar.deleteOnExit(); | |
| } catch (SecurityException ignore) { | |
| // best-effort cleanup; ignore inability to register deleteOnExit | |
| } |
There was a problem hiding this comment.
There shouldn't be a SecurityException because it's our own file.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Thanks for your contribution to Apache Tika! Your help is appreciated!
Before opening the pull request, please verify that
TIKA-XXXX)[TIKA-XXXX] Issue or pull request title)./mvnw clean testmainbranch. If there are conflicts, please try to rebase the pull request branch on top of a freshly pulledmainbranchtika-bom/pom.xml.We will be able to faster integrate your pull request if these conditions are met. If you have any questions how to fix your problem or about using Tika in general, please sign up for the Tika mailing list. Thanks!