From 90cce51e418e7fa8636033a4d6b96cc3bb49641b Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Thu, 30 Jul 2026 13:48:20 +0000
Subject: [PATCH] Fix CodeQL warning-severity alerts: weak salt PRNG, unsafe DCL, thread-unsafe date formats (#789)
---
opendj-server-legacy/src/main/java/org/opends/server/loggers/AsynchronousTextWriter.java | 31 +++++++++++++++----------------
1 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/loggers/AsynchronousTextWriter.java b/opendj-server-legacy/src/main/java/org/opends/server/loggers/AsynchronousTextWriter.java
index cb97035..fe62576 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/loggers/AsynchronousTextWriter.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/loggers/AsynchronousTextWriter.java
@@ -13,6 +13,7 @@
*
* Copyright 2006-2008 Sun Microsystems, Inc.
* Portions Copyright 2013-2016 ForgeRock AS.
+ * Portions Copyright 2026 3A Systems, LLC.
*/
package org.opends.server.loggers;
@@ -22,6 +23,7 @@
import java.util.concurrent.atomic.AtomicBoolean;
import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.util.Reject;
import org.opends.server.api.DirectoryThread;
import org.opends.server.api.ServerShutdownListener;
import org.opends.server.core.DirectoryServer;
@@ -59,7 +61,7 @@
{
this.name = name;
this.autoFlush = autoFlush;
- this.writer = writer;
+ this.writer = Reject.checkNotNull(writer);
this.queue = new LinkedBlockingQueue<>(capacity);
this.capacity = capacity;
@@ -145,21 +147,18 @@
@Override
public void writeRecord(String record)
{
- // No writer? Off to the bit bucket.
- if (writer != null) {
- while (!stopRequested.get())
+ while (!stopRequested.get())
+ {
+ // Put request on queue for writer
+ try
{
- // Put request on queue for writer
- try
- {
- queue.put(record);
- break;
- }
- catch(InterruptedException e)
- {
- // We expect this to happen. Just ignore it and hopefully
- // drop out in the next try.
- }
+ queue.put(record);
+ break;
+ }
+ catch(InterruptedException e)
+ {
+ // We expect this to happen. Just ignore it and hopefully
+ // drop out in the next try.
}
}
}
@@ -237,7 +236,7 @@
}
// Shutdown the wrapped writer.
- if (shutdownWrapped && writer != null)
+ if (shutdownWrapped)
{
writer.shutdown();
}
--
Gitblit v1.10.0