Stirling-PDF
Stirling-PDF copied to clipboard
Fix/full invert crash 2942
Description of Changes
Please provide a summary of the changes, including:
-
What was changed
- Modified the
convertToBufferedImageTpFileto useFile.createTempFile()instead of writing to"image.png"in the current directory. - This change ensures the file is saved in the default temporary directory, preventing permission issues.
- Modified the
-
Why the change was made
- Previously, the method attempted to save the file in the current working directory, which caused permission errors (
java.io.FileNotFoundException: image.png (Permission denied)).
- Previously, the method attempted to save the file in the current working directory, which caused permission errors (
-
Any challenges encountered
Closes #2942
Checklist
General
- [x] I have read the Contribution Guidelines
- [x] I have read the Stirling-PDF Developer Guide (if applicable)
- [ ] I have read the How to add new languages to Stirling-PDF (if applicable)
- [x] I have performed a self-review of my own code
- [x] My changes generate no new warnings
Documentation
- [ ] I have updated relevant docs on Stirling-PDF's doc repo (if functionality has heavily changed)
- [ ] I have read the section Add New Translation Tags (for new translation tags only)
UI Changes (if applicable)
- [ ] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR)
Testing (if applicable)
- [x] I have tested my changes locally. Refer to the Testing Guide for more details.
@Frooodle I’ve updated the code to address your feedback. Temporary files are now cleaned up immediately using try-finally blocks. Could you please review the changes?