From a0a2b0b1c7f49c5dd5a6f28f8b82ed425b4af2d4 Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Tue, 04 Aug 2026 08:34:17 +0000
Subject: [PATCH] Fix CodeQL note-severity alerts: confusing overloads with subtype parameters (#840)
---
opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliMain.java | 24 ++++++++++++++----------
opendj-server-legacy/src/main/java/org/opends/server/extensions/AbstractPBKDF2PasswordStorageScheme.java | 22 +++++++++++++++-------
2 files changed, 29 insertions(+), 17 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/AbstractPBKDF2PasswordStorageScheme.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/AbstractPBKDF2PasswordStorageScheme.java
index c8d770c..c92c267 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/AbstractPBKDF2PasswordStorageScheme.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/AbstractPBKDF2PasswordStorageScheme.java
@@ -1,3 +1,18 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
+ *
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
+ *
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
+ *
+ * Portions Copyright 2026 3A Systems, LLC.
+ */
package org.opends.server.extensions;
import org.forgerock.i18n.LocalizableMessage;
@@ -270,13 +285,6 @@
}
}
- private SecretKey encodeWithRandomSalt(ByteString plaintext, byte[] saltBytes, int iterations)
- throws DirectoryException
- {
- random.nextBytes(saltBytes);
- return encodeWithRandomSalt(plaintext, saltBytes, iterations);
- }
-
private SecretKey encodeWithSalt(ByteSequence plaintext, byte[] saltBytes, int iterations)
throws DirectoryException
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliMain.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliMain.java
index 3f53490..bfed2aa 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliMain.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliMain.java
@@ -806,7 +806,7 @@
}
else
{
- initializeWithArgParser(uData);
+ initializeWithArgParserForSourceServer(uData);
return initializeAllReplication(uData);
}
}
@@ -834,7 +834,7 @@
}
else
{
- initializeWithArgParser(uData);
+ initializeWithArgParserForSourceServer(uData);
return preExternalInitialization(uData);
}
}
@@ -862,7 +862,7 @@
}
else
{
- initializeWithArgParser(uData);
+ initializeWithArgParserForSourceServer(uData);
return postExternalInitialization(uData);
}
}
@@ -2674,7 +2674,7 @@
*/
private boolean promptIfRequired(InitializeAllReplicationUserData uData)
{
- ConnectionWrapper conn = getConnection(uData);
+ ConnectionWrapper conn = getConnectionToSourceServer(uData);
if (conn == null)
{
return false;
@@ -2736,7 +2736,7 @@
*/
private boolean promptIfRequiredForPreOrPost(MonoServerReplicationUserData uData)
{
- ConnectionWrapper conn = getConnection(uData);
+ ConnectionWrapper conn = getConnectionToSourceServer(uData);
if (conn == null)
{
return false;
@@ -2754,7 +2754,7 @@
}
}
- private ConnectionWrapper getConnection(MonoServerReplicationUserData uData)
+ private ConnectionWrapper getConnectionToSourceServer(MonoServerReplicationUserData uData)
{
// Try to connect to the server.
while (true)
@@ -2809,7 +2809,7 @@
*/
private boolean promptIfRequired(StatusReplicationUserData uData) throws ReplicationCliException
{
- ConnectionWrapper conn = getConnection(uData);
+ ConnectionWrapper conn = getConnectionToSourceServer(uData);
if (conn == null)
{
return false;
@@ -3105,11 +3105,15 @@
}
/**
- * Initializes the contents of the provided user data object with what was
- * provided in the command-line without prompting to the user.
+ * Initializes the contents of the provided user data object of a subcommand which operates on a
+ * single server with what was provided in the command-line without prompting to the user.
+ * <p>
+ * The subcommands which need more than the source server, or other arguments, have their own
+ * overload taking their own user data type.
+ *
* @param uData the user data object to be initialized.
*/
- private void initializeWithArgParser(MonoServerReplicationUserData uData)
+ private void initializeWithArgParserForSourceServer(MonoServerReplicationUserData uData)
{
initialize(uData);
--
Gitblit v1.10.0