From 069a1256c6ebdc1142e525a44733bc32fd834061 Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Tue, 04 Aug 2026 11:37:29 +0000
Subject: [PATCH] Fix CodeQL note-severity alerts: ignored error status of file and stream calls (#814)
---
opendj-server-legacy/src/main/java/org/opends/server/backends/LDIFBackend.java | 20 ++++----------------
1 files changed, 4 insertions(+), 16 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/LDIFBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/LDIFBackend.java
index bbcded9..0249d60 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/LDIFBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/LDIFBackend.java
@@ -280,25 +280,13 @@
throw new DirectoryException(DirectoryServer.getCoreConfigManager().getServerErrorResultCode(), m);
}
- if (tempFile.exists())
- {
- // Rename the existing "live" file out of the way and move the new file
- // into place.
- try
- {
- oldFile.delete();
- }
- catch (Exception e)
- {
- logger.traceException(e);
- }
- }
-
+ // Rename the existing "live" file out of the way and move the new file into place.
+ // renameFile() deletes an existing ".old" file and reports a failure to do so.
try
{
if (ldifFile.exists())
{
- ldifFile.renameTo(oldFile);
+ renameFile(ldifFile, oldFile);
}
}
catch (Exception e)
@@ -308,7 +296,7 @@
try
{
- tempFile.renameTo(ldifFile);
+ renameFile(tempFile, ldifFile);
}
catch (Exception e)
{
--
Gitblit v1.10.0