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

Valery Kharseko
yesterday c34642325775e6b3054af2ca456bbfe5c3ff1b54
Fix CodeQL note-severity alerts: the leftovers of the already-fixed rules (#850)
11 files modified
67 ■■■■■ changed files
opendj-cli/src/main/java/com/forgerock/opendj/cli/ConsoleApplication.java 3 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/EndTransactionExtendedRequest.java 17 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldif/LDIFChangeRecordReader.java 3 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/DeleteIndexTask.java 2 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/NewSchemaElementsTask.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/quicksetup/TempLogFile.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/Installer.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/ui/RemoteReplicationPortsPanel.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/OnDiskMergeImporter.java 4 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/InstallDS.java 2 ●●● patch | view | raw | blame | history
opendj-server/src/main/java/org/forgerock/opendj/server/core/ProductInformation.java 28 ●●●● patch | view | raw | blame | history
opendj-cli/src/main/java/com/forgerock/opendj/cli/ConsoleApplication.java
@@ -14,6 +14,7 @@
 * Copyright 2008-2009 Sun Microsystems, Inc.
 * Portions copyright 2011-2016 ForgeRock AS.
 * Portions copyright 2011 Nemanja Lukić
 * Portions Copyright 2026 3A Systems, LLC.
 */
package com.forgerock.opendj.cli;
@@ -474,7 +475,7 @@
            println();
        }
        if ("".equals(response)) {
        if (response.isEmpty()) {
            if (defaultValue != null) {
                return defaultValue;
            }
opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/EndTransactionExtendedRequest.java
@@ -12,6 +12,7 @@
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Copyright 2025 3A Systems, LLC
 * Portions Copyright 2026 3A Systems, LLC.
 */
package com.forgerock.opendj.ldap.extensions;
@@ -28,8 +29,6 @@
import org.forgerock.util.Reject;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import static com.forgerock.opendj.ldap.CoreMessages.ERR_EXTOP_PASSMOD_CANNOT_DECODE_REQUEST;
import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage;
@@ -153,15 +152,19 @@
                            reader.readStartSequence();
                            while (reader.hasNextElement() && reader.peekType() == ASN1.UNIVERSAL_SEQUENCE_TYPE) {
                                reader.readStartSequence();
                                final long messageId = reader.readInteger();
                                final List<Control> controls = new ArrayList<>();
                                /*
                                 * TODO: report these updatesControls through
                                 * EndTransactionExtendedResult.success(messageID, responses). Rebuilding a Control
                                 * from the wire is not possible yet: getValue() writes each control as its value
                                 * alone, without its OID and criticality, so both sides have to be completed
                                 * together. Until then the entries are read to consume them and dropped.
                                 */
                                reader.readInteger();
                                reader.readStartSequence();
                                while (reader.hasNextElement() && reader.peekType() == ASN1.UNIVERSAL_OCTET_STRING_TYPE) {
                                    final ByteString controlEncoded = reader.readOctetString();
                                    //TODO decode Control
                                    reader.readOctetString();
                                }
                                reader.readEndSequence();
                                //newResult.success(messageId, controls.toArray(new Control[]{}));
                                reader.readEndSequence();
                            }
                            reader.readEndSequence();
opendj-core/src/main/java/org/forgerock/opendj/ldif/LDIFChangeRecordReader.java
@@ -15,6 +15,7 @@
 * Portions copyright 2011-2016 ForgeRock AS.
 * Portions copyright 2016 Matthew Stevenson
 * Portions Copyrighted 2026 3A Systems, LLC.
 * Portions Copyright 2026 3A Systems, LLC.
 */
package org.forgerock.opendj.ldif;
@@ -721,7 +722,7 @@
        // Parse the newsuperior if present.
        if (record.iterator.hasNext()) {
            ldifLine = readLDIFRecordKeyValuePair(record, pair, true);
            if (pair.key == null || !"newsuperior".equals(toLowerCase(pair.key)) || "".equals(pair.value)) {
            if (pair.key == null || !"newsuperior".equals(toLowerCase(pair.key)) || pair.value.isEmpty()) {
                throw DecodeException.error(
                        ERR_LDIF_MALFORMED_NEW_SUPERIOR.get(record.lineNumber, entryDN, ldifLine));
            }
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/DeleteIndexTask.java
@@ -303,8 +303,6 @@
   * Returns the path of the command line to be used to delete the specified
   * index.
   *
   * @param index
   *          the index to be deleted.
   * @return the path of the command line to be used to delete the specified
   *         index.
   */
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/NewSchemaElementsTask.java
@@ -255,7 +255,7 @@
      List<AttributeType> attrs = schemaElementsToAttributeTypes(get(mapAttrs, fileName));
      List<ObjectClass> ocs = schemaElementsToObjectClasses(get(mapClasses, fileName));
      if ("".equals(fileName))
      if (fileName.isEmpty())
      {
        fileName = null;
      }
opendj-server-legacy/src/main/java/org/opends/quicksetup/TempLogFile.java
@@ -85,7 +85,7 @@
    }
    ErrorLogPublisher startupErrorLogPublisher = TextErrorLogPublisher.getServerStartupTextErrorPublisher(writer);
    ErrorLogger.getInstance().addLogPublisher(startupErrorLogPublisher);
    DebugLogPublisher startupDebugLogPublisher = DebugLogger.getInstance().addPublisherIfRequired(writer);
    DebugLogger.getInstance().addPublisherIfRequired(writer);
    localizedLogger.info(LocalizableMessage.raw("QuickSetup application launched " + DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(new Date()), null));
  }
opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/Installer.java
@@ -3364,7 +3364,7 @@
    if (errorMsgs.isEmpty())
    {
      AuthenticationData auth = new AuthenticationData();
      auth.setHostPort(new HostPort("".equals(host) ? null : host, port != null ? port : 0));
      auth.setHostPort(new HostPort(host.isEmpty() ? null : host, port != null ? port : 0));
      auth.setDn(dn);
      auth.setPwd(pwd);
      auth.setUseSecureConnection(true);
opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/ui/RemoteReplicationPortsPanel.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.quicksetup.installer.ui;
@@ -111,7 +112,6 @@
    {
      for (Map.Entry<String, JLabel> entry : hmLabels.entrySet())
      {
        String id = entry.getKey();
        UIFactory.setTextStyle(entry.getValue(),
            UIFactory.TextStyle.SECONDARY_FIELD_VALID);
      }
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/OnDiskMergeImporter.java
@@ -14,6 +14,7 @@
 * Portions Copyright 2014 The Apache Software Foundation
 * Copyright 2015-2016 ForgeRock AS.
 * Portions Copyright 2023-2026 3A Systems, LLC
 * Portions Copyright 2026 3A Systems, LLC.
 */
package org.opends.server.backends.pluggable;
@@ -3123,7 +3124,8 @@
      {
        for (int i = 0; i < nbBuffer; i++)
        {
          pool.offer(new MemoryBuffer(allocateDirect
          // The queue is created with room for exactly nbBuffer elements, so add() cannot refuse.
          pool.add(new MemoryBuffer(allocateDirect
                          ? ByteBuffer.allocateDirect(bufferSize)
                          : ByteBuffer.allocate(bufferSize)));
        }
opendj-server-legacy/src/main/java/org/opends/server/tools/InstallDS.java
@@ -2278,7 +2278,7 @@
        s = "";
        logger.warn(LocalizableMessage.raw("Error reading input: "+ce, ce));
      }
      if ("".equals(s))
      if (s.isEmpty())
      {
        if (defaultValue == null)
        {
opendj-server/src/main/java/org/forgerock/opendj/server/core/ProductInformation.java
@@ -266,7 +266,7 @@
     * @return The build number for the Directory Server.
     */
    public int versionBuildNumber() {
        return Integer.valueOf(properties.getProperty("version.build"));
        return intProperty("version.build");
    }
    /**
@@ -295,7 +295,7 @@
     * @return The major version number for the Directory Server.
     */
    public int versionMajorNumber() {
        return Integer.valueOf(properties.getProperty("version.major"));
        return intProperty("version.major");
    }
    /**
@@ -304,7 +304,7 @@
     * @return The minor version number for the Directory Server.
     */
    public int versionMinorNumber() {
        return Integer.valueOf(properties.getProperty("version.minor"));
        return intProperty("version.minor");
    }
    /**
@@ -313,7 +313,7 @@
     * @return The point version number for the Directory Server.
     */
    public int versionPointNumber() {
        return Integer.valueOf(properties.getProperty("version.point"));
        return intProperty("version.point");
    }
    /**
@@ -344,4 +344,24 @@
    public String versionRevision() {
        return properties.getProperty("scm.revision");
    }
    /**
     * Returns the value of a numeric property of the product information.
     *
     * @param key
     *            The name of the property to read.
     * @return The value of the property.
     * @throws MissingResourceException
     *             If the property is absent or is not a number, which means the bundled product
     *             information is not the one this class was built against.
     */
    private int intProperty(final String key) {
        final String value = properties.getProperty(key);
        try {
            return Integer.parseInt(value);
        } catch (final NumberFormatException e) {
            throw new MissingResourceException("Product information holds '" + value + "' for " + key
                    + ", which is not a number", ProductInformation.class.getName(), key);
        }
    }
}