mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Valery Kharseko
9 hours ago bd8b80653a50e445f59cac7c1e80309dba23712e
Fix CodeQL note-severity alerts: dead parameters of private methods (#834)
16 files modified
159 ■■■■■ changed files
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaBuilder.java 9 ●●●●● patch | view | raw | blame | history
opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Rest2LdapJsonConfigurator.java 6 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/BrowserController.java 15 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/DeleteIndexTask.java 5 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromConnection.java 4 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/quicksetup/util/ZipExtractor.java 5 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/EnumAuthMethod.java 16 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/EnumEvalReason.java 19 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/EnumEvalResult.java 16 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/EnumUserDNType.java 21 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/loggers/CommonAudit.java 7 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/ConfigureDS.java 4 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/LDAPAuthenticationHandler.java 10 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/StopDS.java 7 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeCli.java 6 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/util/cli/LDAPConnectionConsoleInteraction.java 9 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaBuilder.java
@@ -14,6 +14,7 @@
 * Copyright 2009-2010 Sun Microsystems, Inc.
 * Portions Copyright 2014 Manuel Gaupp
 * Portions Copyright 2011-2016 ForgeRock AS.
 * Portions Copyright 2026 3A Systems, LLC.
 */
package org.forgerock.opendj.ldap.schema;
@@ -2116,7 +2117,7 @@
        final Syntax element = numericOID2Syntaxes.get(numericOID);
        if (element != null) {
            removeSyntax(element, null);
            removeSyntax(element);
            return true;
        }
        return false;
@@ -2490,7 +2491,7 @@
                        syntax, syntax.getOID(), conflictingSyntax.getOID());
                throw new ConflictingSchemaElementException(message);
            }
            removeSyntax(conflictingSyntax, null);
            removeSyntax(conflictingSyntax);
        }
        numericOID2Syntaxes.put(syntax.getOID(), syntax);
@@ -2688,7 +2689,7 @@
        }
    }
    private void removeSyntax(final Syntax syntax, NamesMapping names) {
    private void removeSyntax(final Syntax syntax) {
        for (Map.Entry<String, List<String>> property : syntax.getExtraProperties().entrySet()) {
            if ("x-enum".equalsIgnoreCase(property.getKey())) {
                removeMatchingRule(OMR_OID_GENERIC_ENUM + "." + syntax.getOID());
@@ -2705,7 +2706,7 @@
            try {
                syntax.validate(schema, warnings);
            } catch (final SchemaException e) {
                removeSyntax(syntax, names);
                removeSyntax(syntax);
                warnings.add(ERR_SYNTAX_VALIDATION_FAIL.get(syntax, e.getMessageObject()));
            }
        }
opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Rest2LdapJsonConfigurator.java
@@ -318,8 +318,7 @@
            return configureCollectionSubResource(
                config, resourceId, urlTemplate, dnTemplate, isReadOnly);
        } else {
            return configureSingletonSubResource(
                config, resourceId, urlTemplate, dnTemplate, isReadOnly);
            return configureSingletonSubResource(resourceId, urlTemplate, dnTemplate, isReadOnly);
        }
    }
@@ -372,8 +371,7 @@
        }
    }
    private static SubResource configureSingletonSubResource(final JsonValue config,
                                                             final String resourceId,
    private static SubResource configureSingletonSubResource(final String resourceId,
                                                             final String urlTemplate,
                                                             final String dnTemplate,
                                                             final Boolean isReadOnly) {
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/BrowserController.java
@@ -576,22 +576,11 @@
  /** Notify this controller that authentication data have changed in the connection pool. */
  @Override
  public void notifyAuthDataChanged() {
    notifyAuthDataChanged(null);
  }
  /**
   * Notify this controller that authentication data have changed in the
   * connection pool for the specified url.
   * The controller starts refreshing the node which represent entries from the
   * url.
   * @param url the URL of the connection that changed.
   */
  private void notifyAuthDataChanged(LDAPURL url) {
    // TODO: temporary implementation
    //    we should refresh only nodes :
    //    - whose URL matches 'url'
    //    - whose URL matches the URL of the connection that changed
    //    - whose errorType == ERROR_SOLVING_REFERRAL and
    //      errorArg == url
    //      errorArg == that URL
    startRefreshReferralNodes(rootNode);
  }
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/DeleteIndexTask.java
@@ -13,6 +13,7 @@
 *
 * Copyright 2008-2009 Sun Microsystems, Inc.
 * Portions Copyright 2014-2016 ForgeRock AS.
 * Portions Copyright 2026 3A Systems, LLC.
 */
package org.opends.guitools.controlpanel.task;
@@ -158,7 +159,7 @@
            {
              final List<String> args = getObfuscatedCommandLineArguments(getDSConfigCommandLineArguments(index));
              args.removeAll(getConfigCommandLineArguments());
              printEquivalentCommandLine(getConfigCommandLineName(index), args,
              printEquivalentCommandLine(getConfigCommandLineName(), args,
                  INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_DELETE_INDEX.get());
            }
          });
@@ -307,7 +308,7 @@
   * @return the path of the command line to be used to delete the specified
   *         index.
   */
  private String getConfigCommandLineName(AbstractIndexDescriptor index)
  private String getConfigCommandLineName()
  {
    if (isServerRunning())
    {
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromConnection.java
@@ -273,7 +273,7 @@
    hmConnectionHandlersMonitor.clear();
    readSchemaIfNeeded(connWrapper, errors);
    readSchemaIfNeeded(connWrapper);
    try
    {
@@ -324,7 +324,7 @@
    exceptions = Collections.unmodifiableList(errors);
  }
  private void readSchemaIfNeeded(final ConnectionWrapper connWrapper, final List<Exception> errors)
  private void readSchemaIfNeeded(final ConnectionWrapper connWrapper)
  {
    if (mustReadSchema())
    {
opendj-server-legacy/src/main/java/org/opends/quicksetup/util/ZipExtractor.java
@@ -291,7 +291,7 @@
    if (entry.isDirectory())
    {
      String perm = getDirectoryFileSystemPermissions(destination);
      String perm = getDirectoryFileSystemPermissions();
      addPermission(destination, permissions, perm);
      if (!Utils.createDirectory(destination))
      {
@@ -331,10 +331,9 @@
  /**
   * Returns the file system permissions for a directory.
   * @param path the directory for which we want the file permissions.
   * @return the file system permissions for the directory.
   */
  private String getDirectoryFileSystemPermissions(File path)
  private String getDirectoryFileSystemPermissions()
  {
    // TODO We should get this dynamically during build?
    return "755";
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/EnumAuthMethod.java
@@ -13,24 +13,18 @@
 *
 * Copyright 2008 Sun Microsystems, Inc.
 * Portions Copyright 2015-2016 ForgeRock AS.
 * Portions Copyright 2026 3A Systems, LLC.
 */
package org.opends.server.authorization.dseecompat;
/** This class provides an enumeration of the allowed authmethod types. */
enum EnumAuthMethod {
    /** The enumeration type when the bind rule has specified authentication of none. */
    AUTHMETHOD_NONE          ("none"),
    AUTHMETHOD_NONE,
    /** The enumeration type when the bind rule has specified authentication of simple. */
    AUTHMETHOD_SIMPLE        ("simple"),
    AUTHMETHOD_SIMPLE,
    /** The enumeration type when the bind rule has specified authentication of ssl client auth. */
    AUTHMETHOD_SSL           ("ssl"),
    AUTHMETHOD_SSL,
    /** The enumeration type when the bind rule has specified authentication of a sasl mechanism. */
    AUTHMETHOD_SASL          ("sasl");
    /**
     * Creates a new enumeration type for this authmethod.
     * @param authmethod The authemethod name.
     */
    EnumAuthMethod (String authmethod){
    }
    AUTHMETHOD_SASL;
}
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/EnumEvalReason.java
@@ -12,6 +12,7 @@
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Copyright 2008 Sun Microsystems, Inc.
 * Portions Copyright 2026 3A Systems, LLC.
 */
package org.opends.server.authorization.dseecompat;
@@ -28,36 +29,30 @@
  /**
   * There are aren't any allow ACIs.
   */
  NO_ALLOW_ACIS(0),
  NO_ALLOW_ACIS,
  /**
   * An deny ACI either evaluated to FAIL or to TRUE.
   */
  EVALUATED_DENY_ACI(1),
  EVALUATED_DENY_ACI,
  /**
   * An allow  evaluated to true.
   */
  EVALUATED_ALLOW_ACI(2),
  EVALUATED_ALLOW_ACI,
  /**
   * None of the allow and deny ACIs evaluated to true.
   */
  NO_MATCHED_ALLOWS_ACIS(3),
  NO_MATCHED_ALLOWS_ACIS,
  /**
   * No specific reason could be determined.
   */
  NO_REASON(4),
  NO_REASON,
  /**
   * The authorization DN has bypass-acl privileges.
   */
  SKIP_ACI(5);
  /**
   * Create a new enumeration type for the specified result value.
   * @param v The value of the result.
   */
  EnumEvalReason(int v) {}
  SKIP_ACI;
}
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/EnumEvalResult.java
@@ -26,30 +26,22 @@
    /**
     * This enumeration is returned when the result of the evaluation is TRUE.
     */
    TRUE(0),
    TRUE,
    /**
     * This enumeration is returned when the result of the evaluation is FALSE.
     */
    FALSE(1),
    FALSE,
    /**
     * This enumeration is returned when the result of the evaluation is FAIL.
     * This should only be returned when a system failure occurred.
     */
    FAIL(2),
    FAIL,
    /**
     * This is an internal enumeration used during evaluation of bind rule when
     * internal processing of the evaluation is undefined. It is never returned
     * back as a result of the evaluation.
     */
    ERR(3);
    /**
     * Create a new enumeration type for the specified result value.
     * @param v The value of the result.
     */
    EnumEvalResult(int v) {
    }
    ERR;
    /**
     * The method tries to determine if the result was undefined, and if so
     * it returns an FAIL enumeration. If the result was not undefined (the
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/EnumUserDNType.java
@@ -13,6 +13,7 @@
 *
 * Copyright 2008 Sun Microsystems, Inc.
 * Portions Copyright 2016 ForgeRock AS.
 * Portions Copyright 2026 3A Systems, LLC.
 */
package org.opends.server.authorization.dseecompat;
@@ -33,26 +34,20 @@
         * The enumeration type when the "userdn" URL contains only a DN (no
         * filter or scope) and that DN has no pattern.
         */
        DN(0),
        DN,
        /**
         * The enumeration type when the "userdn" URL contains only a DN (no
         * filter or scope) and that DN has a substring pattern.
         */
        DNPATTERN(1),
        DNPATTERN,
        /** The enumeration type when the "userdn" URL has the value of: "ldap:///all". */
        ALL(2),
        ALL,
        /** The enumeration type when the "userdn" URL has the value of: "ldap:///parent". */
        PARENT(3),
        PARENT,
        /** The enumeration type when the "userdn" URL has the value of: "ldap:///self". */
        SELF(4),
        SELF,
        /** The enumeration type when the "userdn" URL has the value of: "ldap:///anyone". */
        ANYONE(5),
        ANYONE,
        /** The enumeration type when the "userdn" URL is contains a DN (suffix), a scope and a filter. */
        URL(6);
        /**
         * Constructor taking an integer value.
         * @param v Integer value.
         */
        EnumUserDNType(int v) {}
        URL;
}
opendj-server-legacy/src/main/java/org/opends/server/loggers/CommonAudit.java
@@ -519,7 +519,6 @@
      jsonConfig.setLogDirectory(logDirectory.getAbsolutePath());
      jsonConfig.setName(publisher.getName());
      jsonConfig.setTopics(Collections.singleton(publisher.getCommonAuditTopic()));
      addJsonHandlerBufferingConfig(config, jsonConfig);
      addHandlerRetentionConfig(publisher, config, jsonConfig);
      addHandlerRotationConfig(publisher, config, jsonConfig);
@@ -531,12 +530,6 @@
    }
  }
  private void addJsonHandlerBufferingConfig(JsonConfigData config, JsonAuditEventHandlerConfiguration auditConfig)
  {
    JsonAuditEventHandlerConfiguration.EventBufferingConfiguration jsonBufferingConfig =
        new JsonAuditEventHandlerConfiguration.EventBufferingConfiguration();
  }
  private void addHandlerRotationConfig(PublisherConfig publisher, HandlerConfigData config,
      FileBasedEventHandlerConfiguration auditConfig) throws ConfigException
  {
opendj-server-legacy/src/main/java/org/opends/server/tools/ConfigureDS.java
@@ -1022,7 +1022,7 @@
    }
    if (StaticUtils.isFips()) {
        putAdminTrustManagerConfigAttribute(trustManagerProviderDN, DN_ADMIN_TRUST_MANAGER);
        putAdminTrustManagerConfigAttribute(DN_ADMIN_TRUST_MANAGER);
    }
  }
@@ -1045,7 +1045,7 @@
    }
  }
  private void putAdminTrustManagerConfigAttribute(final Argument trustManagerProviderDN, final String attributeDN)
  private void putAdminTrustManagerConfigAttribute(final String attributeDN)
      throws ConfigureDSException
  {
    if (keyManagerProviderDN.isPresent())
opendj-server-legacy/src/main/java/org/opends/server/tools/LDAPAuthenticationHandler.java
@@ -393,7 +393,7 @@
    case SASL_MECHANISM_EXTERNAL:
      return doSASLExternal(bindDN, saslProperties, requestControls, responseControls);
    case SASL_MECHANISM_GSSAPI:
      return doSASLGSSAPI(bindDN, bindPassword, saslProperties, requestControls, responseControls);
      return doSASLGSSAPI(bindDN, bindPassword, saslProperties);
    case SASL_MECHANISM_PLAIN:
      return doSASLPlain(bindDN, bindPassword, saslProperties, requestControls, responseControls);
    default:
@@ -1747,10 +1747,6 @@
   *                           to process the SASL bind.  SASL EXTERNAL does not
   *                           take any properties, so this should be empty or
   *                           <CODE>null</CODE>.
   * @param  requestControls   The set of controls to include the request to the
   *                           server.
   * @param  responseControls  A list to hold the set of controls included in
   *                           the response from the server.
   *
   * @return  A message providing additional information about the bind if
   *          appropriate, or <CODE>null</CODE> if there is no special
@@ -1764,9 +1760,7 @@
   */
  private String doSASLGSSAPI(ByteSequence bindDN,
                     ByteSequence bindPassword,
                     Map<String,List<String>> saslProperties,
                     List<Control> requestControls,
                     List<Control> responseControls)
                     Map<String,List<String>> saslProperties)
         throws ClientException, LDAPException
  {
    String kdc     = null;
opendj-server-legacy/src/main/java/org/opends/server/tools/StopDS.java
@@ -13,6 +13,7 @@
 *
 * Copyright 2006-2010 Sun Microsystems, Inc.
 * Portions Copyright 2011-2016 ForgeRock AS.
 * Portions Copyright 2026 3A Systems, LLC.
 */
package org.opends.server.tools;
@@ -371,7 +372,7 @@
    if (checkStoppability.isPresent())
    {
      System.exit(checkStoppability(argParser, out, err));
      System.exit(checkStoppability(argParser, out));
    }
    // If both a bind password and bind password file were provided, then return
@@ -640,12 +641,10 @@
   * on the different parameters passed.
   * @param argParser the ArgumentParser with the arguments already parsed.
   * @param out the print stream to use for standard output.
   * @param err the print stream to use for standard error.
   * @return the error code that we return when we are checking the stoppability
   * of the server.
   */
  private static int checkStoppability(ArgumentParser argParser,
                                       PrintStream out, PrintStream err)
  private static int checkStoppability(ArgumentParser argParser, PrintStream out)
  {
    int returnValue;
    boolean isServerRunning;
opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeCli.java
@@ -12,6 +12,7 @@
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Portions Copyright 2013-2016 ForgeRock AS.
 * Portions Copyright 2026 3A Systems, LLC.
 */
package org.opends.server.tools.upgrade;
@@ -24,7 +25,6 @@
import static org.opends.server.tools.upgrade.Upgrade.*;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.ArrayList;
@@ -79,7 +79,7 @@
  /** Flag indicating whether the global arguments have already been initialized. */
  private boolean globalArgumentsInitialized;
  private UpgradeCli(InputStream in, OutputStream out, OutputStream err)
  private UpgradeCli(OutputStream out, OutputStream err)
  {
    super(new PrintStream(out), new PrintStream(err));
    this.parser =
@@ -124,7 +124,7 @@
  public static int main(String[] args, boolean initializeServer,
      OutputStream outStream, OutputStream errStream)
  {
    final UpgradeCli app = new UpgradeCli(System.in, outStream, errStream);
    final UpgradeCli app = new UpgradeCli(outStream, errStream);
    // Run the application.
    return app.run(args, initializeServer);
opendj-server-legacy/src/main/java/org/opends/server/util/cli/LDAPConnectionConsoleInteraction.java
@@ -1112,7 +1112,14 @@
    {
      arg.clearValues();
      arg.addValue(value);
      commandBuilder.addArgument(arg);
      if (obfuscated)
      {
        commandBuilder.addObfuscatedArgument(arg);
      }
      else
      {
        commandBuilder.addArgument(arg);
      }
    }
  }