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

Valery Kharseko
24.28.2024 8006c79df79e157656f50b5537c58077186bfc61
[#401] Change "Object class violation (65)" -> "Naming violation (64)" LDAP result code for DIT Structure Rule violation (#410)

Co-authored-by: Maxim Thomas <maxim.thomas@gmail.com>
4 files modified
21 ■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java 12 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendModifyDNOperation.java 5 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendModifyOperation.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java
@@ -1507,7 +1507,15 @@
  }
  private ResultCode typeConformsToSchemaError = null;
   /**
   * Returns a error when entry type does not conform to a schema
   * requirements.  Otherwise returns {@code null}
   **/
  public ResultCode getTypeConformsToSchemaError() {
    return typeConformsToSchemaError;
  }
  /**
   * Indicates whether this entry conforms to the server's schema
   * requirements.  The checks performed by this method include:
@@ -1564,6 +1572,7 @@
                                  boolean validateStructureRules,
                                  LocalizableMessageBuilder invalidReason)
  {
    typeConformsToSchemaError = OBJECTCLASS_VIOLATION;
    // Get the structural objectclass for the entry.  If there isn't
    // one, or if there's more than one, then see if that's OK.
    AcceptRejectWarn structuralPolicy =
@@ -1640,6 +1649,7 @@
      if (validateNameForms)
      {
        typeConformsToSchemaError = NAMING_VIOLATION;
        /**
         * There may be multiple nameforms registered with this
         * structural objectclass.However, we need to select only one
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java
@@ -803,7 +803,7 @@
    LocalizableMessageBuilder invalidReason = new LocalizableMessageBuilder();
    if (! entry.conformsToSchema(parentEntry, true, true, true, invalidReason))
    {
      throw new DirectoryException(ResultCode.OBJECTCLASS_VIOLATION,
      throw new DirectoryException(entry.getTypeConformsToSchemaError(),
                                   invalidReason.toMessage());
    }
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendModifyDNOperation.java
@@ -13,6 +13,7 @@
 *
 * Copyright 2008-2010 Sun Microsystems, Inc.
 * Portions Copyright 2011-2016 ForgeRock AS.
 * Portions copyright 2024 3A Systems,LLC.
 */
package org.opends.server.workflowelement.localbackend;
@@ -670,7 +671,7 @@
      if (! newEntry.conformsToSchema(null, false, true, true,
                                      invalidReason))
      {
        throw new DirectoryException(ResultCode.OBJECTCLASS_VIOLATION,
        throw new DirectoryException(newEntry.getTypeConformsToSchemaError(),
            ERR_MODDN_VIOLATES_SCHEMA.get(entryDN, invalidReason));
      }
@@ -742,7 +743,7 @@
      if (! newEntry.conformsToSchema(null, false, true, true,
                                      invalidReason))
      {
        throw new DirectoryException(ResultCode.OBJECTCLASS_VIOLATION,
        throw new DirectoryException(newEntry.getTypeConformsToSchemaError(),
            ERR_MODDN_PREOP_VIOLATES_SCHEMA.get(entryDN, invalidReason));
      }
    }
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendModifyOperation.java
@@ -469,7 +469,7 @@
        LocalizableMessageBuilder invalidReason = new LocalizableMessageBuilder();
        if (!modifiedEntry.conformsToSchema(null, false, false, false, invalidReason))
        {
          setResultCode(ResultCode.OBJECTCLASS_VIOLATION);
          setResultCode(modifiedEntry.getTypeConformsToSchemaError());
          appendErrorMessage(ERR_MODIFY_VIOLATES_SCHEMA.get(entryDN, invalidReason));
          return;
        }