From 1ad96242f5342ffeb9321818f298e20d3ad9b88c Mon Sep 17 00:00:00 2001 From: "pixeebot[bot]" <104101892+pixeebot[bot]@users.noreply.github.com> Date: Tue, 22 Jul 2025 10:12:16 +0100 Subject: [PATCH] Hardening suggestions for Stirling-PDF / codex/investigate-cpu-usage-spikes-from-temp-file-manager (#4000) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I've reviewed the recently opened PR ([3992 - Improve temp cleanup performance](https://github.com/Stirling-Tools/Stirling-PDF/pull/3992)) and have identified some area(s) that could benefit from additional hardening measures. These changes should help prevent potential security vulnerabilities and improve overall code quality. Thank you for your consideration! 🧚🤖 Powered by Pixeebot [Feedback](https://ask.pixee.ai/feedback) | [Community](https://pixee-community.slack.com/signup#/domain-signup) | [Docs](https://docs.pixee.ai/) ![](https://d1zaessa2hpsmj.cloudfront.net/pixel/v1/track?writeKey=2PI43jNm7atYvAuK7rJUz3Kcd6A&event=PR_HARDENING%7CStirling-Tools%2FStirling-PDF%7C73a340cbe2a46f976c4fd53dd9e54564d8d4de92) Co-authored-by: pixeebot[bot] <104101892+pixeebot[bot]@users.noreply.github.com> --- .../software/common/service/TempFileCleanupServiceTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/common/src/test/java/stirling/software/common/service/TempFileCleanupServiceTest.java b/app/common/src/test/java/stirling/software/common/service/TempFileCleanupServiceTest.java index 31db069b9..a63513cbb 100644 --- a/app/common/src/test/java/stirling/software/common/service/TempFileCleanupServiceTest.java +++ b/app/common/src/test/java/stirling/software/common/service/TempFileCleanupServiceTest.java @@ -182,7 +182,7 @@ public class TempFileCleanupServiceTest { return FileTime.fromMillis(System.currentTimeMillis() - 5000000); } // For empty.tmp file, return a timestamp older than 5 minutes (for empty file test) - else if (fileName.equals("empty.tmp")) { + else if ("empty.tmp".equals(fileName)) { return FileTime.fromMillis(System.currentTimeMillis() - 6 * 60 * 1000); } // For all other files, return a recent timestamp @@ -198,7 +198,7 @@ public class TempFileCleanupServiceTest { String fileName = path.getFileName().toString(); // Return 0 bytes for the empty file - if (fileName.equals("empty.tmp")) { + if ("empty.tmp".equals(fileName)) { return 0L; } // Return normal size for all other files @@ -327,7 +327,7 @@ public class TempFileCleanupServiceTest { Path path = invocation.getArgument(0); String fileName = path.getFileName().toString(); - if (fileName.equals("empty.tmp")) { + if ("empty.tmp".equals(fileName)) { // More than 5 minutes old return FileTime.fromMillis(System.currentTimeMillis() - 6 * 60 * 1000); } else {