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

Jean-Noel Rouvignac
10.16.2015 a632fbfad0ddbe8b343c6abe8e28dc41e3df9b7e
Code cleanup

DirectoryServer.java:
Added getAttributeType(String lowerName, String upperName).

*.java:
Used the newly added DirectoryServer.getAttributeType(String lowerName, String upperName).
Used more DirectoryServer.getAttributeType(String, boolean).
43 files modified
1249 ■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CustomSearchResult.java 7 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ManageTasksPanel.java 7 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/admin/AdministrationDataSync.java 171 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciEffectiveRights.java 20 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciHandler.java 7 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/ParentInheritance.java 8 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargAttrFilterList.java 5 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargetAttr.java 37 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/UserAttr.java 10 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/ChangelogBackend.java 12 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/RootDSEBackend.java 6 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/Importer.java 12 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/OnDiskMergeBufferImporter.java 11 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/task/RecurringTask.java 7 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/task/Task.java 7 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskScheduler.java 8 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/config/ConfigEntry.java 11 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java 17 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/controls/GetEffectiveRightsRequestControl.java 24 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/controls/MatchedValuesFilter.java 13 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java 25 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/PasswordPolicyState.java 90 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/monitors/ClientConnectionMonitorProvider.java 11 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPFilter.java 23 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/HistoricalAttributeValue.java 11 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java 10 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/schema/AttributeTypeSyntax.java 8 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/schema/DITContentRuleSyntax.java 158 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/schema/MatchingRuleUseSyntax.java 63 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/schema/NameFormSyntax.java 112 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/schema/ObjectClassSyntax.java 124 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tasks/ExportTask.java 12 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tasks/ImportTask.java 9 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/ExportLDIF.java 20 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/ImportLDIF.java 16 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java 8 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/Attributes.java 11 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/DN.java 59 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/SearchFilter.java 34 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java 8 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/TargetAttrTestCase.java 5 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/plugins/ReferentialIntegrityPluginTestCase.java 17 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/plugins/UniqueAttributePluginTestCase.java 15 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CustomSearchResult.java
@@ -320,12 +320,7 @@
      }
      else
      {
        AttributeType attrType = DirectoryServer.getAttributeType(lowerName);
        if (attrType == null)
        {
          attrType = DirectoryServer.getDefaultAttributeType(attrName);
        }
        AttributeType attrType = DirectoryServer.getAttributeType(lowerName, attrName);
        AttributeBuilder builder = new AttributeBuilder(attribute, true);
        for (Object value : getAttributeValues(attrName))
        {
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ManageTasksPanel.java
@@ -695,12 +695,7 @@
      }
      else
      {
        AttributeType attrType = DirectoryServer.getAttributeType(lowerName);
        if (attrType == null)
        {
          attrType = DirectoryServer.getDefaultAttributeType(attrName);
        }
        AttributeType attrType = DirectoryServer.getAttributeType(lowerName, attrName);
        AttributeBuilder builder = new AttributeBuilder(attribute, true);
        for (Object value : csr.getAttributeValues(attrName))
        {
opendj-server-legacy/src/main/java/org/opends/server/admin/AdministrationDataSync.java
@@ -26,9 +26,11 @@
 */
package org.opends.server.admin;
import java.net.InetAddress;
import java.util.LinkedList;
import java.util.List;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.ModificationType;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
@@ -55,23 +57,16 @@
 */
public final class AdministrationDataSync
{
  private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
  /**
   * The root connection.
   */
  /** The root connection. */
  private InternalClientConnection internalConnection;
  /**
   * The attribute name used to store the port. TODO Use the default
   * one.
   */
  /** The attribute name used to store the port. TODO Use the default one. */
  private static final String LDAP_PORT = "ds-cfg-listen-port";
  /**
   * Create an object that will syncrhonize configuration and the
   * admin data.
   * Create an object that will synchronize configuration and the admin data.
   *
   * @param internalConnection
   *          The root connection.
@@ -81,11 +76,9 @@
    this.internalConnection = internalConnection;
  }
  /**
   * Check if information found in "cn=admin data" is coherent with
   * cn=config. If and inconsistancy is detected, we log a warning
   * cn=config. If and inconsistency is detected, we log a warning
   * message and update "cn=admin data"
   */
  public void synchronize()
@@ -94,8 +87,6 @@
    checkAdminConnector();
  }
  /**
   * Check if the admin connector is in sync. The desynchronization
   * could occurs after the upgrade from 1.0.
@@ -111,42 +102,24 @@
    }
    // Get the admin port
    String adminPort = getAttr("cn=Administration Connector,cn=config",
        LDAP_PORT);
    String adminPort = getAttr("cn=Administration Connector,cn=config", LDAP_PORT);
    if (adminPort == null)
    {
      // best effort.
      return;
    }
    LinkedList<Modification> mods = new LinkedList<>();
    // adminport
    String attName = "adminport";
    AttributeType attrType = DirectoryServer.getAttributeType(attName
        .toLowerCase());
    if (attrType == null)
    {
      attrType = DirectoryServer.getDefaultAttributeType(attName.toLowerCase());
    }
    mods.add(new Modification(ModificationType.REPLACE, Attributes.create(
        attrType, adminPort)));
    AttributeType attrType1 = DirectoryServer.getAttributeType("adminport".toLowerCase(), true);
    AttributeType attrType2 = DirectoryServer.getAttributeType("adminEnabled".toLowerCase(), true);
    // adminEnabled
    attName = "adminEnabled";
    attrType = DirectoryServer.getAttributeType(attName.toLowerCase());
    if (attrType == null)
    {
      attrType = DirectoryServer.getDefaultAttributeType(attName.toLowerCase());
    }
    mods.add(new Modification(ModificationType.REPLACE, Attributes.create(
        attrType, "true")));
    LinkedList<Modification> mods = new LinkedList<>();
    mods.add(new Modification(ModificationType.REPLACE, Attributes.create(attrType1, adminPort)));
    mods.add(new Modification(ModificationType.REPLACE, Attributes.create(attrType2, "true")));
    // Process modification
    internalConnection.processModify(serverEntryDN, mods);
  }
  /**
   * Look for the DN of the local register server. Assumption: default
   * Connection Handler naming is used.
@@ -158,21 +131,15 @@
    DN returnDN = null;
    // Get the LDAP and LDAPS port
    String ldapPort = getAttr(
        "cn=LDAP Connection Handler,cn=Connection Handlers,cn=config",
        LDAP_PORT);
    String ldapsPort = getAttr(
        "cn=LDAPS Connection Handler,cn=Connection Handlers,cn=config",
        LDAP_PORT);
    String ldapPort = getAttr("cn=LDAP Connection Handler,cn=Connection Handlers,cn=config", LDAP_PORT);
    String ldapsPort = getAttr("cn=LDAPS Connection Handler,cn=Connection Handlers,cn=config", LDAP_PORT);
    boolean ldapsPortEnable = false;
    String val = getAttr(
        "cn=LDAPS Connection Handler,cn=Connection Handlers,cn=config",
        "ds-cfg-enabled");
    String val = getAttr("cn=LDAPS Connection Handler,cn=Connection Handlers,cn=config", "ds-cfg-enabled");
    if (val != null)
    {
      ldapsPortEnable = val.toLowerCase().equals("true");
      ldapsPortEnable = "true".equals(val.toLowerCase());
    }
    if ((ldapPort == null) && (ldapsPort == null))
    if (ldapPort == null && ldapsPort == null)
    {
      // best effort (see assumption)
      return null;
@@ -182,7 +149,7 @@
    String hostName;
    try
    {
      hostName = java.net.InetAddress.getLocalHost().getCanonicalHostName();
      hostName = InetAddress.getLocalHost().getCanonicalHostName();
    }
    catch (Throwable t)
    {
@@ -197,50 +164,12 @@
      InternalSearchOperation op = internalConnection.processSearch(request);
      if (op.getResultCode() == ResultCode.SUCCESS)
      {
        Entry entry = null;
        for (Entry currentEntry : op.getSearchEntries())
        {
          String currentHostname =
              currentEntry.parseAttribute("hostname").asString();
          try
          {
            String currentIPAddress = java.net.InetAddress.getByName(
                currentHostname).getCanonicalHostName();
            if (currentIPAddress.equals(hostName))
            {
              // Check if one of the port match
              String currentport =
                  currentEntry.parseAttribute("ldapport").asString();
              if (currentport.equals(ldapPort))
              {
                entry = currentEntry;
                break;
              }
              if (ldapsPortEnable)
              {
                currentport =
                    currentEntry.parseAttribute("ldapsport").asString();
                if (currentport.equals(ldapsPort))
                {
                  entry = currentEntry;
                  break;
                }
              }
            }
          }
          catch (Exception e)
          {
            // best effort.
            continue;
          }
        }
        Entry entry = findSameHostAndPort(op.getSearchEntries(), hostName, ldapPort, ldapsPortEnable, ldapsPort);
        if (entry != null)
        {
          returnDN = entry.getName();
        }
      }
    }
    catch (DirectoryException e)
    {
@@ -250,7 +179,41 @@
    return returnDN;
  }
  private Entry findSameHostAndPort(LinkedList<SearchResultEntry> searchResultEntries,
      String hostName, String ldapPort, boolean ldapsPortEnable, String ldapsPort)
  {
    for (Entry currentEntry : searchResultEntries)
    {
      String currentHostname = currentEntry.parseAttribute("hostname").asString();
      try
      {
        String currentIPAddress = InetAddress.getByName(currentHostname).getCanonicalHostName();
        if (currentIPAddress.equals(hostName))
        {
          // Check if one of the port match
          String currentport = currentEntry.parseAttribute("ldapport").asString();
          if (currentport.equals(ldapPort))
          {
            return currentEntry;
          }
          if (ldapsPortEnable)
          {
            currentport = currentEntry.parseAttribute("ldapsport").asString();
            if (currentport.equals(ldapsPort))
            {
              return currentEntry;
            }
          }
        }
      }
      catch (Exception e)
      {
        // best effort.
        continue;
      }
    }
    return null;
  }
  /**
   * Gets an attribute value from an entry.
@@ -282,7 +245,7 @@
    {
      // can not happen
      // best effort.
      // TODO Log an Error.
      logger.traceException(e);
      return null;
    }
@@ -294,23 +257,17 @@
      adminConnectorEntry = result.getFirst();
    }
    AttributeType attrType = DirectoryServer.getAttributeType(attrName);
    if (attrType == null)
    {
      attrType = DirectoryServer.getDefaultAttributeType(attrName);
    }
    AttributeType attrType = DirectoryServer.getAttributeType(attrName, true);
    List<Attribute> attrs = adminConnectorEntry.getAttribute(attrType);
    if (attrs == null)
    if (attrs != null)
    {
      // can not happen
      // best effort.
      // TODO Log an Error.
      return null;
      // Get the attribute value
      return attrs.get(0).iterator().next().toString();
    }
    // Get the attribute value
    return attrs.get(0).iterator().next().toString();
    // can not happen
    // best effort.
    // TODO Log an Error.
    return null;
  }
}
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciEffectiveRights.java
@@ -28,13 +28,17 @@
import static org.opends.server.authorization.dseecompat.Aci.*;
import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.*;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeType;
import org.opends.server.types.Attributes;
import org.opends.server.types.Entry;
/**
 * This class implements the dseecompat geteffectiverights evaluation.
 */
@@ -274,20 +278,14 @@
        }
        else
        {
          AttributeType attrType = DirectoryServer.getAttributeType(a
              .toLowerCase());
          if (attrType == null)
          {
            attrType = DirectoryServer.getDefaultAttributeType(a.toLowerCase());
          }
          nonRightsAttrs.add(attrType);
          nonRightsAttrs.add(DirectoryServer.getAttributeType(a.toLowerCase(), true));
        }
      }
    }
    // If the special geteffectiverights attributes were not found or
    // the user does not have both bypass-acl privs and is not allowed to
    // perform rights evalation -- return the entry unchanged.
    // perform rights evaluation -- return the entry unchanged.
    if (attrMask == ACI_NULL
        || (!skipCheck && !rightsAccessAllowed(container, handler, attrMask)))
    {
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciHandler.java
@@ -139,12 +139,7 @@
  private static AttributeType getAttributeType(String name)
  {
    AttributeType attrType = DirectoryServer.getAttributeType(name);
    if (attrType == null)
    {
      attrType = DirectoryServer.getDefaultAttributeType(name);
    }
    return attrType;
    return DirectoryServer.getAttributeType(name, true);
  }
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/ParentInheritance.java
@@ -220,13 +220,7 @@
     * @return The attribute type.
     */
    public AttributeType getAttributeType() {
      final String attrName = attrTypeStr.toLowerCase();
      AttributeType attrType = DirectoryServer.getAttributeType(attrName);
      if(attrType == null)
      {
        attrType = DirectoryServer.getDefaultAttributeType(attrName);
      }
      return attrType;
      return DirectoryServer.getAttributeType(attrTypeStr.toLowerCase(), true);
    }
    /**
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargAttrFilterList.java
@@ -132,10 +132,7 @@
              attributeName=attributeName.substring(0, semicolon);
            }
            String filterString=matcher.group(filterPos);
            AttributeType attrType = DirectoryServer.getAttributeType(attributeName);
            if (attrType == null) {
                attrType = DirectoryServer.getDefaultAttributeType(attributeName);
            }
            AttributeType attrType = DirectoryServer.getAttributeType(attributeName, true);
            SearchFilter filter;
            //Check if it is a valid filter and add it to the list map if ok.
            try {
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargetAttr.java
@@ -39,18 +39,18 @@
/**
 * A class representing an ACI's targetattr keyword.
 */
public class TargetAttr {
class TargetAttr {
    /** Enumeration representing the targetattr operator. */
    private EnumTargetOperator operator = EnumTargetOperator.EQUALITY;
    private final EnumTargetOperator operator;
    /** Flags that is set if all user attributes pattern seen "*". */
    private boolean allUserAttributes;
    /** Flags that is set if all operational attributes pattern seen "+". */
    private boolean allOpAttributes;
    /** Set of the attribute types parsed by the constructor. */
    private HashSet<AttributeType> attributes = new HashSet<>();
    private final HashSet<AttributeType> attributes = new HashSet<>();
    /** Set of the operational attribute types parsed by the constructor. */
    private HashSet<AttributeType> opAttributes = new HashSet<>();
    private final HashSet<AttributeType> opAttributes = new HashSet<>();
    /**
     * Regular expression that matches one or more ATTR_NAME's separated by
@@ -132,10 +132,7 @@
                    throw new AciException(message);
                }
            } else {
                AttributeType attrType = DirectoryServer.getAttributeType(attribute);
                if (attrType == null) {
                    attrType = DirectoryServer.getDefaultAttributeType(attribute);
                }
                AttributeType attrType = DirectoryServer.getAttributeType(attribute, true);
                if(attrType.isOperational())
                {
                  opAttributes.add(attrType);
@@ -175,24 +172,6 @@
    }
    /**
     * Return array holding each attribute type to be evaluated
     * in the expression.
     * @return Array holding each attribute types.
     */
    public HashSet<AttributeType> getAttributes() {
        return attributes;
    }
    /**
     * Return array holding  operational attribute types to be evaluated
     * in the expression.
     * @return  Array holding attribute types.
     */
    public HashSet<AttributeType> getOpAttributes() {
        return opAttributes;
    }
    /**
     * Decodes an targetattr expression string into a targetattr class suitable
     * for evaluation.
     * @param operator The operator enumeration of the expression.
@@ -200,8 +179,7 @@
     * @return A TargetAttr suitable to evaluate this ACI's targetattrs.
     * @throws AciException If the expression string is invalid.
     */
    public static TargetAttr decode(EnumTargetOperator operator, String expr)
            throws AciException  {
    static TargetAttr decode(EnumTargetOperator operator, String expr) throws AciException  {
        return new TargetAttr(operator, expr);
    }
@@ -224,8 +202,7 @@
     * @return The boolean result of the above tests and application
     * TargetAttr's operator value applied to the test result.
     */
    public static boolean isApplicable(AttributeType a, TargetAttr targetAttr) {
    static boolean isApplicable(AttributeType a, TargetAttr targetAttr) {
        if(targetAttr.isAllUserAttributes() && targetAttr.isAllOpAttributes()) {
            return !targetAttr.getOperator().equals(EnumTargetOperator.NOT_EQUALITY);
        } else {
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/UserAttr.java
@@ -201,10 +201,7 @@
    private EnumEvalResult evalVAL(AciEvalContext evalCtx) {
        EnumEvalResult matched= EnumEvalResult.FALSE;
        boolean undefined=false;
        AttributeType attrType = DirectoryServer.getAttributeType(attrStr);
        if (attrType == null) {
            attrType = DirectoryServer.getDefaultAttributeType(attrStr);
        }
        AttributeType attrType = DirectoryServer.getAttributeType(attrStr, true);
        final SearchRequest request = newSearchRequest(evalCtx.getClientDN(), SearchScope.BASE_OBJECT);
        InternalSearchOperation op = getRootConnection().processSearch(request);
        LinkedList<SearchResultEntry> result = op.getSearchEntries();
@@ -232,10 +229,7 @@
    private EnumEvalResult evalURL(AciEvalContext evalCtx) {
        EnumEvalResult matched= EnumEvalResult.FALSE;
        boolean undefined=false;
        AttributeType attrType = DirectoryServer.getAttributeType(attrStr);
        if (attrType == null) {
            attrType = DirectoryServer.getDefaultAttributeType(attrStr);
        }
        AttributeType attrType = DirectoryServer.getAttributeType(attrStr, true);
        List<Attribute> attrs=evalCtx.getResourceEntry().getAttribute(attrType);
        if(!attrs.isEmpty()) {
            for(Attribute a : attrs) {
opendj-server-legacy/src/main/java/org/opends/server/backends/ChangelogBackend.java
@@ -749,11 +749,7 @@
  private SearchFilter buildSearchFilterFrom(final DN baseDN, final String lowerCaseAttr, final String upperCaseAttr)
  {
    final RDN rdn = baseDN.rdn();
    AttributeType attrType = DirectoryServer.getAttributeType(lowerCaseAttr);
    if (attrType == null)
    {
      attrType = DirectoryServer.getDefaultAttributeType(upperCaseAttr);
    }
    AttributeType attrType = DirectoryServer.getAttributeType(lowerCaseAttr, upperCaseAttr);
    final ByteString attrValue = rdn.getAttributeValue(attrType);
    if (attrValue != null)
    {
@@ -1548,11 +1544,7 @@
      final Map<AttributeType, List<Attribute>> userAttrs,
      final Map<AttributeType, List<Attribute>> operationalAttrs, final boolean addByType)
  {
    AttributeType attrType = DirectoryServer.getAttributeType(attrNameLowercase);
    if (attrType == null)
    {
      attrType = DirectoryServer.getDefaultAttributeType(attrNameUppercase);
    }
    AttributeType attrType = DirectoryServer.getAttributeType(attrNameLowercase, attrNameUppercase);
    final Attribute a = addByType
        ? Attributes.create(attrType, attrValue)
        : Attributes.create(attrNameUppercase, attrValue);
opendj-server-legacy/src/main/java/org/opends/server/backends/RootDSEBackend.java
@@ -636,11 +636,7 @@
  private Attribute createAttribute(String name, String lowerName,
                                    Collection<? extends Object> values)
  {
    AttributeType type = DirectoryServer.getAttributeType(lowerName);
    if (type == null)
    {
      type = DirectoryServer.getDefaultAttributeType(name);
    }
    AttributeType type = DirectoryServer.getAttributeType(lowerName, name);
    AttributeBuilder builder = new AttributeBuilder(type, name);
    builder.addAllStrings(values);
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/Importer.java
@@ -164,7 +164,7 @@
  private static final int MINIMUM_AVAILABLE_MEMORY = 32 * MB;
  /** The DN attribute type. */
  private static final AttributeType dnType;
  private static final AttributeType dnType = DirectoryServer.getAttributeType("dn", true);
  static final IndexOutputBuffer.IndexComparator indexComparator =
      new IndexOutputBuffer.IndexComparator();
@@ -266,16 +266,6 @@
  private final DiskSpaceMonitor diskSpaceMonitor;
  static
  {
    AttributeType attrType = DirectoryServer.getAttributeType("dn");
    if (attrType == null)
    {
      attrType = DirectoryServer.getDefaultAttributeType("dn");
    }
    dnType = attrType;
  }
  /**
   * Create a new import job with the specified rebuild index config.
   *
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/OnDiskMergeBufferImporter.java
@@ -196,16 +196,7 @@
  private static final int SMALL_HEAP_SIZE = 256 * MB;
  /** The DN attribute type. */
  private static final AttributeType DN_TYPE;
  static
  {
    AttributeType attrType = DirectoryServer.getAttributeType("dn");
    if (attrType == null)
    {
      attrType = DirectoryServer.getDefaultAttributeType("dn");
    }
    DN_TYPE = attrType;
  }
  private static final AttributeType DN_TYPE = DirectoryServer.getAttributeType("dn", true);
  /** Root container. */
  private final RootContainer rootContainer;
opendj-server-legacy/src/main/java/org/opends/server/backends/task/RecurringTask.java
@@ -152,12 +152,7 @@
    // Get the recurring task ID from the entry.  If there isn't one, then fail.
    AttributeType attrType = DirectoryServer.getAttributeType(
                                  ATTR_RECURRING_TASK_ID.toLowerCase());
    if (attrType == null)
    {
      attrType = DirectoryServer.getDefaultAttributeType(ATTR_RECURRING_TASK_ID);
    }
        ATTR_RECURRING_TASK_ID.toLowerCase(), ATTR_RECURRING_TASK_ID);
    List<Attribute> attrList = recurringTaskEntry.getAttribute(attrType);
    if (attrList == null || attrList.isEmpty())
    {
opendj-server-legacy/src/main/java/org/opends/server/backends/task/Task.java
@@ -973,13 +973,8 @@
      String messageString = buffer.toString();
      logMessages.add(messageString);
      AttributeType type = DirectoryServer.getAttributeType(
                                ATTR_TASK_LOG_MESSAGES.toLowerCase());
      if (type == null)
      {
        type = DirectoryServer.getDefaultAttributeType(ATTR_TASK_LOG_MESSAGES);
      }
          ATTR_TASK_LOG_MESSAGES.toLowerCase(), ATTR_TASK_LOG_MESSAGES);
      List<Attribute> attrList = taskEntry.getAttribute(type);
      ByteString value = ByteString.valueOf(messageString);
opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskScheduler.java
@@ -1804,13 +1804,7 @@
         throws DirectoryException
  {
    // Get the name of the class that implements the task logic.
    AttributeType attrType =
         DirectoryServer.getAttributeType(ATTR_TASK_CLASS.toLowerCase());
    if (attrType == null)
    {
      attrType = DirectoryServer.getDefaultAttributeType(ATTR_TASK_CLASS);
    }
    AttributeType attrType = DirectoryServer.getAttributeType(ATTR_TASK_CLASS.toLowerCase(), ATTR_TASK_CLASS);
    List<Attribute> attrList = entry.getAttribute(attrType);
    if ((attrList == null) || attrList.isEmpty())
    {
opendj-server-legacy/src/main/java/org/opends/server/config/ConfigEntry.java
@@ -33,12 +33,13 @@
import java.util.concurrent.CopyOnWriteArrayList;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.opends.server.api.ConfigAddListener;
import org.opends.server.api.ConfigChangeListener;
import org.opends.server.api.ConfigDeleteListener;
import org.opends.server.core.DirectoryServer;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.opends.server.types.*;
import static org.opends.messages.ConfigMessages.*;
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.util.StaticUtils.*;
@@ -191,13 +192,7 @@
         throws ConfigException
  {
    String attrName = stub.getName();
    AttributeType attrType =
         DirectoryServer.getAttributeType(attrName.toLowerCase());
    if (attrType == null)
    {
      attrType = DirectoryServer.getDefaultAttributeType(attrName);
    }
    AttributeType attrType = DirectoryServer.getAttributeType(attrName.toLowerCase(), attrName);
    List<Attribute> attrList = entry.getAttribute(attrType);
    if (attrList != null && !attrList.isEmpty())
    {
opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java
@@ -398,14 +398,8 @@
  {
    // It's possible that this is a monitor attribute rather than a configurable
    // one. Check all of those.
    AttributeType attrType =
      DirectoryServer.getAttributeType(name.toLowerCase());
    if (attrType == null)
    {
      attrType = DirectoryServer.getDefaultAttributeType(name);
    }
    for (MonitorProvider<? extends MonitorProviderCfg> monitor :
         monitorProviders)
    AttributeType attrType = DirectoryServer.getAttributeType(name.toLowerCase(), name);
    for (MonitorProvider<? extends MonitorProviderCfg> monitor : monitorProviders)
    {
      for (org.opends.server.types.Attribute a : monitor.getMonitorData())
      {
@@ -588,12 +582,7 @@
      // It's possible that this is a monitor attribute rather than a
      // configurable one. Check all of those.
      AttributeType attrType =
        DirectoryServer.getAttributeType(name.toLowerCase());
      if (attrType == null)
      {
        attrType = DirectoryServer.getDefaultAttributeType(name);
      }
      AttributeType attrType = DirectoryServer.getAttributeType(name.toLowerCase(), name);
monitorLoop:
      for (MonitorProvider<? extends MonitorProviderCfg> monitor :
opendj-server-legacy/src/main/java/org/opends/server/controls/GetEffectiveRightsRequestControl.java
@@ -26,23 +26,26 @@
 */
package org.opends.server.controls;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.io.ASN1;
import org.forgerock.opendj.io.ASN1Reader;
import org.forgerock.opendj.io.ASN1Writer;
import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.*;
import org.forgerock.opendj.ldap.ResultCode;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.AttributeType;
import org.opends.server.types.Control;
import org.opends.server.types.DN;
import org.opends.server.types.DirectoryException;
import static org.opends.messages.ProtocolMessages.*;
import static org.opends.server.util.ServerConstants.*;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
/**
 * This class partially implements the geteffectiverights control as defined
 * in draft-ietf-ldapext-acl-model-08.txt. The main differences are:
@@ -116,14 +119,8 @@
            attrs = new LinkedList<>();
            reader.readStartSequence();
            while(reader.hasNextElement()) {
              //Decode as an octet string.
              String attrStr = reader.readOctetStringAsString();
              AttributeType attrType = DirectoryServer.getAttributeType(attrStr);
              //Get an attribute type for it and add to the list.
              if (attrType == null) {
                attrType = DirectoryServer.getDefaultAttributeType(attrStr);
              }
              attrs.add(attrType);
              attrs.add(DirectoryServer.getAttributeType(attrStr, true));
            }
            reader.readEndSequence();
          }
@@ -145,7 +142,6 @@
    {
      return OID_GET_EFFECTIVE_RIGHTS;
    }
  }
  /**
opendj-server-legacy/src/main/java/org/opends/server/controls/MatchedValuesFilter.java
@@ -38,11 +38,13 @@
import org.forgerock.opendj.ldap.Assertion;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.util.Reject;
import org.forgerock.opendj.ldap.schema.MatchingRule;
import org.forgerock.util.Reject;
import org.opends.server.core.DirectoryServer;
import org.opends.server.protocols.ldap.LDAPResultCode;
import org.opends.server.types.*;
import org.opends.server.types.AttributeType;
import org.opends.server.types.LDAPException;
import org.opends.server.types.RawFilter;
import static org.opends.messages.ProtocolMessages.*;
import static org.opends.server.protocols.ldap.LDAPConstants.*;
@@ -897,11 +899,8 @@
  {
    if (attributeType == null && rawAttributeType != null)
    {
      attributeType = DirectoryServer.getAttributeType(toLowerCase(rawAttributeType));
      if (attributeType == null)
      {
        attributeType = DirectoryServer.getDefaultAttributeType(rawAttributeType);
      }
      String lowerName = toLowerCase(rawAttributeType);
      attributeType = DirectoryServer.getAttributeType(lowerName, rawAttributeType);
    }
    return attributeType;
  }
opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
@@ -73,6 +73,7 @@
import org.forgerock.opendj.ldap.schema.MatchingRule;
import org.forgerock.opendj.ldap.schema.ObjectClassType;
import org.forgerock.opendj.ldap.schema.SchemaBuilder;
import org.forgerock.opendj.ldap.schema.Syntax;
import org.forgerock.util.Reject;
import org.forgerock.util.Utils;
import org.opends.server.admin.AdministrationConnector;
@@ -91,7 +92,6 @@
import org.opends.server.api.AccountStatusNotificationHandler;
import org.opends.server.api.AlertGenerator;
import org.opends.server.api.AlertHandler;
import org.forgerock.opendj.ldap.schema.Syntax;
import org.opends.server.api.AuthenticationPolicy;
import org.opends.server.api.Backend;
import org.opends.server.api.BackendInitializationListener;
@@ -2899,11 +2899,30 @@
    {
      type = getDefaultAttributeType(lowerName);
    }
    return type;
  }
  /**
   * Retrieves the attribute type for the provided lowercase name or OID. It will return a generated
   * "default" version with the uppercase name or OID if the requested attribute type is not defined
   * in the schema.
   *
   * @param lowerName
   *          The lowercase name or OID for the attribute type to retrieve.
   * @param upperName
   *          The uppercase name or OID for the attribute type to generate.
   * @return The requested attribute type, or a generated "default" version if there is no attribute
   *         with the specified type defined in the server schema
   */
  public static AttributeType getAttributeType(String lowerName, String upperName)
  {
    AttributeType type = directoryServer.schema.getAttributeType(lowerName);
    if (type == null)
    {
      type = getDefaultAttributeType(upperName);
    }
    return type;
  }
  /**
   * Registers the provided attribute type with the Directory Server.
opendj-server-legacy/src/main/java/org/opends/server/core/PasswordPolicyState.java
@@ -318,7 +318,6 @@
    {
      // Get the password changed time for the user.
      AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_CHANGED_TIME_LC, true);
      try
      {
        passwordChangedTime = getGeneralizedTime(userEntry, type);
@@ -656,12 +655,8 @@
      return authFailureTimes;
    }
    AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_FAILURE_TIME_LC);
    if (type == null)
    {
      type = DirectoryServer.getDefaultAttributeType(OP_ATTR_PWPOLICY_FAILURE_TIME);
    }
    AttributeType type = DirectoryServer.getAttributeType(
        OP_ATTR_PWPOLICY_FAILURE_TIME_LC, OP_ATTR_PWPOLICY_FAILURE_TIME);
    try
    {
      authFailureTimes = getGeneralizedTimes(type);
@@ -770,12 +765,8 @@
    failureTimes.add(highestFailureTime);
    // And the attribute in the user entry
    AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_FAILURE_TIME_LC);
    if (type == null)
    {
      type = DirectoryServer.getDefaultAttributeType(OP_ATTR_PWPOLICY_FAILURE_TIME);
    }
    AttributeType type = DirectoryServer.getAttributeType(
        OP_ATTR_PWPOLICY_FAILURE_TIME_LC, OP_ATTR_PWPOLICY_FAILURE_TIME);
    Attribute addAttr = Attributes.create(type, GeneralizedTimeSyntax.format(highestFailureTime));
    modifications.add(new Modification(ModificationType.ADD, addAttr, true));
@@ -856,12 +847,8 @@
    failureTimes.clear(); // Note: failureTimes != this.authFailureTimes
    AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_FAILURE_TIME_LC);
    if (type == null)
    {
      type = DirectoryServer.getDefaultAttributeType(OP_ATTR_PWPOLICY_FAILURE_TIME);
    }
    AttributeType type = DirectoryServer.getAttributeType(
        OP_ATTR_PWPOLICY_FAILURE_TIME_LC, OP_ATTR_PWPOLICY_FAILURE_TIME);
    modifications.add(new Modification(ModificationType.REPLACE, Attributes.empty(type), true));
  }
@@ -878,12 +865,8 @@
      return failureLockedTime;
    }
    AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_LOCKED_TIME_LC);
    if (type == null)
    {
      type = DirectoryServer.getDefaultAttributeType(OP_ATTR_PWPOLICY_LOCKED_TIME);
    }
    AttributeType type = DirectoryServer.getAttributeType(
        OP_ATTR_PWPOLICY_LOCKED_TIME_LC, OP_ATTR_PWPOLICY_LOCKED_TIME);
    try
    {
      failureLockedTime = getGeneralizedTime(userEntry, type);
@@ -916,12 +899,8 @@
    failureLockedTime = time;
    AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_LOCKED_TIME_LC);
    if (type == null)
    {
      type = DirectoryServer.getDefaultAttributeType(OP_ATTR_PWPOLICY_LOCKED_TIME);
    }
    AttributeType type = DirectoryServer.getAttributeType(
        OP_ATTR_PWPOLICY_LOCKED_TIME_LC, OP_ATTR_PWPOLICY_LOCKED_TIME);
    Attribute a = Attributes.create(type, GeneralizedTimeSyntax.format(failureLockedTime));
    modifications.add(new Modification(ModificationType.REPLACE, a, true));
  }
@@ -945,12 +924,8 @@
    failureLockedTime = -1L;
    AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_LOCKED_TIME_LC);
    if (type == null)
    {
      type = DirectoryServer.getDefaultAttributeType(OP_ATTR_PWPOLICY_LOCKED_TIME);
    }
    AttributeType type = DirectoryServer.getAttributeType(
        OP_ATTR_PWPOLICY_LOCKED_TIME_LC, OP_ATTR_PWPOLICY_LOCKED_TIME);
    modifications.add(new Modification(ModificationType.REPLACE, Attributes.empty(type), true));
  }
@@ -1392,12 +1367,8 @@
      return false;
    }
    AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_RESET_REQUIRED_LC);
    if (type == null)
    {
      type = DirectoryServer.getDefaultAttributeType(OP_ATTR_PWPOLICY_RESET_REQUIRED);
    }
    AttributeType type = DirectoryServer.getAttributeType(
        OP_ATTR_PWPOLICY_RESET_REQUIRED_LC, OP_ATTR_PWPOLICY_RESET_REQUIRED);
    try
    {
      mustChangePassword = getBoolean(userEntry, type);
@@ -1444,14 +1415,9 @@
      return;  // requested state matches current state
    }
    AttributeType type = DirectoryServer.getAttributeType(
        OP_ATTR_PWPOLICY_RESET_REQUIRED_LC, OP_ATTR_PWPOLICY_RESET_REQUIRED);
    this.mustChangePassword = ConditionResult.not(this.mustChangePassword);
    AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_RESET_REQUIRED_LC);
    if (type == null)
    {
      type = DirectoryServer.getDefaultAttributeType(OP_ATTR_PWPOLICY_RESET_REQUIRED);
    }
    if (mustChangePassword)
    {
      Attribute a = Attributes.create(type, String.valueOf(true));
@@ -2044,12 +2010,8 @@
  {
    if (graceLoginTimes == null)
    {
      AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME_LC);
      if (type == null)
      {
        type = DirectoryServer.getDefaultAttributeType(OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME);
      }
      AttributeType type = DirectoryServer.getAttributeType(
        OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME_LC, OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME);
      try
      {
        graceLoginTimes = getGeneralizedTimes(type);
@@ -2116,12 +2078,8 @@
    }
    graceTimes.add(highestGraceTime); // graceTimes == this.graceLoginTimes
    AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME_LC);
    if (type == null)
    {
      type = DirectoryServer.getDefaultAttributeType(OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME);
    }
    AttributeType type = DirectoryServer.getAttributeType(
        OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME_LC, OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME);
    Attribute addAttr = Attributes.create(type, GeneralizedTimeSyntax.format(highestGraceTime));
    modifications.add(new Modification(ModificationType.ADD, addAttr, true));
  }
@@ -2179,12 +2137,8 @@
    }
    graceTimes.clear(); // graceTimes == this.graceLoginTimes
    AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME_LC);
    if (type == null)
    {
      type = DirectoryServer.getDefaultAttributeType(OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME);
    }
    AttributeType type = DirectoryServer.getAttributeType(
        OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME_LC, OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME);
    modifications.add(new Modification(ModificationType.REPLACE, Attributes.empty(type), true));
  }
opendj-server-legacy/src/main/java/org/opends/server/monitors/ClientConnectionMonitorProvider.java
@@ -26,7 +26,6 @@
 */
package org.opends.server.monitors;
import java.util.Collection;
import java.util.List;
import java.util.TreeMap;
@@ -137,11 +136,9 @@
    if (handler == null)
    {
      // Get information about all the available connections.
      for (ConnectionHandler<?> hdl : DirectoryServer
          .getConnectionHandlers())
      for (ConnectionHandler<?> hdl : DirectoryServer.getConnectionHandlers())
      {
        // FIXME: connections from different handlers could have the
        // same ID.
        // FIXME: connections from different handlers could have the same ID.
        for (ClientConnection conn : hdl.getClientConnections())
        {
          connMap.put(conn.getConnectionID(), conn);
@@ -150,9 +147,7 @@
    }
    else
    {
      Collection<ClientConnection> collection =
          handler.getClientConnections();
      for (ClientConnection conn : collection)
      for (ClientConnection conn : handler.getClientConnections())
      {
        connMap.put(conn.getConnectionID(), conn);
      }
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPFilter.java
@@ -40,13 +40,16 @@
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.schema.MatchingRule;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.*;
import org.opends.server.types.AttributeType;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.FilterType;
import org.opends.server.types.LDAPException;
import org.opends.server.types.RawFilter;
import org.opends.server.types.SearchFilter;
import static org.opends.messages.ProtocolMessages.*;
import static org.opends.server.util.StaticUtils.*;
/**
 * This class defines the data structures and methods to use when interacting
 * with an LDAP search filter, which defines a set of criteria for locating
@@ -1907,12 +1910,7 @@
      if (semicolonPos > 0)
      {
        String baseName = attributeType.substring(0, semicolonPos);
        attrType = DirectoryServer.getAttributeType(toLowerCase(baseName));
        if (attrType == null)
        {
          attrType = DirectoryServer.getDefaultAttributeType(baseName);
        }
        attrType = DirectoryServer.getAttributeType(toLowerCase(baseName), baseName);
        options = new HashSet<>();
        StringTokenizer tokenizer =
             new StringTokenizer(attributeType.substring(semicolonPos+1), ";");
@@ -1924,12 +1922,7 @@
      else
      {
        options = null;
        attrType =
             DirectoryServer.getAttributeType(toLowerCase(attributeType));
        if (attrType == null)
        {
          attrType = DirectoryServer.getDefaultAttributeType(attributeType);
        }
        attrType = DirectoryServer.getAttributeType(toLowerCase(attributeType), attributeType);
      }
    }
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/HistoricalAttributeValue.java
@@ -33,7 +33,10 @@
import org.forgerock.opendj.ldap.ModificationType;
import org.opends.server.core.DirectoryServer;
import org.opends.server.replication.common.CSN;
import org.opends.server.types.*;
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeBuilder;
import org.opends.server.types.AttributeType;
import org.opends.server.types.Modification;
/**
 * This class stores an internal usable representation of the value of
@@ -114,11 +117,7 @@
    {
      // This HistVal was used to store the date when some
       // modifications were done to the entries.
      attrType = DirectoryServer.getSchema().getAttributeType(attrString);
      if (attrType == null)
      {
        attrType = DirectoryServer.getDefaultAttributeType(attrString);
      }
      attrType = DirectoryServer.getAttributeType(attrString, true);
    }
    else
    {
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -3425,17 +3425,11 @@
    // For the checksum computing mode, only consider the 'stable' attributes
    if (checksumOutput)
    {
      String includeAttributeStrings[] =
        {"objectclass", "sn", "cn", "entryuuid"};
      String includeAttributeStrings[] = { "objectclass", "sn", "cn", "entryuuid" };
      Set<AttributeType> includeAttributes = new HashSet<>();
      for (String attrName : includeAttributeStrings)
      {
        AttributeType attrType  = DirectoryServer.getAttributeType(attrName);
        if (attrType == null)
        {
          attrType = DirectoryServer.getDefaultAttributeType(attrName);
        }
        includeAttributes.add(attrType);
        includeAttributes.add(DirectoryServer.getAttributeType(attrName, true));
      }
      exportConfig.setIncludeAttributes(includeAttributes);
    }
opendj-server-legacy/src/main/java/org/opends/server/schema/AttributeTypeSyntax.java
@@ -523,19 +523,19 @@
        // which this attribute type should inherit its properties.
        StringBuilder woidBuffer = new StringBuilder();
        pos = readWOID(lowerStr, woidBuffer, pos);
        superiorType = schema.getAttributeType(woidBuffer.toString());
        String woidString = woidBuffer.toString();
        superiorType = schema.getAttributeType(woidString);
        if (superiorType == null)
        {
          if (allowUnknownElements)
          {
            superiorType = DirectoryServer.getDefaultAttributeType(
                                                woidBuffer.toString());
            superiorType = DirectoryServer.getDefaultAttributeType(woidString);
          }
          else
          {
            // This is bad because we don't know what the superior attribute
            // type is so we can't base this attribute type on it.
            LocalizableMessage message = WARN_ATTR_SYNTAX_ATTRTYPE_UNKNOWN_SUPERIOR_TYPE.get(oid, woidBuffer);
            LocalizableMessage message = WARN_ATTR_SYNTAX_ATTRTYPE_UNKNOWN_SUPERIOR_TYPE.get(oid, woidString);
            throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message);
          }
        }
opendj-server-legacy/src/main/java/org/opends/server/schema/DITContentRuleSyntax.java
@@ -36,6 +36,7 @@
import java.util.List;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageDescriptor.Arg2;
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.schema.ObjectClassType;
@@ -504,28 +505,10 @@
          {
            StringBuilder woidBuffer = new StringBuilder();
            pos = readWOID(lowerStr, woidBuffer, (pos));
            attrs.add(getAttribute(schema, allowUnknownElements, valueStr, woidBuffer,
                ERR_ATTR_SYNTAX_DCR_UNKNOWN_REQUIRED_ATTR));
            AttributeType attr = schema.getAttributeType(woidBuffer.toString());
            if (attr == null)
            {
              // This isn't good because it means that the DIT content rule
              // requires an attribute type that we don't know anything about.
              if (allowUnknownElements)
              {
                attr = DirectoryServer.getDefaultAttributeType(woidBuffer.toString());
              }
              else
              {
                throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
                    ERR_ATTR_SYNTAX_DCR_UNKNOWN_REQUIRED_ATTR.get(valueStr, woidBuffer));
              }
            }
            attrs.add(attr);
            // The next character must be either a dollar sign or a closing
            // parenthesis.
            // The next character must be either a dollar sign or a closing parenthesis.
            c = valueStr.charAt(pos++);
            if (c == ')')
            {
@@ -544,25 +527,8 @@
        {
          StringBuilder woidBuffer = new StringBuilder();
          pos = readWOID(lowerStr, woidBuffer, (pos-1));
          AttributeType attr = schema.getAttributeType(woidBuffer.toString());
          if (attr == null)
          {
            // This isn't good because it means that the DIT content rule
            // requires an attribute type that we don't know anything about.
            if (allowUnknownElements)
            {
              attr = DirectoryServer.getDefaultAttributeType(
                                          woidBuffer.toString());
            }
            else
            {
              throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
                  ERR_ATTR_SYNTAX_DCR_UNKNOWN_REQUIRED_ATTR.get(valueStr, woidBuffer));
            }
          }
          attrs.add(attr);
          attrs.add(getAttribute(schema, allowUnknownElements, valueStr, woidBuffer,
              ERR_ATTR_SYNTAX_DCR_UNKNOWN_REQUIRED_ATTR));
        }
        requiredAttributes.addAll(attrs);
@@ -582,29 +548,10 @@
          {
            StringBuilder woidBuffer = new StringBuilder();
            pos = readWOID(lowerStr, woidBuffer, (pos));
            attrs.add(getAttribute(schema, allowUnknownElements, valueStr, woidBuffer,
                ERR_ATTR_SYNTAX_DCR_UNKNOWN_OPTIONAL_ATTR));
            AttributeType attr = schema.getAttributeType(woidBuffer.toString());
            if (attr == null)
            {
              // This isn't good because it means that the DIT content rule
              // allows an attribute type that we don't know anything about.
              if (allowUnknownElements)
              {
                attr = DirectoryServer.getDefaultAttributeType(
                                            woidBuffer.toString());
              }
              else
              {
                throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
                    ERR_ATTR_SYNTAX_DCR_UNKNOWN_OPTIONAL_ATTR.get(valueStr, woidBuffer));
              }
            }
            attrs.add(attr);
            // The next character must be either a dollar sign or a closing
            // parenthesis.
            // The next character must be either a dollar sign or a closing parenthesis.
            c = valueStr.charAt(pos++);
            if (c == ')')
            {
@@ -623,25 +570,8 @@
        {
          StringBuilder woidBuffer = new StringBuilder();
          pos = readWOID(lowerStr, woidBuffer, (pos-1));
          AttributeType attr = schema.getAttributeType(woidBuffer.toString());
          if (attr == null)
          {
            // This isn't good because it means that the DIT content rule allows
            // an attribute type that we don't know anything about.
            if (allowUnknownElements)
            {
              attr = DirectoryServer.getDefaultAttributeType(
                                          woidBuffer.toString());
            }
            else
            {
              throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
                  ERR_ATTR_SYNTAX_DCR_UNKNOWN_OPTIONAL_ATTR.get(valueStr, woidBuffer));
            }
          }
          attrs.add(attr);
          attrs.add(getAttribute(schema, allowUnknownElements, valueStr, woidBuffer,
              ERR_ATTR_SYNTAX_DCR_UNKNOWN_OPTIONAL_ATTR));
        }
        optionalAttributes.addAll(attrs);
@@ -661,30 +591,10 @@
          {
            StringBuilder woidBuffer = new StringBuilder();
            pos = readWOID(lowerStr, woidBuffer, (pos));
            attrs.add(getAttribute(schema, allowUnknownElements, valueStr, woidBuffer,
                ERR_ATTR_SYNTAX_DCR_UNKNOWN_PROHIBITED_ATTR));
            AttributeType attr = schema.getAttributeType(woidBuffer.toString());
            if (attr == null)
            {
              // This isn't good because it means that the DIT content rule
              // prohibits an attribute type that we don't know anything about.
              if (allowUnknownElements)
              {
                attr = DirectoryServer.getDefaultAttributeType(
                                            woidBuffer.toString());
              }
              else
              {
                throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
                    ERR_ATTR_SYNTAX_DCR_UNKNOWN_PROHIBITED_ATTR.get(
                        valueStr, woidBuffer));
              }
            }
            attrs.add(attr);
            // The next character must be either a dollar sign or a closing
            // parenthesis.
            // The next character must be either a dollar sign or a closing parenthesis.
            c = valueStr.charAt(pos++);
            if (c == ')')
            {
@@ -703,25 +613,8 @@
        {
          StringBuilder woidBuffer = new StringBuilder();
          pos = readWOID(lowerStr, woidBuffer, (pos-1));
          AttributeType attr = schema.getAttributeType(woidBuffer.toString());
          if (attr == null)
          {
            // This isn't good because it means that the DIT content rule
            // prohibits an attribute type that we don't know anything about.
            if (allowUnknownElements)
            {
              attr = DirectoryServer.getDefaultAttributeType(
                                          woidBuffer.toString());
            }
            else
            {
              throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
                  ERR_ATTR_SYNTAX_DCR_UNKNOWN_PROHIBITED_ATTR.get(valueStr, woidBuffer));
            }
          }
          attrs.add(attr);
          attrs.add(getAttribute(schema, allowUnknownElements, valueStr, woidBuffer,
              ERR_ATTR_SYNTAX_DCR_UNKNOWN_PROHIBITED_ATTR));
        }
        prohibitedAttributes.addAll(attrs);
@@ -770,6 +663,25 @@
                              isObsolete, extraProperties);
  }
  private static AttributeType getAttribute(Schema schema, boolean allowUnknownElements, String valueStr,
      StringBuilder woidBuffer, Arg2<Object, Object> msg) throws DirectoryException
  {
    String woidString = woidBuffer.toString();
    AttributeType attr = schema.getAttributeType(woidString);
    if (attr == null)
    {
      // This isn't good because it means that the DIT content rule
      // refers to an attribute type that we don't know anything about.
      if (!allowUnknownElements)
      {
        throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
            msg.get(valueStr, woidString));
      }
      attr = DirectoryServer.getDefaultAttributeType(woidString);
    }
    return attr;
  }
  /**
   * Reads the next token name from the DIT content rule definition, skipping
   * over any leading or trailing spaces, and appends it to the provided buffer.
opendj-server-legacy/src/main/java/org/opends/server/schema/MatchingRuleUseSyntax.java
@@ -395,29 +395,9 @@
          {
            StringBuilder woidBuffer = new StringBuilder();
            pos = readWOID(lowerStr, woidBuffer, (pos));
            attrs.add(getAttributeType(schema, allowUnknownElements, oid, woidBuffer));
            AttributeType attr = schema.getAttributeType(woidBuffer.toString());
            if (attr == null)
            {
              // This isn't good because it means that the matching rule use
              // specifies an attribute type that we don't know anything about.
              if (allowUnknownElements)
              {
                attr = DirectoryServer.getDefaultAttributeType(
                                            woidBuffer.toString());
              }
              else
              {
                throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
                    ERR_ATTR_SYNTAX_MRUSE_UNKNOWN_ATTR.get(oid, woidBuffer));
              }
            }
            attrs.add(attr);
            // The next character must be either a dollar sign or a closing
            // parenthesis.
            // The next character must be either a dollar sign or a closing parenthesis.
            c = valueStr.charAt(pos++);
            if (c == ')')
            {
@@ -436,25 +416,7 @@
        {
          StringBuilder woidBuffer = new StringBuilder();
          pos = readWOID(lowerStr, woidBuffer, (pos-1));
          AttributeType attr = schema.getAttributeType(woidBuffer.toString());
          if (attr == null)
          {
            // This isn't good because it means that the matching rule use
            // specifies an attribute type that we don't know anything about.
            if (allowUnknownElements)
            {
              attr = DirectoryServer.getDefaultAttributeType(
                                          woidBuffer.toString());
            }
            else
            {
              throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
                  ERR_ATTR_SYNTAX_MRUSE_UNKNOWN_ATTR.get(oid, woidBuffer));
            }
          }
          attrs.add(attr);
          attrs.add(getAttributeType(schema, allowUnknownElements, oid, woidBuffer));
        }
        attributes = new LinkedHashSet<>(attrs);
@@ -486,6 +448,25 @@
                               extraProperties);
  }
  private static AttributeType getAttributeType(
      Schema schema, boolean allowUnknownElements, String oid, StringBuilder woidBuffer) throws DirectoryException
  {
    String woidString = woidBuffer.toString();
    AttributeType attr = schema.getAttributeType(woidString);
    if (attr == null)
    {
      // This isn't good because it means that the matching rule use
      // refers to an attribute type that we don't know anything about.
      if (!allowUnknownElements)
      {
        throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
            ERR_ATTR_SYNTAX_MRUSE_UNKNOWN_ATTR.get(oid, woidString));
      }
      attr = DirectoryServer.getDefaultAttributeType(woidString);
    }
    return attr;
  }
  /**
   * Reads the next token name from the matching rule use definition, skipping
   * over any leading or trailing spaces, and appends it to the provided buffer.
opendj-server-legacy/src/main/java/org/opends/server/schema/NameFormSyntax.java
@@ -36,6 +36,7 @@
import java.util.List;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageDescriptor.Arg2;
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.schema.ObjectClassType;
@@ -432,29 +433,10 @@
          {
            StringBuilder woidBuffer = new StringBuilder();
            pos = readWOID(lowerStr, woidBuffer, (pos));
            attrs.add(getAttributeType(schema, allowUnknownElements, oid, woidBuffer,
                ERR_ATTR_SYNTAX_NAME_FORM_UNKNOWN_REQUIRED_ATTR));
            AttributeType attr = schema.getAttributeType(woidBuffer.toString());
            if (attr == null)
            {
              // This isn't good because it means that the name form requires
              // an attribute type that we don't know anything about.
              if (allowUnknownElements)
              {
                attr = DirectoryServer.getDefaultAttributeType(
                                            woidBuffer.toString());
              }
              else
              {
                throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
                    ERR_ATTR_SYNTAX_NAME_FORM_UNKNOWN_REQUIRED_ATTR.get(oid, woidBuffer));
              }
            }
            attrs.add(attr);
            // The next character must be either a dollar sign or a closing
            // parenthesis.
            // The next character must be either a dollar sign or a closing parenthesis.
            c = valueStr.charAt(pos++);
            if (c == ')')
            {
@@ -474,25 +456,8 @@
        {
          StringBuilder woidBuffer = new StringBuilder();
          pos = readWOID(lowerStr, woidBuffer, (pos-1));
          AttributeType attr = schema.getAttributeType(woidBuffer.toString());
          if (attr == null)
          {
            // This isn't good because it means that the name form requires an
            // attribute type that we don't know anything about.
            if (allowUnknownElements)
            {
              attr = DirectoryServer.getDefaultAttributeType(
                                          woidBuffer.toString());
            }
            else
            {
              throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
                  ERR_ATTR_SYNTAX_NAME_FORM_UNKNOWN_REQUIRED_ATTR.get(oid, woidBuffer));
            }
          }
          attrs.add(attr);
          attrs.add(getAttributeType(schema, allowUnknownElements, oid, woidBuffer,
              ERR_ATTR_SYNTAX_NAME_FORM_UNKNOWN_REQUIRED_ATTR));
        }
        requiredAttributes.addAll(attrs);
@@ -512,29 +477,10 @@
          {
            StringBuilder woidBuffer = new StringBuilder();
            pos = readWOID(lowerStr, woidBuffer, (pos));
            attrs.add(getAttributeType(schema, allowUnknownElements, oid, woidBuffer,
                ERR_ATTR_SYNTAX_NAME_FORM_UNKNOWN_OPTIONAL_ATTR));
            AttributeType attr = schema.getAttributeType(woidBuffer.toString());
            if (attr == null)
            {
              // This isn't good because it means that the name form allows an
              // attribute type that we don't know anything about.
              if (allowUnknownElements)
              {
                attr = DirectoryServer.getDefaultAttributeType(
                                            woidBuffer.toString());
              }
              else
              {
                throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
                    ERR_ATTR_SYNTAX_NAME_FORM_UNKNOWN_OPTIONAL_ATTR.get(oid, woidBuffer));
              }
            }
            attrs.add(attr);
            // The next character must be either a dollar sign or a closing
            // parenthesis.
            // The next character must be either a dollar sign or a closing parenthesis.
            c = valueStr.charAt(pos++);
            if (c == ')')
            {
@@ -554,25 +500,8 @@
        {
          StringBuilder woidBuffer = new StringBuilder();
          pos = readWOID(lowerStr, woidBuffer, (pos-1));
          AttributeType attr = schema.getAttributeType(woidBuffer.toString());
          if (attr == null)
          {
            // This isn't good because it means that the name form allows an
            // attribute type that we don't know anything about.
            if (allowUnknownElements)
            {
              attr = DirectoryServer.getDefaultAttributeType(
                                          woidBuffer.toString());
            }
            else
            {
              throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
                  ERR_ATTR_SYNTAX_NAME_FORM_UNKNOWN_OPTIONAL_ATTR.get(oid, woidBuffer));
            }
          }
          attrs.add(attr);
          attrs.add(getAttributeType(schema, allowUnknownElements, oid, woidBuffer,
              ERR_ATTR_SYNTAX_NAME_FORM_UNKNOWN_OPTIONAL_ATTR));
        }
        optionalAttributes.addAll(attrs);
@@ -606,6 +535,25 @@
                        optionalAttributes, extraProperties);
  }
  private static AttributeType getAttributeType(Schema schema, boolean allowUnknownElements, String oid,
      StringBuilder woidBuffer, Arg2<Object, Object> msg) throws DirectoryException
  {
    String woidString = woidBuffer.toString();
    AttributeType attr = schema.getAttributeType(woidString);
    if (attr == null)
    {
      // This isn't good because it means that the name form
      // refers to an attribute type that we don't know anything about.
      if (!allowUnknownElements)
      {
        throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
            msg.get(oid, woidString));
      }
      attr = DirectoryServer.getDefaultAttributeType(woidString);
    }
    return attr;
  }
  /**
   * Reads the next token name from the name form definition, skipping over any
   * leading or trailing spaces, and appends it to the provided buffer.
opendj-server-legacy/src/main/java/org/opends/server/schema/ObjectClassSyntax.java
@@ -40,6 +40,7 @@
import java.util.Set;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageDescriptor.Arg2;
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.schema.ObjectClassType;
@@ -561,32 +562,10 @@
          {
            StringBuilder woidBuffer = new StringBuilder();
            pos = readWOID(lowerStr, woidBuffer, (pos));
            attrs.add(getAttributeType(schema, allowUnknownElements, oid, woidBuffer,
                WARN_ATTR_SYNTAX_OBJECTCLASS_UNKNOWN_REQUIRED_ATTR));
            AttributeType attr = schema.getAttributeType(woidBuffer.toString());
            if (attr == null)
            {
              if (allowUnknownElements)
              {
                attr = DirectoryServer.getDefaultAttributeType(
                                            woidBuffer.toString());
              }
              else
              {
                // This isn't good because it means that the objectclass
                // requires an attribute type that we don't know anything about.
                LocalizableMessage message =
                    WARN_ATTR_SYNTAX_OBJECTCLASS_UNKNOWN_REQUIRED_ATTR.
                      get(oid, woidBuffer);
                throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
                                             message);
              }
            }
            attrs.add(attr);
            // The next character must be either a dollar sign or a closing
            // parenthesis.
            // The next character must be either a dollar sign or a closing parenthesis.
            c = valueStr.charAt(pos++);
            if (c == ')')
            {
@@ -605,28 +584,8 @@
        {
          StringBuilder woidBuffer = new StringBuilder();
          pos = readWOID(lowerStr, woidBuffer, (pos-1));
          AttributeType attr = schema.getAttributeType(woidBuffer.toString());
          if (attr == null)
          {
            if (allowUnknownElements)
            {
              attr = DirectoryServer.getDefaultAttributeType(
                                          woidBuffer.toString());
            }
            else
            {
              // This isn't good because it means that the objectclass requires
              // an attribute type that we don't know anything about.
              LocalizableMessage message =
                  WARN_ATTR_SYNTAX_OBJECTCLASS_UNKNOWN_REQUIRED_ATTR.
                    get(oid, woidBuffer);
              throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
                                           message);
            }
          }
          attrs.add(attr);
          attrs.add(getAttributeType(schema, allowUnknownElements, oid, woidBuffer,
              WARN_ATTR_SYNTAX_OBJECTCLASS_UNKNOWN_REQUIRED_ATTR));
        }
        requiredAttributes.addAll(attrs);
@@ -646,32 +605,10 @@
          {
            StringBuilder woidBuffer = new StringBuilder();
            pos = readWOID(lowerStr, woidBuffer, (pos));
            attrs.add(getAttributeType(schema, allowUnknownElements, oid, woidBuffer,
                WARN_ATTR_SYNTAX_OBJECTCLASS_UNKNOWN_OPTIONAL_ATTR));
            AttributeType attr = schema.getAttributeType(woidBuffer.toString());
            if (attr == null)
            {
              if (allowUnknownElements)
              {
                attr = DirectoryServer.getDefaultAttributeType(
                                            woidBuffer.toString());
              }
              else
              {
                // This isn't good because it means that the objectclass allows
                // an attribute type that we don't know anything about.
                LocalizableMessage message =
                  WARN_ATTR_SYNTAX_OBJECTCLASS_UNKNOWN_OPTIONAL_ATTR.
                      get(oid, woidBuffer);
                throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
                                             message);
              }
            }
            attrs.add(attr);
            // The next character must be either a dollar sign or a closing
            // parenthesis.
            // The next character must be either a dollar sign or a closing parenthesis.
            c = valueStr.charAt(pos++);
            if (c == ')')
            {
@@ -690,28 +627,8 @@
        {
          StringBuilder woidBuffer = new StringBuilder();
          pos = readWOID(lowerStr, woidBuffer, (pos-1));
          AttributeType attr = schema.getAttributeType(woidBuffer.toString());
          if (attr == null)
          {
            if (allowUnknownElements)
            {
              attr = DirectoryServer.getDefaultAttributeType(
                                          woidBuffer.toString());
            }
            else
            {
              // This isn't good because it means that the objectclass allows an
              // attribute type that we don't know anything about.
              LocalizableMessage message =
                WARN_ATTR_SYNTAX_OBJECTCLASS_UNKNOWN_OPTIONAL_ATTR.
                    get(oid, woidBuffer);
              throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
                                           message);
            }
          }
          attrs.add(attr);
          attrs.add(getAttributeType(schema, allowUnknownElements, oid, woidBuffer,
              WARN_ATTR_SYNTAX_OBJECTCLASS_UNKNOWN_OPTIONAL_ATTR));
        }
        optionalAttributes.addAll(attrs);
@@ -806,6 +723,25 @@
                           extraProperties);
  }
  private static AttributeType getAttributeType(Schema schema, boolean allowUnknownElements, String oid,
      StringBuilder woidBuffer, Arg2<Object, Object> msg) throws DirectoryException
  {
    String woidString = woidBuffer.toString();
    AttributeType attr = schema.getAttributeType(woidString);
    if (attr == null)
    {
      // This isn't good because it means that the objectclass
      // refers to an attribute type that we don't know anything about.
      if (!allowUnknownElements)
      {
        LocalizableMessage message = msg.get(oid, woidString);
        throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message);
      }
      attr = DirectoryServer.getDefaultAttributeType(woidString);
    }
    return attr;
  }
  /**
   * Reads the next token name from the objectclass definition, skipping over
   * any leading or trailing spaces, and appends it to the provided buffer.
opendj-server-legacy/src/main/java/org/opends/server/tasks/ExportTask.java
@@ -479,8 +479,7 @@
      }
    }
    // If we got here the task either completed successfully or
    // was interrupted
    // If we got here the task either completed successfully or was interrupted
    return getFinalTaskState();
  }
@@ -493,14 +492,7 @@
    HashSet<AttributeType> attributes = new HashSet<>();
    for (String attrName : attributeStrings)
    {
      String lowerName = attrName.toLowerCase();
      AttributeType attrType = DirectoryServer.getAttributeType(lowerName);
      if (attrType == null)
      {
        attrType = DirectoryServer.getDefaultAttributeType(attrName);
      }
      attributes.add(attrType);
      attributes.add(DirectoryServer.getAttributeType(attrName.toLowerCase(), attrName));
    }
    return attributes;
  }
opendj-server-legacy/src/main/java/org/opends/server/tasks/ImportTask.java
@@ -834,14 +834,7 @@
    final HashSet<AttributeType> attrTypes = new HashSet<>(attrNames.size());
    for (String attrName : attrNames)
    {
      String lowerName = attrName.toLowerCase();
      AttributeType attrType = DirectoryServer.getAttributeType(lowerName);
      if (attrType == null)
      {
        attrType = DirectoryServer.getDefaultAttributeType(attrName);
      }
      attrTypes.add(attrType);
      attrTypes.add(DirectoryServer.getAttributeType(attrName.toLowerCase(), attrName));
    }
    return attrTypes;
  }
opendj-server-legacy/src/main/java/org/opends/server/tools/ExportLDIF.java
@@ -579,14 +579,8 @@
      excludeAttributes = new HashSet<>();
      for (String attrName : excludeAttributeStrings.getValues())
      {
        String        lowerName = attrName.toLowerCase();
        AttributeType attrType  = DirectoryServer.getAttributeType(lowerName);
        if (attrType == null)
        {
          attrType = DirectoryServer.getDefaultAttributeType(attrName);
        }
        excludeAttributes.add(attrType);
        excludeAttributes.add(
            DirectoryServer.getAttributeType(attrName.toLowerCase(), attrName));
      }
    }
@@ -600,14 +594,8 @@
      includeAttributes = new HashSet<>();
      for (String attrName : includeAttributeStrings.getValues())
      {
        String        lowerName = attrName.toLowerCase();
        AttributeType attrType  = DirectoryServer.getAttributeType(lowerName);
        if (attrType == null)
        {
          attrType = DirectoryServer.getDefaultAttributeType(attrName);
        }
        includeAttributes.add(attrType);
        includeAttributes.add(
            DirectoryServer.getAttributeType(attrName.toLowerCase(), attrName));
      }
    }
opendj-server-legacy/src/main/java/org/opends/server/tools/ImportLDIF.java
@@ -772,13 +772,7 @@
        }
        else
        {
          AttributeType attrType  = DirectoryServer.getAttributeType(lowerName);
          if (attrType == null)
          {
            attrType = DirectoryServer.getDefaultAttributeType(attrName);
          }
          excludeAttributes.add(attrType);
          excludeAttributes.add(DirectoryServer.getAttributeType(lowerName, attrName));
        }
      }
    }
@@ -806,13 +800,7 @@
        }
        else
        {
          AttributeType attrType  = DirectoryServer.getAttributeType(lowerName);
          if (attrType == null)
          {
            attrType = DirectoryServer.getDefaultAttributeType(attrName);
          }
          includeAttributes.add(attrType);
          includeAttributes.add(DirectoryServer.getAttributeType(lowerName, attrName));
        }
      }
    }
opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java
@@ -1020,13 +1020,7 @@
   */
  private static AttributeType getAttributeType(String attributeName)
  {
    String lc = toLowerCase(attributeName);
    AttributeType type = DirectoryServer.getAttributeType(lc);
    if (type == null)
    {
      type = DirectoryServer.getDefaultAttributeType(attributeName);
    }
    return type;
    return DirectoryServer.getAttributeType(toLowerCase(attributeName), attributeName);
  }
  /** The attribute type for this attribute. */
opendj-server-legacy/src/main/java/org/opends/server/types/Attributes.java
@@ -410,8 +410,6 @@
    return builder.toAttribute();
  }
  /**
   * Gets the named attribute type, creating a default attribute if
   * necessary.
@@ -423,13 +421,6 @@
   */
  private static AttributeType getAttributeType(String attributeName)
  {
    String lc = toLowerCase(attributeName);
    AttributeType type = DirectoryServer.getAttributeType(lc);
    if (type == null)
    {
      type = DirectoryServer.getDefaultAttributeType(attributeName);
    }
    return type;
    return DirectoryServer.getAttributeType(toLowerCase(attributeName), attributeName);
  }
}
opendj-server-legacy/src/main/java/org/opends/server/types/DN.java
@@ -650,21 +650,8 @@
      {
        StringBuilder lowerName = new StringBuilder();
        toLowerCase(attributeName, lowerName, true);
        AttributeType attrType  =
             DirectoryServer.getAttributeType(lowerName.toString());
        String attributeNameString = attributeName.toString();
        if (attrType == null)
        {
          // This must be an attribute type that we don't know about.
          // In that case, we'll create a new attribute using the
          // default syntax.  If this is a problem, it will be caught
          // later either by not finding the target entry or by not
          // allowing the entry to be added.
          attrType = DirectoryServer.getDefaultAttributeType(
              attributeNameString);
        }
        AttributeType attrType = getAttributeType(lowerName.toString(), attributeNameString);
        rdnComponents.add(
            new RDN(attrType, attributeNameString, ByteString.empty()));
        return new DN(rdnComponents);
@@ -883,8 +870,6 @@
    }
  }
  /**
   * Decodes the provided string as a DN.
   *
@@ -1004,19 +989,7 @@
      {
        String        name      = attributeName.toString();
        String        lowerName = toLowerCase(name);
        AttributeType attrType  =
             DirectoryServer.getAttributeType(lowerName);
        if (attrType == null)
        {
          // This must be an attribute type that we don't know about.
          // In that case, we'll create a new attribute using the
          // default syntax.  If this is a problem, it will be caught
          // later either by not finding the target entry or by not
          // allowing the entry to be added.
          attrType = DirectoryServer.getDefaultAttributeType(name);
        }
        AttributeType attrType = getAttributeType(lowerName, name);
        rdnComponents.add(new RDN(attrType, name, ByteString.empty()));
        return new DN(rdnComponents);
      }
@@ -1030,18 +1003,7 @@
      // Create the new RDN with the provided information.
      String name            = attributeName.toString();
      String lowerName       = toLowerCase(name);
      AttributeType attrType =
           DirectoryServer.getAttributeType(lowerName);
      if (attrType == null)
      {
        // This must be an attribute type that we don't know about.
        // In that case, we'll create a new attribute using the
        // default syntax.  If this is a problem, it will be caught
        // later either by not finding the target entry or by not
        // allowing the entry to be added.
        attrType = DirectoryServer.getDefaultAttributeType(name);
      }
      AttributeType attrType = getAttributeType(lowerName, name);
      RDN rdn = new RDN(attrType, name, parsedValue.toByteString());
@@ -1241,7 +1203,20 @@
    }
  }
  private static AttributeType getAttributeType(String lowerName, String name)
  {
    AttributeType attrType = DirectoryServer.getAttributeType(lowerName);
    if (attrType == null)
    {
      // This must be an attribute type that we don't know about.
      // In that case, we'll create a new attribute using the
      // default syntax.  If this is a problem, it will be caught
      // later either by not finding the target entry or by not
      // allowing the entry to be added.
      attrType = DirectoryServer.getDefaultAttributeType(name);
    }
    return attrType;
  }
  /**
   * Parses an attribute name from the provided DN string starting at
opendj-server-legacy/src/main/java/org/opends/server/types/SearchFilter.java
@@ -793,19 +793,8 @@
      attributeOptions.add(attrType.substring(semicolonPos+1));
    }
    // Get the attribute type for the specified name.
    AttributeType attributeType =
         DirectoryServer.getAttributeType(lowerType.toString());
    if (attributeType == null)
    {
      String typeStr = attrType.substring(0, lowerType.length());
      attributeType =
           DirectoryServer.getDefaultAttributeType(typeStr);
    }
    // Get the attribute value.
    AttributeType attributeType = getAttributeType(attrType, lowerType);
    String valueStr = filterString.substring(equalPos+1, endPos);
    if (valueStr.length() == 0)
    {
@@ -1840,15 +1829,7 @@
      // Get the attribute type for the specified name.
      attributeType =
           DirectoryServer.getAttributeType(lowerType.toString());
      if (attributeType == null)
      {
        String typeStr = attrType.substring(0, lowerType.length());
        attributeType =
             DirectoryServer.getDefaultAttributeType(typeStr);
      }
      attributeType = getAttributeType(attrType, lowerType);
      // If there is anything left, then it should be ":dn" and/or ":"
      // followed by the matching rule ID.
@@ -2072,7 +2053,16 @@
                            dnAttributes);
  }
  private static AttributeType getAttributeType(String attrType, StringBuilder lowerType)
  {
    AttributeType attributeType = DirectoryServer.getAttributeType(lowerType.toString());
    if (attributeType == null)
    {
      String typeStr = attrType.substring(0, lowerType.length());
      attributeType = DirectoryServer.getDefaultAttributeType(typeStr);
    }
    return attributeType;
  }
  /**
   * Retrieves the filter type for this search filter.
opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java
@@ -839,13 +839,7 @@
    }
    else
    {
      AttributeType attrType = DirectoryServer.getAttributeType(lowerName);
      if (attrType == null)
      {
        attrType = DirectoryServer.getDefaultAttributeType(attrName);
      }
      AttributeType attrType = DirectoryServer.getAttributeType(lowerName, attrName);
      if (! importConfig.includeAttribute(attrType))
      {
        if (logger.isTraceEnabled())
opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/TargetAttrTestCase.java
@@ -412,10 +412,7 @@
  {
    EnumTargetOperator op = EnumTargetOperator.createOperator(eqOperator);
    TargetAttr targetAttr = TargetAttr.decode(op, targetAttrString);
    AttributeType attrType = DirectoryServer.getAttributeType(attribute);
    if (attrType == null) {
      attrType = DirectoryServer.getDefaultAttributeType(attribute);
    }
    AttributeType attrType = DirectoryServer.getAttributeType(attribute, true);
    assertEquals(TargetAttr.isApplicable(attrType, targetAttr), expectedResult);
  }
}
opendj-server-legacy/src/test/java/org/opends/server/plugins/ReferentialIntegrityPluginTestCase.java
@@ -1067,21 +1067,8 @@
    getRootConnection().processModify(dn, mods);
  }
  /**
   * Return the attribute type corresponding to the attribute type string.
   *
   * @param attrTypeString  The attribute type string name.
   *
   * @return  An attribute type object pertaining to the string.
   *
   */
  private AttributeType getAttrType(String attrTypeString) {
    AttributeType attrType = DirectoryServer.getAttributeType(attrTypeString);
    if (attrType == null)
    {
      attrType = DirectoryServer.getDefaultAttributeType(attrTypeString);
    }
    return attrType;
    return DirectoryServer.getAttributeType(attrTypeString, true);
  }
  private void deleteEntries(String... dns) throws Exception{
@@ -1092,8 +1079,6 @@
    }
  }
  private void deleteSubtree(String... dns) throws Exception
  {
    Control control = new SubtreeDeleteControl(true);
opendj-server-legacy/src/test/java/org/opends/server/plugins/UniqueAttributePluginTestCase.java
@@ -815,21 +815,8 @@
        Attributes.create(attrName, attrValues)));
  }
  /**
   * Return the attribute type corresponding to the attribute type string.
   *
   * @param attrTypeString  The attribute type string name.
   *
   * @return  An attribute type object pertaining to the string.
   */
  private AttributeType getAttrType(String attrTypeString) {
        AttributeType attrType =
            DirectoryServer.getAttributeType(attrTypeString);
    if (attrType == null)
    {
      attrType = DirectoryServer.getDefaultAttributeType(attrTypeString);
    }
    return attrType;
    return DirectoryServer.getAttributeType(attrTypeString, true);
  }
  /**