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

Jean-Noël Rouvignac
17.11.2015 14f94c13789b8ace4eae258b5f1d64494518f9c3
Remove null checks on returned values of Entry.get*Attribute*() methods.

TODO CryptoManagerSync.modifyEntry()

Entry.java:
In get*Attribute*(), made sure the methods never return null.
Removed unused methods

*.java:
Removed now unnecessary null checks
87 files modified
2169 ■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyEntryTask.java 3 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java 14 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/admin/AdministrationDataSync.java 10 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/admin/server/ServerManagementContext.java 11 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/api/AuthenticationPolicy.java 7 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/api/AuthenticationPolicyState.java 40 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/api/ClientConnection.java 16 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciHandler.java 14 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciList.java 16 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/BackupBackend.java 9 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java 12 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/TrustStoreBackend.java 4 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/AttributeIndex.java 14 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VLVIndex.java 10 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/task/RecurringTask.java 150 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/task/Task.java 10 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskScheduler.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/config/ConfigEntry.java 9 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/PasswordPolicyState.java 71 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/SchemaConfigManager.java 3 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/SubentryPasswordPolicy.java 26 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/crypto/CryptoManagerSync.java 44 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/extensions/AttributeValuePasswordValidator.java 20 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/extensions/DynamicGroup.java 25 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/extensions/ExternalSASLMechanismHandler.java 22 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java 48 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/extensions/SMTPAccountStatusNotificationHandler.java 21 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/extensions/StaticGroup.java 12 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/extensions/UserAttributeNotificationMessageTemplateElement.java 25 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/extensions/VirtualStaticGroup.java 27 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/plugins/EntryUUIDPlugin.java 3 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/plugins/PasswordPolicyImportPlugin.java 18 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/plugins/ReferentialIntegrityPlugin.java 21 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/plugins/SevenBitCleanPlugin.java 6 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/plugins/UniqueAttributePlugin.java 66 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/EntryHistorical.java 13 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/FractionalLDIFImportPlugin.java 16 ●●●●● 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/replication/plugin/PersistentServerState.java 6 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tasks/AddSchemaFileTask.java 13 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tasks/BackupTask.java 44 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tasks/DisconnectClientTask.java 21 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tasks/SetGenerationIdTask.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tasks/ShutdownTask.java 4 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tasks/TaskUtils.java 23 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/tasks/TaskEntry.java 7 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java 170 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/SearchFilter.java 40 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/SubEntry.java 54 ●●●● 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/LocalBackendBindOperation.java 5 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendCompareOperation.java 3 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendModifyOperation.java 7 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/TestCaseUtils.java 6 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/AciTestCase.java 5 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/backends/ChangelogBackendTestCase.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/TestDnKeyFormat.java 8 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/core/AddOperationTestCase.java 15 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/core/ModifyOperationTestCase.java 29 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/core/SearchOperationTestCase.java 12 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/core/SubentryManagerTestCase.java 5 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/core/TestModifyDNOperation.java 5 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryDNVirtualAttributeProviderTestCase.java 11 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryUUIDVirtualAttributeProviderTestCase.java 14 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/GoverningStructureRuleVirtualAttributeProviderTestCase.java 4 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/HasSubordinatesVirtualAttributeProviderTestCase.java 4 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/NumSubordinatesVirtualAttributeProviderTestCase.java 4 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/PasswordExpirationTimeVirtualAttributeProviderTestCase.java 1 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/StructuralObjectClassVirtualAttributeProviderTestCase.java 4 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/SubschemaSubentryVirtualAttributeProviderTestCase.java 4 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/UserDefinedVirtualAttributeProviderTestCase.java 26 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/plugins/EntryUUIDPluginTestCase.java 13 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/plugins/LDAPADListPluginTestCase.java 12 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/plugins/LastModPluginTestCase.java 20 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/plugins/SambaPasswordPluginTestCase.java 17 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/UpdateOperationTest.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/AssuredReplicationPluginTest.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/AttrHistoricalMultipleTest.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/AttrHistoricalSingleTest.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/FractionalReplicationTest.java 32 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ModifyConflictTest.java 30 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/NamingConflictTest.java 5 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/schema/GenericSchemaTestCase.java 27 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/tasks/DummyTask.java 8 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/tools/LDIFSearchTestCase.java 77 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/tools/makeldif/MakeLDIFTestCase.java 34 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/types/TestEntry.java 478 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyEntryTask.java
@@ -637,8 +637,6 @@
  private static boolean find(List<org.opends.server.types.Attribute> attrs, String attrName)
  {
    if (attrs != null)
    {
      for (org.opends.server.types.Attribute attr : attrs)
      {
        if (attr.getNameWithOptions().equalsIgnoreCase(attrName))
@@ -646,7 +644,6 @@
          return true;
        }
      }
    }
    return false;
  }
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java
@@ -44,6 +44,10 @@
import javax.swing.JLabel;
import javax.swing.tree.TreePath;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.schema.ObjectClassType;
import org.forgerock.opendj.ldap.schema.Syntax;
import org.opends.guitools.controlpanel.datamodel.BinaryValue;
import org.opends.guitools.controlpanel.datamodel.CustomSearchResult;
import org.opends.guitools.controlpanel.datamodel.ObjectClassValue;
@@ -52,15 +56,11 @@
import org.opends.guitools.controlpanel.event.LDAPEntryChangedListener;
import org.opends.guitools.controlpanel.ui.nodes.BasicNode;
import org.opends.guitools.controlpanel.util.Utilities;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.ldap.schema.Syntax;
import org.opends.server.schema.SchemaConstants;
import org.opends.server.types.AttributeType;
import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.types.Attributes;
import org.opends.server.types.Entry;
import org.opends.server.types.ObjectClass;
import org.forgerock.opendj.ldap.schema.ObjectClassType;
import org.opends.server.types.OpenDsException;
import org.opends.server.types.RDN;
import org.opends.server.types.Schema;
@@ -316,11 +316,8 @@
    {
      String attrName = rdn.getAttributeName(i);
      ByteString value = rdn.getAttributeValue(i);
      List<org.opends.server.types.Attribute> attrs =
        entry.getAttribute(attrName.toLowerCase());
      List<org.opends.server.types.Attribute> attrs = entry.getAttribute(attrName.toLowerCase());
      boolean done = false;
      if (attrs != null)
      {
        for (org.opends.server.types.Attribute attr : attrs)
        {
          if (attr.getNameWithOptions().equals(attrName))
@@ -337,7 +334,6 @@
            break;
          }
        }
      }
      if (!done)
      {
        org.opends.server.types.Attribute attr =
opendj-server-legacy/src/main/java/org/opends/server/admin/AdministrationDataSync.java
@@ -26,6 +26,8 @@
 */
package org.opends.server.admin;
import static org.opends.server.protocols.internal.Requests.*;
import java.net.InetAddress;
import java.util.LinkedList;
import java.util.List;
@@ -48,8 +50,6 @@
import org.opends.server.types.Modification;
import org.opends.server.types.SearchResultEntry;
import static org.opends.server.protocols.internal.Requests.*;
/**
 * Check if information found in "cn=admin data" is coherent with
 * cn=config. If and inconsistency is detected, we log a warning
@@ -259,14 +259,12 @@
    AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attrName);
    List<Attribute> attrs = adminConnectorEntry.getAttribute(attrType);
    if (attrs != null)
    if (!attrs.isEmpty())
    {
      // Get the attribute value
      return attrs.get(0).iterator().next().toString();
    }
    // can not happen
    // best effort.
    // Can not happen. Best effort.
    // TODO Log an Error.
    return null;
  }
opendj-server-legacy/src/main/java/org/opends/server/admin/server/ServerManagementContext.java
@@ -44,16 +44,17 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.admin.AbsoluteInheritedDefaultBehaviorProvider;
import org.opends.server.admin.AbstractManagedObjectDefinition;
import org.opends.server.admin.AggregationPropertyDefinition;
import org.opends.server.admin.AliasDefaultBehaviorProvider;
import org.opends.server.admin.Configuration;
import org.opends.server.admin.ConfigurationClient;
import org.opends.server.admin.PropertyException;
import org.opends.server.admin.DefaultBehaviorProviderVisitor;
import org.opends.server.admin.DefinedDefaultBehaviorProvider;
import org.opends.server.admin.DefinitionDecodingException;
import org.opends.server.admin.DefinitionDecodingException.Reason;
import org.opends.server.admin.DefinitionResolver;
import org.opends.server.admin.InstantiableRelationDefinition;
import org.opends.server.admin.LDAPProfile;
@@ -61,6 +62,7 @@
import org.opends.server.admin.ManagedObjectPath;
import org.opends.server.admin.PropertyDefinition;
import org.opends.server.admin.PropertyDefinitionVisitor;
import org.opends.server.admin.PropertyException;
import org.opends.server.admin.PropertyNotFoundException;
import org.opends.server.admin.PropertyOption;
import org.opends.server.admin.Reference;
@@ -68,14 +70,12 @@
import org.opends.server.admin.RelativeInheritedDefaultBehaviorProvider;
import org.opends.server.admin.SetRelationDefinition;
import org.opends.server.admin.UndefinedDefaultBehaviorProvider;
import org.opends.server.admin.DefinitionDecodingException.Reason;
import org.opends.server.admin.std.meta.RootCfgDefn;
import org.opends.server.admin.std.server.RootCfg;
import org.opends.server.config.ConfigEntry;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeType;
import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.types.DN;
/**
@@ -871,11 +871,9 @@
    // since the attribute should have been defined.
    String attrID = LDAPProfile.getInstance().getAttributeName(d, pd);
    AttributeType type = DirectoryServer.getAttributeTypeOrDefault(attrID);
    List<Attribute> attributes = configEntry.getEntry().getAttribute(type, true);
    List<Attribute> attributes = configEntry.getEntry().getAttribute(type);
    List<ByteString> results = new LinkedList<>();
    if (attributes != null)
    {
      for (Attribute a : attributes)
      {
        for (ByteString v : a)
@@ -883,7 +881,6 @@
          results.add(v);
        }
      }
    }
    return results;
  }
opendj-server-legacy/src/main/java/org/opends/server/api/AuthenticationPolicy.java
@@ -75,11 +75,7 @@
    // First check to see if the ds-pwp-password-policy-dn is present.
    String userDNString = userEntry.getName().toString();
    AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_POLICY_DN);
    List<Attribute> attrList = userEntry.getAttribute(type);
    if (attrList != null)
    {
      for (Attribute a : attrList)
    for (Attribute a : userEntry.getAttribute(type))
      {
        if (a.isEmpty())
        {
@@ -138,7 +134,6 @@
        return policy;
      }
    }
    // The ds-pwp-password-policy-dn attribute was not present, so instead
    // search for the nearest applicable sub-entry.
opendj-server-legacy/src/main/java/org/opends/server/api/AuthenticationPolicyState.java
@@ -35,7 +35,10 @@
import org.forgerock.opendj.ldap.GeneralizedTime;
import org.forgerock.opendj.ldap.ResultCode;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.*;
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeType;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Entry;
import static org.opends.messages.CoreMessages.*;
import static org.opends.server.config.ConfigConstants.*;
@@ -106,8 +109,6 @@
      final AttributeType attributeType) throws DirectoryException
  {
    final List<Attribute> attrList = entry.getAttribute(attributeType);
    if (attrList != null)
    {
      for (final Attribute a : attrList)
      {
        if (a.isEmpty())
@@ -116,21 +117,20 @@
        }
        final String valueString = toLowerCase(a.iterator().next().toString());
        if (valueString.equals("true") || valueString.equals("yes")
            || valueString.equals("on") || valueString.equals("1"))
      if (valueString.equals("true") || valueString.equals("yes") || valueString.equals("on")
          || valueString.equals("1"))
        {
          if (logger.isTraceEnabled())
          {
            logger.trace("Attribute %s resolves to true for user entry %s",
                attributeType.getNameOrOID(), entry.getName());
          logger
              .trace("Attribute %s resolves to true for user entry %s", attributeType.getNameOrOID(), entry.getName());
          }
          return ConditionResult.TRUE;
        }
        if (valueString.equals("false") || valueString.equals("no")
            || valueString.equals("off") || valueString.equals("0"))
      if (valueString.equals("false") || valueString.equals("no") || valueString.equals("off")
          || valueString.equals("0"))
        {
          if (logger.isTraceEnabled())
          {
@@ -143,16 +143,13 @@
        if (logger.isTraceEnabled())
        {
          logger.trace("Unable to resolve value %s for attribute %s "
              + "in user entry %s as a Boolean.", valueString,
        logger.trace("Unable to resolve value %s for attribute %s " + "in user entry %s as a Boolean.", valueString,
              attributeType.getNameOrOID(), entry.getName());
        }
        final LocalizableMessage message = ERR_PWPSTATE_CANNOT_DECODE_BOOLEAN
            .get(valueString, attributeType.getNameOrOID(), entry.getName());
        throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX,
            message);
      }
      final LocalizableMessage message =
          ERR_PWPSTATE_CANNOT_DECODE_BOOLEAN.get(valueString, attributeType.getNameOrOID(), entry.getName());
      throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, message);
    }
    if (logger.isTraceEnabled())
@@ -187,10 +184,7 @@
  {
    long timeValue = -1;
    final List<Attribute> attrList = entry.getAttribute(attributeType);
    if (attrList != null)
    {
      for (final Attribute a : attrList)
    for (final Attribute a : entry.getAttribute(attributeType))
      {
        if (a.isEmpty())
        {
@@ -209,12 +203,10 @@
          final LocalizableMessage message = ERR_PWPSTATE_CANNOT_DECODE_GENERALIZED_TIME
              .get(v, attributeType.getNameOrOID(), entry.getName(), e);
          throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX,
              message, e);
        throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, message, e);
        }
        break;
      }
    }
    if (timeValue == -1 && logger.isTraceEnabled())
     {
opendj-server-legacy/src/main/java/org/opends/server/api/ClientConnection.java
@@ -1067,19 +1067,15 @@
    }
    AttributeType privType = DirectoryServer.getAttributeTypeOrNull(OP_ATTR_PRIVILEGE_NAME);
    List<Attribute> attrList = entry.getAttribute(privType);
    if (attrList != null)
    {
      for (Attribute a : attrList)
    for (Attribute a : entry.getAttribute(privType))
      {
        for (ByteString v : a)
        {
          String privName = toLowerCase(v.toString());
          // If the name of the privilege is prefixed with a minus
          // sign, then we will take away that privilege from the
          // user.  We'll handle that at the end so that we can make
          // sure it's not added back later.
        // If the name of the privilege is prefixed with a minus sign,
        // then we will take away that privilege from the user.
        // We'll handle that at the end so that we can make sure it's not added back later.
          if (privName.startsWith("-"))
          {
            privName = privName.substring(1);
@@ -1088,8 +1084,7 @@
            {
              // FIXME -- Generate an administrative alert.
              // We don't know what privilege to remove, so we'll
              // remove all of them.
            // We don't know what privilege to remove, so we'll remove all of them.
              newPrivileges.clear();
              return newPrivileges;
            }
@@ -1112,7 +1107,6 @@
          }
        }
      }
    }
    newPrivileges.removeAll(removePrivileges);
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciHandler.java
@@ -717,11 +717,7 @@
          && resourceEntry.hasAttribute(modAttrType))
      {
        container.setCurrentAttributeType(modAttrType);
        List<Attribute> attrList =
            resourceEntry.getAttribute(modAttrType, modAttr.getOptions());
        if (attrList != null)
        {
          for (Attribute a : attrList)
        for (Attribute a : resourceEntry.getAttribute(modAttrType, modAttr.getOptions()))
          {
            for (ByteString v : a)
            {
@@ -734,7 +730,6 @@
            }
          }
        }
      }
      if (!modAttr.isEmpty())
      {
@@ -762,11 +757,7 @@
            break;
          case INCREMENT:
            Entry modifiedEntry = operation.getModifiedEntry();
            List<Attribute> modifiedAttrs =
                modifiedEntry.getAttribute(modAttrType, modAttr.getOptions());
            if (modifiedAttrs != null)
            {
              for (Attribute attr : modifiedAttrs)
            for (Attribute attr : modifiedEntry.getAttribute(modAttrType, modAttr.getOptions()))
              {
                for (ByteString val : attr)
                {
@@ -778,7 +769,6 @@
                  }
                }
              }
            }
            break;
          }
          /*
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciList.java
@@ -27,16 +27,20 @@
package org.opends.server.authorization.dseecompat;
import static org.opends.messages.AccessControlMessages.*;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import static org.opends.server.authorization.dseecompat.AciHandler.*;
import java.util.*;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.api.Backend;
import org.opends.server.api.DITCacheMap;
import org.opends.server.types.*;
import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.types.Attribute;
import org.opends.server.types.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.RDN;
/**
 * The AciList class performs caching of the ACI attribute values
@@ -246,8 +250,7 @@
                                         DN dn, DN configDN,
                                         List<Attribute> attributeList,
                                         List<LocalizableMessage> failedACIMsgs) {
    if (attributeList == null) {
    if (attributeList.isEmpty()) {
      return 0;
    }
@@ -306,8 +309,7 @@
      //attributes are skipped.
      if(hasGlobalAci && oldEntry.getName().equals(configDN)) {
          aciList.remove(DN.rootDN());
          List<Attribute> attributeList =
                  newEntry.getAttribute(globalAciType);
          List<Attribute> attributeList = newEntry.getAttribute(globalAciType);
          addAciAttributeList(aciList, DN.rootDN(), configDN,
                              attributeList, failedACIMsgs);
      }
opendj-server-legacy/src/main/java/org/opends/server/backends/BackupBackend.java
@@ -399,7 +399,7 @@
      AttributeType t =
          DirectoryServer.getAttributeTypeOrDefault(ATTR_BACKUP_DIRECTORY_PATH);
      List<Attribute> attrList = backupDirEntry.getAttribute(t);
      if (attrList != null && !attrList.isEmpty())
      if (!attrList.isEmpty())
      {
        for (ByteString v : attrList.get(0))
        {
@@ -851,8 +851,6 @@
  private void returnEntries(SearchOperation searchOperation, DN baseDN, SearchFilter filter, List<Attribute> attrList)
  {
    if (attrList != null && !attrList.isEmpty())
    {
      for (ByteString v : attrList.get(0))
      {
        try
@@ -879,30 +877,25 @@
        }
      }
    }
  }
  /** {@inheritDoc} */
  @Override
  public Set<String> getSupportedControls()
  {
    return Collections.emptySet();
  }
  /** {@inheritDoc} */
  @Override
  public Set<String> getSupportedFeatures()
  {
    return Collections.emptySet();
  }
  /** {@inheritDoc} */
  @Override
  public boolean supports(BackendOperation backendOperation)
  {
    return false;
  }
  /** {@inheritDoc} */
  @Override
  public void exportLDIF(LDIFExportConfig exportConfig)
         throws DirectoryException
opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
@@ -3633,11 +3633,8 @@
    // loop on the attribute types in the entry just received
    // and add them in the existing schema.
    List<Attribute> attrList = newSchemaEntry.getAttribute(attributeAttrType);
    Set<String> oidList = new HashSet<>(1000);
    if (attrList != null && !attrList.isEmpty())
    {
      for (Attribute a : attrList)
    for (Attribute a : newSchemaEntry.getAttribute(attributeAttrType))
      {
        // Look for attribute types that could have been added to the schema
        // or modified in the schema
@@ -3659,10 +3656,8 @@
          {
            // Register this attribute type in the new schema
            // unless it is already defined with the same syntax.
            AttributeType oldAttrType =
              schema.getAttributeType(attrType.getOID());
            if (oldAttrType == null ||
                !oldAttrType.toString().equals(attrType.toString()))
          AttributeType oldAttrType = schema.getAttributeType(attrType.getOID());
          if (oldAttrType == null || !oldAttrType.toString().equals(attrType.toString()))
            {
              newSchema.registerAttributeType(attrType, true);
@@ -3678,7 +3673,6 @@
          }
        }
      }
    }
    // loop on all the attribute types in the current schema and delete
    // them from the new schema if they are not in the imported schema entry.
opendj-server-legacy/src/main/java/org/opends/server/backends/TrustStoreBackend.java
@@ -80,8 +80,8 @@
import org.opends.server.core.ServerContext;
import org.opends.server.types.*;
import org.opends.server.util.CertificateManager;
import org.opends.server.util.SetupUtils;
import org.opends.server.util.Platform.KeyType;
import org.opends.server.util.SetupUtils;
/**
 * This class defines a backend used to provide an LDAP view of public keys
@@ -1225,7 +1225,7 @@
      {
        List<Attribute> certAttrs = entry.getAttribute(
             ATTR_CRYPTO_PUBLIC_KEY_CERTIFICATE);
        if (certAttrs == null)
        if (certAttrs.isEmpty())
        {
          LocalizableMessage message =
               ERR_TRUSTSTORE_ENTRY_MISSING_CERT_ATTR.get(entryDN, ATTR_CRYPTO_PUBLIC_KEY_CERTIFICATE);
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/AttributeIndex.java
@@ -119,12 +119,6 @@
      this.indexer = indexer;
    }
    void indexEntry(Entry entry, Set<ByteString> keys)
    {
      List<Attribute> attributes = entry.getAttribute(attributeType, true);
      indexAttribute(attributes, keys);
    }
    Set<ByteString> indexEntry(Entry entry)
    {
      final Set<ByteString> keys = new HashSet<>();
@@ -155,13 +149,9 @@
      }
    }
    private void indexAttribute(List<Attribute> attributes, Set<ByteString> keys)
    void indexEntry(Entry entry, Set<ByteString> keys)
    {
      if (attributes == null)
      {
        return;
      }
      for (Attribute attr : attributes)
      for (Attribute attr : entry.getAttribute(attributeType))
      {
        if (!attr.isVirtual())
        {
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VLVIndex.java
@@ -770,11 +770,8 @@
    {
      final AttributeType attributeType = sortKey.getAttributeType();
      final MatchingRule matchingRule = sortKey.getEffectiveOrderingRule();
      final List<Attribute> attrList = entry.getAttribute(attributeType);
      ByteString sortValue = null;
      if (attrList != null)
      {
        for (Attribute a : attrList)
      for (Attribute a : entry.getAttribute(attributeType))
        {
          for (ByteString v : a)
          {
@@ -793,14 +790,13 @@
            catch (final DecodeException e)
            {
              /*
               * This shouldn't happen because the attribute should have already been validated. If
               * it does then treat the value as missing.
             * This shouldn't happen because the attribute should have already been validated.
             * If it does then treat the value as missing.
               */
              continue;
            }
          }
        }
      }
      encodeVLVKeyValue(sortValue, builder, sortKey.ascending());
    }
  }
opendj-server-legacy/src/main/java/org/opends/server/backends/task/RecurringTask.java
@@ -36,6 +36,7 @@
import java.util.regex.Pattern;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageDescriptor.Arg1;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ResultCode;
@@ -151,78 +152,16 @@
    this.recurringTaskEntryDN = recurringTaskEntry.getName();
    // Get the recurring task ID from the entry.  If there isn't one, then fail.
    AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(
        ATTR_RECURRING_TASK_ID.toLowerCase(), ATTR_RECURRING_TASK_ID);
    List<Attribute> attrList = recurringTaskEntry.getAttribute(attrType);
    if (attrList == null || attrList.isEmpty())
    {
      LocalizableMessage message =
          ERR_RECURRINGTASK_NO_ID_ATTRIBUTE.get(ATTR_RECURRING_TASK_ID);
      throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message);
    }
    if (attrList.size() > 1)
    {
      LocalizableMessage message =
          ERR_RECURRINGTASK_MULTIPLE_ID_TYPES.get(ATTR_RECURRING_TASK_ID);
      throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message);
    }
    Attribute attr = attrList.get(0);
    if (attr.isEmpty())
    {
      LocalizableMessage message = ERR_RECURRINGTASK_NO_ID.get(ATTR_RECURRING_TASK_ID);
      throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message);
    }
    Iterator<ByteString> iterator = attr.iterator();
    ByteString value = iterator.next();
    if (iterator.hasNext())
    {
      LocalizableMessage message =
          ERR_RECURRINGTASK_MULTIPLE_ID_VALUES.get(ATTR_RECURRING_TASK_ID);
      throw new DirectoryException(ResultCode.OBJECTCLASS_VIOLATION, message);
    }
    recurringTaskID = value.toString();
    Attribute attr = getSingleAttribute(recurringTaskEntry, ATTR_RECURRING_TASK_ID,
        ERR_RECURRINGTASK_NO_ID_ATTRIBUTE, ERR_RECURRINGTASK_MULTIPLE_ID_TYPES, ERR_RECURRINGTASK_NO_ID);
    recurringTaskID = getSingleAttributeValue(attr,
        ResultCode.OBJECTCLASS_VIOLATION, ERR_RECURRINGTASK_MULTIPLE_ID_VALUES, ATTR_RECURRING_TASK_ID);
    // Get the schedule for this task.
    attrType = DirectoryServer.getAttributeTypeOrDefault(
        ATTR_RECURRING_TASK_SCHEDULE.toLowerCase(), ATTR_RECURRING_TASK_SCHEDULE);
    attrList = recurringTaskEntry.getAttribute(attrType);
    if (attrList == null || attrList.isEmpty())
    {
      LocalizableMessage message = ERR_RECURRINGTASK_NO_SCHEDULE_ATTRIBUTE.get(
          ATTR_RECURRING_TASK_SCHEDULE);
      throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message);
    }
    if (attrList.size() > 1)
    {
      LocalizableMessage message = ERR_RECURRINGTASK_MULTIPLE_SCHEDULE_TYPES.get(
          ATTR_RECURRING_TASK_SCHEDULE);
      throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message);
    }
    attr = attrList.get(0);
    if (attr.isEmpty())
    {
      LocalizableMessage message = ERR_RECURRINGTASK_NO_SCHEDULE_VALUES.get(
        ATTR_RECURRING_TASK_SCHEDULE);
      throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message);
    }
    iterator = attr.iterator();
    value = iterator.next();
    if (iterator.hasNext())
    {
      LocalizableMessage message = ERR_RECURRINGTASK_MULTIPLE_SCHEDULE_VALUES.get(ATTR_RECURRING_TASK_SCHEDULE);
      throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message);
    }
    String taskScheduleTab = value.toString();
    attr = getSingleAttribute(recurringTaskEntry, ATTR_RECURRING_TASK_SCHEDULE,ERR_RECURRINGTASK_NO_SCHEDULE_ATTRIBUTE,
            ERR_RECURRINGTASK_MULTIPLE_SCHEDULE_TYPES, ERR_RECURRINGTASK_NO_SCHEDULE_VALUES);
    String taskScheduleTab = getSingleAttributeValue(attr,
        ResultCode.CONSTRAINT_VIOLATION, ERR_RECURRINGTASK_MULTIPLE_SCHEDULE_VALUES, ATTR_RECURRING_TASK_SCHEDULE);
    boolean[][] taskArrays = new boolean[][]{null, null, null, null, null};
@@ -235,37 +174,10 @@
    weekdayArray = taskArrays[WEEKDAY_INDEX];
    // Get the class name from the entry.  If there isn't one, then fail.
    attrType = DirectoryServer.getAttributeTypeOrDefault(ATTR_TASK_CLASS.toLowerCase(), ATTR_TASK_CLASS);
    attrList = recurringTaskEntry.getAttribute(attrType);
    if (attrList == null || attrList.isEmpty())
    {
      LocalizableMessage message = ERR_TASKSCHED_NO_CLASS_ATTRIBUTE.get(ATTR_TASK_CLASS);
      throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message);
    }
    if (attrList.size() > 1)
    {
      LocalizableMessage message = ERR_TASKSCHED_MULTIPLE_CLASS_TYPES.get(ATTR_TASK_CLASS);
      throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message);
    }
    attr = attrList.get(0);
    if (attr.isEmpty())
    {
      LocalizableMessage message = ERR_TASKSCHED_NO_CLASS_VALUES.get(ATTR_TASK_CLASS);
      throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message);
    }
    iterator = attr.iterator();
    value = iterator.next();
    if (iterator.hasNext())
    {
      LocalizableMessage message = ERR_TASKSCHED_MULTIPLE_CLASS_VALUES.get(ATTR_TASK_CLASS);
      throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message);
    }
    taskClassName = value.toString();
    attr = getSingleAttribute(recurringTaskEntry, ATTR_TASK_CLASS, ERR_TASKSCHED_NO_CLASS_ATTRIBUTE,
        ERR_TASKSCHED_MULTIPLE_CLASS_TYPES, ERR_TASKSCHED_NO_CLASS_VALUES);
    taskClassName = getSingleAttributeValue(attr,
        ResultCode.CONSTRAINT_VIOLATION, ERR_TASKSCHED_MULTIPLE_CLASS_VALUES, ATTR_TASK_CLASS);
    // Make sure that the specified class can be loaded.
@@ -316,6 +228,42 @@
    task.initializeTask();
  }
  private String getSingleAttributeValue(Attribute attr, ResultCode erorrRc, Arg1<Object> multipleAttrValueErrorMsg,
      String attrName) throws DirectoryException
  {
    Iterator<ByteString> it = attr.iterator();
    ByteString value = it.next();
    if (it.hasNext())
    {
      throw new DirectoryException(erorrRc, multipleAttrValueErrorMsg.get(attrName));
    }
    return value.toString();
  }
  private Attribute getSingleAttribute(Entry taskEntry, String attrName, Arg1<Object> noEntryErrorMsg,
      Arg1<Object> multipleEntriesErrorMsg, Arg1<Object> noAttrValueErrorMsg) throws DirectoryException
  {
    AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attrName.toLowerCase(), attrName);
    List<Attribute> attrList = taskEntry.getAttribute(attrType);
    if (attrList.isEmpty())
    {
      LocalizableMessage message = noEntryErrorMsg.get(attrName);
      throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message);
    }
    if (attrList.size() > 1)
    {
      LocalizableMessage message = multipleEntriesErrorMsg.get(attrName);
      throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message);
    }
    Attribute attr = attrList.get(0);
    if (attr.isEmpty())
    {
      LocalizableMessage message = noAttrValueErrorMsg.get(attrName);
      throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message);
    }
    return attr;
  }
  /**
opendj-server-legacy/src/main/java/org/opends/server/backends/task/Task.java
@@ -312,7 +312,7 @@
          throws InitializationException
  {
    List<Attribute> attrList = taskEntry.getAttribute(attributeName.toLowerCase());
    if (attrList == null || attrList.isEmpty())
    if (attrList.isEmpty())
    {
      if (isRequired)
      {
@@ -361,7 +361,7 @@
  {
    LinkedList<String> valueStrings = new LinkedList<>();
    List<Attribute> attrList = taskEntry.getAttribute(attributeName.toLowerCase());
    if (attrList == null || attrList.isEmpty())
    if (attrList.isEmpty())
    {
      return valueStrings;
    }
@@ -848,14 +848,10 @@
      final List<Attribute> attrList = taskEntry.getAttribute(type);
      ByteString value = ByteString.valueOfUtf8(messageString);
      if (attrList == null)
      if (attrList.isEmpty())
      {
        taskEntry.putAttribute(type, newArrayList(Attributes.create(type, value)));
      }
      else if (attrList.isEmpty())
      {
        attrList.add(Attributes.create(type, value));
      }
      else
      {
        AttributeBuilder builder = new AttributeBuilder(attrList.get(0));
opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskScheduler.java
@@ -1803,7 +1803,7 @@
    // Get the name of the class that implements the task logic.
    AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(ATTR_TASK_CLASS.toLowerCase(), ATTR_TASK_CLASS);
    List<Attribute> attrList = entry.getAttribute(attrType);
    if (attrList == null || attrList.isEmpty())
    if (attrList.isEmpty())
    {
      LocalizableMessage message = ERR_TASKSCHED_NO_CLASS_ATTRIBUTE.get(ATTR_TASK_ID);
      throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message);
opendj-server-legacy/src/main/java/org/opends/server/config/ConfigEntry.java
@@ -193,17 +193,12 @@
   *                           interpreted as the specified type of
   *                           configuration attribute.
   */
  public ConfigAttribute getConfigAttribute(ConfigAttribute stub)
         throws ConfigException
  public ConfigAttribute getConfigAttribute(ConfigAttribute stub) throws ConfigException
  {
    String attrName = stub.getName();
    AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attrName.toLowerCase(), attrName);
    List<Attribute> attrList = entry.getAttribute(attrType);
    if (attrList != null && !attrList.isEmpty())
    {
      return stub.getConfigAttribute(attrList);
    }
    return null;
    return !attrList.isEmpty() ? stub.getConfigAttribute(attrList) : null;
  }
opendj-server-legacy/src/main/java/org/opends/server/core/PasswordPolicyState.java
@@ -199,17 +199,13 @@
  private Attribute getFirstAttributeNotEmpty(AttributeType attributeType)
  {
    List<Attribute> attrList = userEntry.getAttribute(attributeType);
    if (attrList != null)
    {
      for (Attribute a : attrList)
    for (Attribute a : userEntry.getAttribute(attributeType))
      {
        if (!a.isEmpty())
        {
          return a;
        }
      }
    }
    return null;
  }
@@ -227,10 +223,7 @@
  {
    ArrayList<Long> timeValues = new ArrayList<>();
    List<Attribute> attrList = userEntry.getAttribute(attributeType);
    if (attrList != null)
    {
      for (Attribute a : attrList)
    for (Attribute a : userEntry.getAttribute(attributeType))
      {
        for (ByteString v : a)
        {
@@ -249,7 +242,6 @@
          }
        }
      }
    }
    if (timeValues.isEmpty())
    {
@@ -1058,11 +1050,7 @@
    boolean isGeneralizedTime = SYNTAX_GENERALIZED_TIME_NAME.equals(type.getSyntax().getName());
    lastLoginTime = -1;
    List<Attribute> attrList = userEntry.getAttribute(type);
    if (attrList != null)
    {
      for (Attribute a : attrList)
    for (Attribute a : userEntry.getAttribute(type))
      {
        if (a.isEmpty())
        {
@@ -1095,8 +1083,8 @@
              if (logger.isTraceEnabled())
              {
                logger.trace("Returning last login time of %d for user %s decoded using previous last login time " +
                    "format of %s.", lastLoginTime, userDNString, f);
              logger.trace("Returning last login time of %d for user %s decoded using previous last login time "
                  + "format of %s.", lastLoginTime, userDNString, f);
              }
              return lastLoginTime;
@@ -1110,14 +1098,13 @@
          assert lastLoginTime == -1;
          if (logger.isTraceEnabled())
          {
              logger.trace("Returning -1 for user %s because the last login time value %s could not be parsed " +
                  "using any known format.", userDNString, valueString);
          logger.trace("Returning -1 for user %s because the last login time value %s could not be parsed "
              + "using any known format.", userDNString, valueString);
          }
          return lastLoginTime;
        }
      }
    }
    assert lastLoginTime == -1;
    if (logger.isTraceEnabled())
@@ -2119,9 +2106,8 @@
  {
    LinkedList<ByteString> clearPasswords = new LinkedList<>();
    List<Attribute> attrList = userEntry.getAttribute(passwordPolicy.getPasswordAttribute());
    if (attrList == null)
    final List<Attribute> attrList = userEntry.getAttribute(passwordPolicy.getPasswordAttribute());
    if (attrList.isEmpty())
    {
      return clearPasswords;
    }
@@ -2179,7 +2165,7 @@
  public boolean passwordMatches(ByteString password)
  {
    List<Attribute> attrList = userEntry.getAttribute(passwordPolicy.getPasswordAttribute());
    if (attrList == null || attrList.isEmpty())
    if (attrList.isEmpty())
    {
      if (logger.isTraceEnabled())
      {
@@ -2358,13 +2344,9 @@
    AttributeType type = passwordPolicy.getPasswordAttribute();
    List<Attribute> attrList = userEntry.getAttribute(type);
    if (attrList == null || attrList.isEmpty())
    {
      if (logger.isTraceEnabled())
    if (attrList.isEmpty())
      {
        logger.trace("Doing nothing for entry %s because no password values were found.", userDNString);
      }
      return;
    }
@@ -2597,10 +2579,7 @@
  {
    TreeMap<Long, ByteString> historyMap = new TreeMap<>();
    AttributeType historyType = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_HISTORY_LC);
    List<Attribute> attrList = userEntry.getAttribute(historyType);
    if (attrList != null)
    {
      for (Attribute a : attrList)
    for (Attribute a : userEntry.getAttribute(historyType))
      {
        for (ByteString v : a)
        {
@@ -2608,10 +2587,7 @@
          int    hashPos = histStr.indexOf('#');
          if (hashPos <= 0)
          {
            if (logger.isTraceEnabled())
            {
              logger.trace("Found value " + histStr + " in the history with no timestamp.  Marking it for removal.");
            }
          logger.trace("Found value %s in the history with no timestamp.  Marking it for removal.", histStr);
            if (removeAttrs != null)
            {
@@ -2631,8 +2607,8 @@
              if (logger.isTraceEnabled())
              {
                logger.traceException(e);
                logger.trace("Could not decode the timestamp in history value " + histStr + " -- " + e +
                    ".  Marking it for removal.");
              logger.trace("Could not decode the timestamp in history value %s -- %s.  Marking it for removal.",
                  histStr, e.getLocalizedMessage());
              }
              if (removeAttrs != null)
@@ -2643,7 +2619,6 @@
          }
        }
      }
    }
    return historyMap;
  }
@@ -2753,10 +2728,7 @@
   */
  public void updatePasswordHistory()
  {
    List<Attribute> attrList = userEntry.getAttribute(passwordPolicy.getPasswordAttribute());
    if (attrList != null)
    {
      for (Attribute a : attrList)
    for (Attribute a : userEntry.getAttribute(passwordPolicy.getPasswordAttribute()))
      {
        ByteString insecurePassword = null;
        for (ByteString v : a)
@@ -2785,14 +2757,14 @@
            }
          }
        }
        // If we get here we haven't found a password encoded securely, so we have to use one of the other values.
      // If we get here we haven't found a password encoded securely, so we have to use one of the
      // other values.
        if (insecurePassword != null)
        {
          addPasswordToHistory(insecurePassword.toString());
        }
      }
    }
  }
@@ -2926,18 +2898,13 @@
  {
    ArrayList<String> historyValues = new ArrayList<>();
    AttributeType historyType = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_HISTORY_LC);
    List<Attribute> attrList = userEntry.getAttribute(historyType);
    if (attrList != null)
    {
      for (Attribute a : attrList)
    for (Attribute a : userEntry.getAttribute(historyType))
      {
        for (ByteString v : a)
        {
          historyValues.add(v.toString());
        }
      }
    }
    return historyValues.toArray(new String[historyValues.size()]);
  }
opendj-server-legacy/src/main/java/org/opends/server/core/SchemaConfigManager.java
@@ -590,13 +590,10 @@
      List<Modification> mods, AttributeType attrType)
  {
    List<Attribute> attributes = entry.getAttribute(attrType);
    if (attributes != null && !attributes.isEmpty())
    {
      for (Attribute a : attributes)
      {
        mods.add(new Modification(ModificationType.ADD, a));
      }
    }
    return attributes;
  }
opendj-server-legacy/src/main/java/org/opends/server/core/SubentryPasswordPolicy.java
@@ -35,17 +35,17 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.opends.server.admin.std.meta.PasswordPolicyCfgDefn.*;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ResultCode;
import org.opends.server.admin.std.meta.PasswordPolicyCfgDefn.StateUpdateFailurePolicy;
import org.opends.server.admin.std.server.PasswordValidatorCfg;
import org.opends.server.api.AccountStatusNotificationHandler;
import org.opends.server.api.PasswordGenerator;
import org.opends.server.api.PasswordStorageScheme;
import org.opends.server.api.PasswordValidator;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.config.server.ConfigException;
import org.opends.server.types.*;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.ByteString;
/**
 * This class represents subentry password policy based on Password Policy for
@@ -249,10 +249,7 @@
    {
      AttributeType pwdAttrType =
          DirectoryServer.getAttributeTypeOrDefault(PWD_ATTR_VALIDATOR);
      List<Attribute> pwdAttrList = entry.getAttribute(pwdAttrType);
      if (pwdAttrList != null && !pwdAttrList.isEmpty())
      {
        for (Attribute attr : pwdAttrList)
      for (Attribute attr : entry.getAttribute(pwdAttrType))
        {
          for (ByteString val : attr)
          {
@@ -267,7 +264,6 @@
        }
      }
    }
  }
  private Boolean asBoolean(Entry entry, String attrName)
      throws DirectoryException
@@ -376,42 +372,34 @@
  private String getAttrValue(Entry entry, String pwdAttrName)
  {
    AttributeType pwdAttrType = DirectoryServer.getAttributeTypeOrDefault(pwdAttrName);
    List<Attribute> pwdAttrList = entry.getAttribute(pwdAttrType);
    if (pwdAttrList != null && !pwdAttrList.isEmpty())
    {
      for (Attribute attr : pwdAttrList)
    for (Attribute attr : entry.getAttribute(pwdAttrType))
      {
        for (ByteString value : attr)
        {
          return value.toString();
        }
      }
    }
    return null;
  }
  /** {@inheritDoc} */
  @Override
  public boolean isAllowExpiredPasswordChanges()
  {
    return getDefaultPasswordPolicy().isAllowExpiredPasswordChanges();
  }
  /** {@inheritDoc} */
  @Override
  public boolean isAllowMultiplePasswordValues()
  {
    return getDefaultPasswordPolicy().isAllowMultiplePasswordValues();
  }
  /** {@inheritDoc} */
  @Override
  public boolean isAllowPreEncodedPasswords()
  {
    return getDefaultPasswordPolicy().isAllowPreEncodedPasswords();
  }
  /** {@inheritDoc} */
  @Override
  public boolean isAllowUserPasswordChanges()
  {
opendj-server-legacy/src/main/java/org/opends/server/crypto/CryptoManagerSync.java
@@ -56,7 +56,6 @@
import org.opends.server.core.AddOperation;
import org.opends.server.core.DeleteOperation;
import org.opends.server.core.DirectoryServer;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.opends.server.protocols.internal.InternalSearchOperation;
import org.opends.server.protocols.internal.SearchRequest;
import org.opends.server.protocols.ldap.LDAPControl;
@@ -219,8 +218,6 @@
    }
  }
  /** {@inheritDoc} */
  @Override
  public void performBackendPreInitializationProcessing(Backend<?> backend)
  {
@@ -237,7 +234,6 @@
    }
  }
  /** {@inheritDoc} */
  @Override
  public void performBackendPostFinalizationProcessing(Backend<?> backend)
  {
@@ -366,25 +362,10 @@
    List<Attribute> dstList = dstEntry.getAttribute(attrCert);
    // Check for changes to the certificate value.
    boolean differ = false;
    if (srcList == null)
    if (!srcList.equals(dstList))
    {
      if (dstList != null)
      {
        differ = true;
      }
    }
    else if (dstList == null
        || srcList.size() != dstList.size()
        || !srcList.equals(dstList))
    {
      differ = true;
    }
    if (differ)
    {
      // The trust store backend does not implement modify so we need to
      // delete then add.
      // The trust store backend does not implement modify so we need to delete then add.
      // FIXME implement TrustStoreBackend.replaceEntry() as deleteEntry() + addEntry() and stop this madness
      DN dstDN = dstEntry.getName();
      deleteEntry(dstDN);
      addEntry(srcEntry, dstDN);
@@ -398,11 +379,7 @@
   */
  private static void deleteEntry(DN dstDN)
  {
    InternalClientConnection conn =
         InternalClientConnection.getRootConnection();
    DeleteOperation delOperation = conn.processDelete(dstDN);
    DeleteOperation delOperation = getRootConnection().processDelete(dstDN);
    if (delOperation.getResultCode() != ResultCode.SUCCESS)
    {
      logger.debug(INFO_TRUSTSTORESYNC_DELETE_FAILED, dstDN, delOperation.getErrorMessage());
@@ -425,29 +402,24 @@
    List<Attribute> attrList;
    attrList = srcEntry.getAttribute(attrAlias);
    if (attrList != null)
    if (!attrList.isEmpty())
    {
      userAttrs.put(attrAlias, attrList);
    }
    attrList = srcEntry.getAttribute(attrCert);
    if (attrList != null)
    if (!attrList.isEmpty())
    {
      userAttrs.put(attrCert, attrList);
    }
    Entry addEntry = new Entry(dstDN, ocMap, userAttrs, null);
    InternalClientConnection conn =
         InternalClientConnection.getRootConnection();
    AddOperation addOperation = conn.processAdd(addEntry);
    AddOperation addOperation = getRootConnection().processAdd(addEntry);
    if (addOperation.getResultCode() != ResultCode.SUCCESS)
    {
      logger.debug(INFO_TRUSTSTORESYNC_ADD_FAILED, dstDN, addOperation.getErrorMessage());
    }
  }
  /** {@inheritDoc} */
  @Override
  public PostResponse doPostResponse(PostResponseAddOperation op)
  {
@@ -502,7 +474,6 @@
    }
  }
  /** {@inheritDoc} */
  @Override
  public PostResponse doPostResponse(PostResponseDeleteOperation op)
  {
@@ -527,7 +498,6 @@
    return PostResponse.continueOperationProcessing();
  }
  /** {@inheritDoc} */
  @Override
  public PostResponse doPostResponse(PostResponseModifyOperation op)
  {
opendj-server-legacy/src/main/java/org/opends/server/extensions/AttributeValuePasswordValidator.java
@@ -135,10 +135,9 @@
    AttributeValuePasswordValidatorCfg config = currentConfig;
    // Get the string representation (both forward and reversed) for the
    // password.
    String password = newPassword.toString();
    String reversed = new StringBuilder(password).reverse().toString();
    // Get the string representation (both forward and reversed) for the password.
    final String password = newPassword.toString();
    final String reversed = new StringBuilder(password).reverse().toString();
    // Check to see if we should verify the whole password or the substrings.
    int minSubstringLength = password.length();
@@ -158,18 +157,11 @@
      matchAttributes = userEntry.getUserAttributes().keySet();
    }
    final ByteString vf = ByteString.valueOfUtf8(password);
    final ByteString vr = ByteString.valueOfUtf8(reversed);
    for (AttributeType t : matchAttributes)
    {
      List<Attribute> attrList = userEntry.getAttribute(t);
      if (attrList == null || attrList.isEmpty())
      {
        continue;
      }
      ByteString vf = ByteString.valueOfUtf8(password);
      ByteString vr = ByteString.valueOfUtf8(reversed);
      for (Attribute a : attrList)
      for (Attribute a : userEntry.getAttribute(t))
      {
        if (a.contains(vf) ||
            (config.isTestReversedPassword() && a.contains(vr)) ||
opendj-server-legacy/src/main/java/org/opends/server/extensions/DynamicGroup.java
@@ -26,8 +26,6 @@
 */
package org.opends.server.extensions;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashSet;
@@ -35,32 +33,30 @@
import java.util.Set;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.SearchScope;
import org.opends.server.admin.std.server.DynamicGroupImplementationCfg;
import org.opends.server.api.Group;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.ServerContext;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeType;
import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.types.DN;
import org.opends.server.types.DirectoryConfig;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.InitializationException;
import org.opends.server.types.LDAPURL;
import org.opends.server.types.MemberList;
import org.opends.server.types.ObjectClass;
import org.opends.server.types.SearchFilter;
import org.forgerock.opendj.ldap.SearchScope;
import static org.forgerock.util.Reject.*;
import static org.opends.messages.ExtensionMessages.*;
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.util.ServerConstants.*;
import static org.forgerock.util.Reject.*;
/**
 * This class provides a dynamic group implementation, in which
@@ -140,10 +136,7 @@
    // out the LDAP URLs that it contains.
    LinkedHashSet<LDAPURL> memberURLs = new LinkedHashSet<>();
    AttributeType memberURLType = DirectoryServer.getAttributeTypeOrDefault(ATTR_MEMBER_URL_LC);
    List<Attribute> attrList = groupEntry.getAttribute(memberURLType);
    if (attrList != null)
    {
      for (Attribute a : attrList)
    for (Attribute a : groupEntry.getAttribute(memberURLType))
      {
        for (ByteString v : a)
        {
@@ -154,9 +147,7 @@
          catch (DirectoryException de)
          {
            logger.traceException(de);
            logger.error(ERR_DYNAMICGROUP_CANNOT_DECODE_MEMBERURL, v,
                    groupEntry.getName(), de.getMessageObject());
          }
          logger.error(ERR_DYNAMICGROUP_CANNOT_DECODE_MEMBERURL, v, groupEntry.getName(), de.getMessageObject());
        }
      }
    }
opendj-server-legacy/src/main/java/org/opends/server/extensions/ExternalSASLMechanismHandler.java
@@ -30,21 +30,22 @@
import java.util.List;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.config.server.ConfigChangeResult;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ResultCode;
import org.opends.server.admin.server.ConfigurationChangeListener;
import org.opends.server.admin.std.server.ExternalSASLMechanismHandlerCfg;
import org.opends.server.admin.std.server.SASLMechanismHandlerCfg;
import org.opends.server.api.CertificateMapper;
import org.opends.server.api.ClientConnection;
import org.opends.server.api.SASLMechanismHandler;
import org.forgerock.opendj.config.server.ConfigChangeResult;
import org.forgerock.opendj.config.server.ConfigException;
import org.opends.server.core.BindOperation;
import org.opends.server.core.DirectoryServer;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.opends.server.protocols.ldap.LDAPClientConnection;
import org.opends.server.types.*;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.ByteString;
import static org.opends.messages.ExtensionMessages.*;
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.util.ServerConstants.*;
@@ -212,20 +213,17 @@
      bindOperation.setAuthFailureReason(message);
      return;
    }
    else
    {
      bindOperation.setSASLAuthUserEntry(userEntry);
    }
    // Get the userCertificate attribute from the user's entry for use in the
    // validation process.
    List<Attribute> certAttrList =
         userEntry.getAttribute(certificateAttributeType);
    List<Attribute> certAttrList = userEntry.getAttribute(certificateAttributeType);
    switch (validationPolicy)
    {
      case ALWAYS:
        if (certAttrList == null)
        if (certAttrList.isEmpty())
        {
          if (validationPolicy == CertificateValidationPolicy.ALWAYS)
          {
@@ -265,7 +263,7 @@
        break;
      case IFPRESENT:
        if (certAttrList != null)
        if (!certAttrList.isEmpty())
        {
          try
          {
opendj-server-legacy/src/main/java/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java
@@ -39,8 +39,11 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizedIllegalArgumentException;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.config.server.ConfigChangeResult;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DereferenceAliasesPolicy;
import org.forgerock.opendj.ldap.GeneralizedTime;
import org.forgerock.opendj.ldap.ModificationType;
import org.forgerock.opendj.ldap.ResultCode;
@@ -54,7 +57,6 @@
import org.opends.server.api.DirectoryThread;
import org.opends.server.api.PasswordStorageScheme;
import org.opends.server.api.TrustManagerProvider;
import org.forgerock.opendj.config.server.ConfigException;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.ModifyOperation;
import org.opends.server.core.ServerContext;
@@ -66,8 +68,6 @@
import org.opends.server.tools.LDAPWriter;
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeType;
import org.forgerock.opendj.config.server.ConfigChangeResult;
import org.forgerock.opendj.ldap.DereferenceAliasesPolicy;
import org.opends.server.types.DN;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Entry;
@@ -1611,10 +1611,7 @@
            // The bind DN is contained in an attribute in the user's entry.
            mapBind: for (final AttributeType at : cfg.getMappedAttribute())
            {
              final List<Attribute> attributes = userEntry.getAttribute(at);
              if (attributes != null && !attributes.isEmpty())
              {
                for (final Attribute attribute : attributes)
              for (final Attribute attribute : userEntry.getAttribute(at))
                {
                  if (!attribute.isEmpty())
                  {
@@ -1623,7 +1620,6 @@
                  }
                }
              }
            }
            if (username == null)
            {
@@ -1648,16 +1644,11 @@
            final LinkedList<SearchFilter> filterComponents = new LinkedList<>();
            for (final AttributeType at : cfg.getMappedAttribute())
            {
              final List<Attribute> attributes = userEntry.getAttribute(at);
              if (attributes != null && !attributes.isEmpty())
              {
                for (final Attribute attribute : attributes)
              for (final Attribute attribute : userEntry.getAttribute(at))
                {
                  for (final ByteString value : attribute)
                  {
                    filterComponents.add(SearchFilter.createEqualityFilter(at,
                        value));
                  }
                  filterComponents.add(SearchFilter.createEqualityFilter(at, value));
                }
              }
            }
@@ -1739,10 +1730,8 @@
          }
          // Now perform the bind.
          Connection connection = null;
          try
          try (Connection connection = bindFactory.getConnection())
          {
            connection = bindFactory.getConnection();
            connection.simpleBind(username, password);
            // The password matched, so cache it, it will be stored in the
@@ -1767,10 +1756,6 @@
                      userEntry.getName(), cfg.dn(), e.getMessageObject()), e);
            }
          }
          finally
          {
            StaticUtils.close(connection);
          }
        }
        finally
        {
@@ -1790,13 +1775,8 @@
        // First determine if the cached password time is present and valid.
        boolean foundValidCachedPasswordTime = false;
        List<Attribute> cptlist = userEntry
            .getAttribute(cachedPasswordTimeAttribute);
        if (cptlist != null && !cptlist.isEmpty())
        {
          foundCachedPasswordTime:
          {
            for (Attribute attribute : cptlist)
        for (Attribute attribute : userEntry.getAttribute(cachedPasswordTimeAttribute))
            {
              // Ignore any attributes with options.
              if (!attribute.hasOptions())
@@ -1819,8 +1799,6 @@
                }
              }
            }
          }
        }
        if (!foundValidCachedPasswordTime)
        {
@@ -1831,14 +1809,8 @@
        // Next determine if there is a cached password.
        ByteString cachedPassword = null;
        List<Attribute> cplist = userEntry
            .getAttribute(cachedPasswordAttribute);
        if (cplist != null && !cplist.isEmpty())
        {
          foundCachedPassword:
          {
            for (Attribute attribute : cplist)
        for (Attribute attribute : userEntry.getAttribute(cachedPasswordAttribute))
            {
              // Ignore any attributes with options.
              if (!attribute.hasOptions())
@@ -1850,8 +1822,6 @@
                }
              }
            }
          }
        }
        if (cachedPassword == null)
        {
opendj-server-legacy/src/main/java/org/opends/server/extensions/SMTPAccountStatusNotificationHandler.java
@@ -42,6 +42,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.config.server.ConfigChangeResult;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ResultCode;
@@ -56,7 +57,6 @@
import org.opends.server.types.AccountStatusNotificationType;
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeType;
import org.forgerock.opendj.config.server.ConfigChangeResult;
import org.opends.server.types.Entry;
import org.opends.server.types.InitializationException;
import org.opends.server.util.EMailMessage;
@@ -524,24 +524,16 @@
      Entry userEntry = notification.getUserEntry();
      for (AttributeType t : addressAttrs)
      {
        List<Attribute> attrList = userEntry.getAttribute(t);
        if (attrList != null)
        {
          for (Attribute a : attrList)
        for (Attribute a : userEntry.getAttribute(t))
          {
            for (ByteString v : a)
            {
              if (logger.isTraceEnabled())
              {
                logger.trace("Adding end user recipient %s from attr %s",
                    v, a.getNameWithOptions());
              }
            logger.trace("Adding end user recipient %s from attr %s", v, a.getNameWithOptions());
              recipients.add(v.toString());
            }
          }
        }
      }
      if (recipients.isEmpty())
      {
@@ -549,12 +541,7 @@
        {
          // There are no recipients at all, so there's no point in generating
          // the message.  Return without doing anything.
          if (logger.isTraceEnabled())
          {
            logger.trace("No end user recipients, and no explicit " +
                             "recipients");
          }
          logger.trace("No end user recipients, and no explicit recipients");
          return;
        }
        else
opendj-server-legacy/src/main/java/org/opends/server/extensions/StaticGroup.java
@@ -64,12 +64,12 @@
import org.opends.server.types.Modification;
import org.opends.server.types.SearchFilter;
import static org.forgerock.util.Reject.*;
import static org.opends.messages.ExtensionMessages.*;
import static org.opends.server.core.DirectoryServer.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.util.CollectionUtils.*;
import static org.opends.server.util.ServerConstants.*;
import static org.forgerock.util.Reject.*;
/**
 * A static group implementation, in which the DNs of all members are explicitly
@@ -198,16 +198,11 @@
    List<Attribute> memberAttrList = groupEntry.getAttribute(someMemberAttributeType);
    int membersCount = 0;
    if (memberAttrList != null)
    {
      for (Attribute a : memberAttrList)
      {
        membersCount += a.size();
      }
    }
    LinkedHashSet<CompactDn> someMemberDNs = new LinkedHashSet<>(membersCount);
    if (memberAttrList != null)
    {
      for (Attribute a : memberAttrList)
      {
        for (ByteString v : a)
@@ -219,9 +214,8 @@
          catch (LocalizedIllegalArgumentException e)
          {
            logger.traceException(e);
            logger.error(ERR_STATICGROUP_CANNOT_DECODE_MEMBER_VALUE_AS_DN, v,
                someMemberAttributeType.getNameOrOID(), groupEntry.getName(), e.getMessageObject());
          }
          logger.error(ERR_STATICGROUP_CANNOT_DECODE_MEMBER_VALUE_AS_DN,
              v, someMemberAttributeType.getNameOrOID(), groupEntry.getName(), e.getMessageObject());
        }
      }
    }
opendj-server-legacy/src/main/java/org/opends/server/extensions/UserAttributeNotificationMessageTemplateElement.java
@@ -26,19 +26,13 @@
 */
package org.opends.server.extensions;
import java.util.List;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.types.AccountStatusNotification;
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeType;
import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.types.Entry;
/**
 * This class implements a notification message template element that will
 * generate a value that is the value of a specified attribute from the target
@@ -50,31 +44,22 @@
  /** The attribute type for which to obtain the value. */
  private AttributeType attributeType;
  /**
   * Creates a new user DN notification message template element.
   *
   * @param  attributeType  The attribute type for which to obtain the value.
   */
  public UserAttributeNotificationMessageTemplateElement(AttributeType
                                                              attributeType)
  public UserAttributeNotificationMessageTemplateElement(AttributeType attributeType)
  {
    this.attributeType = attributeType;
  }
  /** {@inheritDoc} */
  @Override
  public void generateValue(LocalizableMessageBuilder buffer,
                            AccountStatusNotification notification)
  {
    Entry userEntry = notification.getUserEntry();
    List<Attribute> attrList = userEntry.getAttribute(attributeType);
    if (attrList != null)
    {
      for (Attribute a : attrList)
    for (Attribute a : userEntry.getAttribute(attributeType))
      {
        for (ByteString v : a)
        {
@@ -84,5 +69,3 @@
      }
    }
  }
}
opendj-server-legacy/src/main/java/org/opends/server/extensions/VirtualStaticGroup.java
@@ -26,38 +26,34 @@
 */
package org.opends.server.extensions;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
import org.opends.server.admin.std.server.VirtualStaticGroupImplementationCfg;
import org.opends.server.api.Group;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.ServerContext;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeType;
import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.DN;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Entry;
import org.opends.server.types.InitializationException;
import org.opends.server.types.MemberList;
import org.opends.server.types.ObjectClass;
import org.forgerock.opendj.ldap.ResultCode;
import org.opends.server.types.SearchFilter;
import org.forgerock.opendj.ldap.SearchScope;
import static org.forgerock.util.Reject.*;
import static org.opends.messages.ExtensionMessages.*;
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.util.ServerConstants.*;
import static org.forgerock.util.Reject.*;
/**
 * This class provides a virtual static group implementation, in which
@@ -133,10 +129,7 @@
    // Get the target group DN attribute from the entry, if there is one.
    DN targetDN = null;
    AttributeType targetType = DirectoryServer.getAttributeTypeOrDefault(ATTR_TARGET_GROUP_DN);
    List<Attribute> attrList = groupEntry.getAttribute(targetType);
    if (attrList != null)
    {
      for (Attribute a : attrList)
    for (Attribute a : groupEntry.getAttribute(targetType))
      {
        for (ByteString v : a)
        {
@@ -156,9 +149,7 @@
            LocalizableMessage message = ERR_VIRTUAL_STATIC_GROUP_CANNOT_DECODE_TARGET.
                get(v, groupEntry.getName(), de.getMessageObject());
            throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX,
                                         message, de);
          }
          throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, message, de);
        }
      }
    }
opendj-server-legacy/src/main/java/org/opends/server/plugins/EntryUUIDPlugin.java
@@ -147,7 +147,6 @@
  /** {@inheritDoc} */
  @Override
  public final PluginResult.ImportLDIF
               doLDIFImport(LDIFImportConfig importConfig, Entry entry)
@@ -155,7 +154,7 @@
    // See if the entry being imported already contains an entryUUID attribute.
    // If so, then leave it alone.
    List<Attribute> uuidList = entry.getAttribute(entryUUIDType);
    if (uuidList != null)
    if (!uuidList.isEmpty())
    {
      return PluginResult.ImportLDIF.continueEntryProcessing();
    }
opendj-server-legacy/src/main/java/org/opends/server/plugins/PasswordPolicyImportPlugin.java
@@ -38,6 +38,11 @@
import java.util.Set;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.config.server.ConfigChangeResult;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ResultCode;
import org.opends.server.admin.server.ConfigurationChangeListener;
import org.opends.server.admin.std.meta.PluginCfgDefn;
import org.opends.server.admin.std.server.PasswordPolicyImportPluginCfg;
@@ -49,17 +54,12 @@
import org.opends.server.api.plugin.DirectoryServerPlugin;
import org.opends.server.api.plugin.PluginResult;
import org.opends.server.api.plugin.PluginType;
import org.forgerock.opendj.config.server.ConfigChangeResult;
import org.forgerock.opendj.config.server.ConfigException;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.PasswordPolicy;
import org.opends.server.core.SubentryPasswordPolicy;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.opends.server.schema.AuthPasswordSyntax;
import org.opends.server.schema.UserPasswordSyntax;
import org.opends.server.types.*;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.ByteString;
/**
 * This class implements a Directory Server plugin that performs various
@@ -330,7 +330,7 @@
    // See if the entry explicitly states the password policy that it should
    // use.  If so, then only use it to perform the encoding.
    List<Attribute> attrList = entry.getAttribute(customPolicyAttribute);
    if (attrList != null)
    if (!attrList.isEmpty())
    {
      DN policyDN = null;
      PasswordPolicy policy = null;
@@ -369,7 +369,7 @@
        if (schemes != null)
        {
          attrList = entry.getAttribute(policy.getPasswordAttribute());
          if (attrList == null)
          if (attrList.isEmpty())
          {
            return PluginResult.ImportLDIF.continueEntryProcessing();
          }
@@ -455,7 +455,7 @@
    for (AttributeType t : authPasswordTypes)
    {
      attrList = entry.getAttribute(t);
      if (attrList == null || attrList.isEmpty())
      if (attrList.isEmpty())
      {
        continue;
      }
@@ -505,7 +505,7 @@
    for (AttributeType t : userPasswordTypes)
    {
      attrList = entry.getAttribute(t);
      if (attrList == null || attrList.isEmpty())
      if (attrList.isEmpty())
      {
        continue;
      }
opendj-server-legacy/src/main/java/org/opends/server/plugins/ReferentialIntegrityPlugin.java
@@ -1107,14 +1107,10 @@
    return PluginResult.PreOperation.continueOperationProcessing();
  }
  /** {@inheritDoc} */
  @Override
  public PluginResult.PreOperation doPreOperation(
    PreOperationAddOperation addOperation)
  public PluginResult.PreOperation doPreOperation(PreOperationAddOperation addOperation)
  {
    /* Skip the integrity checks if the enforcing is not enabled.
     */
    // Skip the integrity checks if the enforcing is not enabled.
    if (!currentConfiguration.isCheckReferences())
    {
      return PluginResult.PreOperation.continueOperationProcessing();
@@ -1122,9 +1118,7 @@
    final Entry entry = addOperation.getEntryToAdd();
    /* Make sure the entry belongs to one of the configured naming
     * contexts.
     */
    // Make sure the entry belongs to one of the configured naming contexts.
    DN entryDN = entry.getName();
    DN entryBaseDN = getEntryBaseDN(entryDN);
    if (entryBaseDN == null)
@@ -1135,20 +1129,13 @@
    for (AttributeType attrType : attributeTypes)
    {
      final List<Attribute> attrs = entry.getAttribute(attrType, false);
      if (attrs != null)
      {
        PluginResult.PreOperation result =
        isIntegrityMaintained(attrs, entryDN, entryBaseDN);
      PluginResult.PreOperation result = isIntegrityMaintained(attrs, entryDN, entryBaseDN);
        if (result.getResultCode() != ResultCode.SUCCESS)
        {
          return result;
        }
      }
    }
    /* If we reahed this point, everything is fine.
     */
    return PluginResult.PreOperation.continueOperationProcessing();
  }
opendj-server-legacy/src/main/java/org/opends/server/plugins/SevenBitCleanPlugin.java
@@ -140,10 +140,7 @@
    // Make sure all configured attributes have clean values.
    for (AttributeType t : config.getAttributeType())
    {
      List<Attribute> attrList = entry.getAttribute(t);
      if (attrList != null)
      {
        for (Attribute a : attrList)
      for (Attribute a : entry.getAttribute(t))
        {
          for (ByteString v : a)
          {
@@ -156,7 +153,6 @@
          }
        }
      }
    }
    // If we've gotten here, then everything is acceptable.
opendj-server-legacy/src/main/java/org/opends/server/plugins/UniqueAttributePlugin.java
@@ -42,20 +42,22 @@
import org.opends.server.admin.std.server.UniqueAttributePluginCfg;
import org.opends.server.api.AlertGenerator;
import org.opends.server.api.Backend;
import org.opends.server.api.plugin.*;
import org.opends.server.api.plugin.DirectoryServerPlugin;
import org.opends.server.api.plugin.PluginResult;
import org.opends.server.api.plugin.PluginResult.PostOperation;
import org.opends.server.api.plugin.PluginResult.PreOperation;
import org.opends.server.api.plugin.PluginType;
import org.opends.server.core.DirectoryServer;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.opends.server.protocols.internal.InternalSearchOperation;
import org.opends.server.protocols.internal.SearchRequest;
import static org.opends.server.protocols.internal.Requests.*;
import org.opends.server.schema.SchemaConstants;
import org.opends.server.types.*;
import org.opends.server.types.operation.*;
import static org.opends.messages.PluginMessages.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.protocols.internal.Requests.*;
import static org.opends.server.util.ServerConstants.*;
/**
@@ -189,15 +191,11 @@
    List<ByteString> recordedValues = new LinkedList<>();
    for (AttributeType t : config.getType())
    {
      List<Attribute> attrList = entry.getAttribute(t);
      if (attrList != null)
      {
        for (Attribute a : attrList)
      for (Attribute a : entry.getAttribute(t))
        {
          for (ByteString v : a)
          {
            PreOperation stop =
                checkUniqueness(entryDN, t, v, baseDNs, recordedValues, config);
          PreOperation stop = checkUniqueness(entryDN, t, v, baseDNs, recordedValues, config);
            if (stop != null)
            {
              return stop;
@@ -205,7 +203,6 @@
          }
        }
      }
    }
    return PluginResult.PreOperation.continueOperationProcessing();
  }
@@ -254,14 +251,8 @@
          break;
        case INCREMENT:
          // We could calculate the new value, but we'll just take it from the
          // updated entry.
          List<Attribute> attrList =
               modifyOperation.getModifiedEntry().getAttribute(t,
                                                               a.getOptions());
          if (attrList != null)
          {
            for (Attribute updatedAttr : attrList)
          // We could calculate the new value, but we'll just take it from the updated entry.
          for (Attribute updatedAttr : modifyOperation.getModifiedEntry().getAttribute(t, a.getOptions()))
            {
              if (! updatedAttr.optionsEqual(a.getOptions()))
              {
@@ -270,15 +261,13 @@
              for (ByteString v : updatedAttr)
              {
                PreOperation stop = checkUniqueness(
                    entryDN, t, v, baseDNs, recordedValues, config);
              PreOperation stop = checkUniqueness(entryDN, t, v, baseDNs, recordedValues, config);
                if (stop != null)
                {
                  return stop;
                }
              }
            }
          }
          break;
        default:
@@ -402,16 +391,11 @@
    DN entryDN = entry.getName();
    for (AttributeType t : config.getType())
    {
      List<Attribute> attrList = entry.getAttribute(t);
      if (attrList != null)
      {
        for (Attribute a : attrList)
      for (Attribute a : entry.getAttribute(t))
        {
          for (ByteString v : a)
          {
            sendAlertForUnresolvedConflict(addOperation, entryDN, entryDN, t,
                v, baseDNs, config);
          }
          sendAlertForUnresolvedConflict(addOperation, entryDN, entryDN, t, v, baseDNs, config);
        }
      }
    }
@@ -456,14 +440,8 @@
          break;
        case INCREMENT:
          // We could calculate the new value, but we'll just take it from the
          // updated entry.
          List<Attribute> attrList =
               modifyOperation.getModifiedEntry().getAttribute(t,
                                                               a.getOptions());
          if (attrList != null)
          {
            for (Attribute updatedAttr : attrList)
          // We could calculate the new value, but we'll just take it from the updated entry.
          for (Attribute updatedAttr : modifyOperation.getModifiedEntry().getAttribute(t, a.getOptions()))
            {
              if (! updatedAttr.optionsEqual(a.getOptions()))
              {
@@ -476,7 +454,6 @@
                    entryDN, t, v, baseDNs, config);
              }
            }
          }
          break;
        default:
@@ -803,10 +780,7 @@
    //Remove the attribute value from the map.
    for (AttributeType t : config.getType())
    {
      List<Attribute> attrList = entry.getAttribute(t);
      if (attrList != null)
      {
        for (Attribute a : attrList)
      for (Attribute a : entry.getAttribute(t))
        {
          for (ByteString v : a)
          {
@@ -814,7 +788,6 @@
          }
        }
      }
    }
    return PluginResult.PostOperation.continueOperationProcessing();
  }
@@ -858,14 +831,8 @@
          break;
        case INCREMENT:
          // We could calculate the new value, but we'll just take it from the
          // updated entry.
          List<Attribute> attrList =
               modifyOperation.getModifiedEntry().getAttribute(t,
                                                           a.getOptions());
          if (attrList != null)
          {
            for (Attribute updatedAttr : attrList)
          // We could calculate the new value, but we'll just take it from the updated entry.
          for (Attribute updatedAttr : modifyOperation.getModifiedEntry().getAttribute(t, a.getOptions()))
            {
              if (! updatedAttr.optionsEqual(a.getOptions()))
              {
@@ -877,7 +844,6 @@
                uniqueAttrValue2Dn.remove(v);
              }
            }
          }
          break;
        default:
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/EntryHistorical.java
@@ -518,7 +518,7 @@
    // Now we'll build the Historical object we want to construct
    final EntryHistorical newHistorical = new EntryHistorical();
    if (histAttrWithOptionsFromEntry == null)
    if (histAttrWithOptionsFromEntry.isEmpty())
    {
      // No historical attribute in the entry, return empty object
      return newHistorical;
@@ -607,10 +607,7 @@
  public static Iterable<FakeOperation> generateFakeOperations(Entry entry)
  {
    TreeMap<CSN, FakeOperation> operations = new TreeMap<>();
    List<Attribute> attrs = getHistoricalAttr(entry);
    if (attrs != null)
    {
      for (Attribute attr : attrs)
    for (Attribute attr : getHistoricalAttr(entry))
      {
        for (ByteString val : attr)
        {
@@ -644,15 +641,13 @@
            else
            {
              String uuidString = getEntryUUID(entry);
              FakeModifyOperation modifyFakeOperation =
                  new FakeModifyOperation(entry.getName(), csn, uuidString);
            FakeModifyOperation modifyFakeOperation = new FakeModifyOperation(entry.getName(), csn, uuidString);
              modifyFakeOperation.addModification(mod);
              operations.put(histVal.getCSN(), modifyFakeOperation);
            }
          }
        }
      }
    }
    return operations.values();
  }
@@ -747,7 +742,7 @@
   */
  private static String extractEntryUUID(List<Attribute> entryUUIDAttributes, DN entryDN)
  {
    if (entryUUIDAttributes != null)
    if (!entryUUIDAttributes.isEmpty())
    {
      Attribute uuidAttr = entryUUIDAttributes.get(0);
      if (!uuidAttr.isEmpty())
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/FractionalLDIFImportPlugin.java
@@ -29,6 +29,9 @@
import java.util.*;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.config.server.ConfigChangeResult;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.util.Utils;
import org.opends.server.admin.server.ConfigurationChangeListener;
import org.opends.server.admin.server.ServerManagementContext;
@@ -36,12 +39,11 @@
import org.opends.server.api.plugin.DirectoryServerPlugin;
import org.opends.server.api.plugin.PluginResult;
import org.opends.server.api.plugin.PluginType;
import org.forgerock.opendj.config.server.ConfigChangeResult;
import org.forgerock.opendj.config.server.ConfigException;
import org.opends.server.core.DirectoryServer;
import org.opends.server.replication.plugin.LDAPReplicationDomain.*;
import org.opends.server.replication.plugin.LDAPReplicationDomain.AttributeValueStringIterator;
import org.opends.server.replication.plugin.LDAPReplicationDomain.FractionalConfig;
import org.opends.server.types.*;
import org.forgerock.opendj.ldap.ByteString;
import static org.opends.messages.ReplicationMessages.*;
import static org.opends.server.replication.plugin.LDAPReplicationDomain.*;
@@ -404,11 +406,7 @@
  {
    AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attributeName);
    List<Attribute> inclAttrs = entry.getAttribute(attrType);
    if (inclAttrs != null)
    {
      return inclAttrs.get(0);
    }
    return null;
    return !inclAttrs.isEmpty() ? inclAttrs.get(0) : null;
  }
  /**
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -64,13 +64,13 @@
import org.opends.server.admin.std.meta.ReplicationDomainCfgDefn.IsolationPolicy;
import org.opends.server.admin.std.server.ExternalChangelogDomainCfg;
import org.opends.server.admin.std.server.ReplicationDomainCfg;
import org.opends.server.api.DirectoryThread;
import org.opends.server.api.SynchronizationProvider;
import org.opends.server.api.AlertGenerator;
import org.opends.server.api.Backend;
import org.opends.server.api.Backend.BackendOperation;
import org.opends.server.api.BackendInitializationListener;
import org.opends.server.api.DirectoryThread;
import org.opends.server.api.ServerShutdownListener;
import org.opends.server.api.SynchronizationProvider;
import org.opends.server.backends.task.Task;
import org.opends.server.core.*;
import org.opends.server.protocols.internal.InternalClientConnection;
@@ -706,7 +706,7 @@
    {
      AttributeType synchronizationGenIDType = DirectoryServer.getAttributeTypeOrNull(REPLICATION_GENERATION_ID);
      List<Attribute> attrs = resultEntry.getAttribute(synchronizationGenIDType);
      if (attrs != null)
      if (!attrs.isEmpty())
      {
        Attribute attr = attrs.get(0);
        if (attr.size() == 1)
@@ -727,7 +727,7 @@
  {
    AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attrName);
    List<Attribute> exclAttrs = resultEntry.getAttribute(attrType);
    if (exclAttrs != null)
    if (!exclAttrs.isEmpty())
    {
      Attribute exclAttr = exclAttrs.get(0);
      if (exclAttr != null)
@@ -3278,7 +3278,7 @@
      {
        AttributeType synchronizationGenIDType = DirectoryServer.getAttributeTypeOrNull(REPLICATION_GENERATION_ID);
        List<Attribute> attrs = resultEntry.getAttribute(synchronizationGenIDType);
        if (attrs != null)
        if (!attrs.isEmpty())
        {
          Attribute attr = attrs.get(0);
          if (attr.size()>1)
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/PersistentServerState.java
@@ -215,14 +215,14 @@
  /**
   * Update this ServerState from the provided entry.
   *
   * @param resultEntry The entry that should be used to update this
   *                    ServerState.
   * @param resultEntry
   *          The entry that should be used to update this ServerState.
   */
  private void updateStateFromEntry(SearchResultEntry resultEntry)
  {
    AttributeType synchronizationStateType = DirectoryServer.getAttributeTypeOrNull(REPLICATION_STATE);
    List<Attribute> attrs = resultEntry.getAttribute(synchronizationStateType);
    if (attrs != null)
    if (!attrs.isEmpty())
    {
      for (ByteString value : attrs.get(0))
      {
opendj-server-legacy/src/main/java/org/opends/server/tasks/AddSchemaFileTask.java
@@ -32,24 +32,23 @@
import java.util.TreeSet;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ResultCode;
import org.opends.server.admin.std.server.SynchronizationProviderCfg;
import org.opends.server.api.ClientConnection;
import org.opends.server.api.SynchronizationProvider;
import org.opends.server.backends.task.Task;
import org.opends.server.backends.task.TaskState;
import org.forgerock.opendj.config.server.ConfigException;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.SchemaConfigManager;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.opends.server.types.*;
import org.opends.server.types.LockManager.DNLock;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ResultCode;
import static org.opends.messages.TaskMessages.*;
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.core.DirectoryServer.getSchemaDN;
import static org.opends.server.core.DirectoryServer.getServerErrorResultCode;
import static org.opends.server.core.DirectoryServer.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
@@ -95,7 +94,7 @@
    Entry taskEntry = getTaskEntry();
    AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(ATTR_TASK_ADDSCHEMAFILE_FILENAME);
    List<Attribute> attrList = taskEntry.getAttribute(attrType);
    if (attrList == null || attrList.isEmpty())
    if (attrList.isEmpty())
    {
      LocalizableMessage message = ERR_TASK_ADDSCHEMAFILE_NO_FILENAME.get(
          ATTR_TASK_ADDSCHEMAFILE_FILENAME, taskEntry.getName());
opendj-server-legacy/src/main/java/org/opends/server/tasks/BackupTask.java
@@ -57,7 +57,6 @@
import org.opends.server.config.ConfigEntry;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.LockFileManager;
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeType;
import org.opends.server.types.BackupConfig;
import org.opends.server.types.BackupDirectory;
@@ -160,44 +159,23 @@
    AttributeType typeBackupDirectory = getAttributeTypeOrDefault(ATTR_BACKUP_DIRECTORY_PATH);
    AttributeType typeIncrementalBaseID = getAttributeTypeOrDefault(ATTR_TASK_BACKUP_INCREMENTAL_BASE_ID);
    backUpAll = TaskUtils.getBoolean(taskEntry.getAttribute(typeBackupAll), false);
    compress = TaskUtils.getBoolean(taskEntry.getAttribute(typeCompress), false);
    encrypt = TaskUtils.getBoolean(taskEntry.getAttribute(typeEncrypt), false);
    hash = TaskUtils.getBoolean(taskEntry.getAttribute(typeHash), false);
    incremental = TaskUtils.getBoolean(taskEntry.getAttribute(typeIncremental), false);
    signHash = TaskUtils.getBoolean(taskEntry.getAttribute(typeSignHash), false);
    backendIDList = TaskUtils.getMultiValueString(taskEntry.getAttribute(typeBackendID));
    backupID = TaskUtils.getSingleValueString(taskEntry.getAttribute(typeBackupID));
    List<Attribute> attrList;
    attrList = taskEntry.getAttribute(typeBackupAll);
    backUpAll = TaskUtils.getBoolean(attrList, false);
    attrList = taskEntry.getAttribute(typeCompress);
    compress = TaskUtils.getBoolean(attrList, false);
    attrList = taskEntry.getAttribute(typeEncrypt);
    encrypt = TaskUtils.getBoolean(attrList, false);
    attrList = taskEntry.getAttribute(typeHash);
    hash = TaskUtils.getBoolean(attrList, false);
    attrList = taskEntry.getAttribute(typeIncremental);
    incremental = TaskUtils.getBoolean(attrList, false);
    attrList = taskEntry.getAttribute(typeSignHash);
    signHash = TaskUtils.getBoolean(attrList, false);
    attrList = taskEntry.getAttribute(typeBackendID);
    backendIDList = TaskUtils.getMultiValueString(attrList);
    attrList = taskEntry.getAttribute(typeBackupID);
    backupID = TaskUtils.getSingleValueString(attrList);
    attrList = taskEntry.getAttribute(typeBackupDirectory);
    String backupDirectoryPath = TaskUtils.getSingleValueString(attrList);
    String backupDirectoryPath = TaskUtils.getSingleValueString(taskEntry.getAttribute(typeBackupDirectory));
    backupDirectory = new File(backupDirectoryPath);
    if (! backupDirectory.isAbsolute())
    {
      backupDirectory =
           new File(DirectoryServer.getInstanceRoot(), backupDirectoryPath);
      backupDirectory = new File(DirectoryServer.getInstanceRoot(), backupDirectoryPath);
    }
    attrList = taskEntry.getAttribute(typeIncrementalBaseID);
    incrementalBase = TaskUtils.getSingleValueString(attrList);
    incrementalBase = TaskUtils.getSingleValueString(taskEntry.getAttribute(typeIncrementalBaseID));
    configEntries = TaskUtils.getBackendConfigEntries();
  }
opendj-server-legacy/src/main/java/org/opends/server/tasks/DisconnectClientTask.java
@@ -30,8 +30,6 @@
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import java.util.List;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.ByteString;
@@ -106,10 +104,7 @@
  private long getConnectionID(Entry taskEntry) throws DirectoryException
  {
    final AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(ATTR_TASK_DISCONNECT_CONN_ID);
    final List<Attribute> attrList = taskEntry.getAttribute(attrType);
    if (attrList != null)
    {
      for (Attribute a : attrList)
    for (Attribute a : taskEntry.getAttribute(attrType))
      {
        for (ByteString v : a)
        {
@@ -124,17 +119,13 @@
          }
        }
      }
    }
    return -1;
  }
  private boolean mustNotifyClient(Entry taskEntry) throws DirectoryException
  {
    final AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(ATTR_TASK_DISCONNECT_NOTIFY_CLIENT);
    final List<Attribute> attrList = taskEntry.getAttribute(attrType);
    if (attrList != null)
    {
      for (Attribute a : attrList)
    for (Attribute a : taskEntry.getAttribute(attrType))
      {
        for (ByteString v : a)
        {
@@ -154,28 +145,22 @@
          }
        }
      }
    }
    return false;
  }
  private LocalizableMessage getDisconnectMessage(Entry taskEntry)
  {
    AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(ATTR_TASK_DISCONNECT_MESSAGE);
    List<Attribute> attrList = taskEntry.getAttribute(attrType);
    if (attrList != null)
    {
      for (Attribute a : attrList)
    for (Attribute a : taskEntry.getAttribute(attrType))
      {
        for (ByteString v : a)
        {
          return LocalizableMessage.raw(v.toString());
        }
      }
    }
    return INFO_TASK_DISCONNECT_GENERIC_MESSAGE.get();
  }
  /** {@inheritDoc} */
  @Override
  protected TaskState runTask()
  {
opendj-server-legacy/src/main/java/org/opends/server/tasks/SetGenerationIdTask.java
@@ -79,7 +79,7 @@
    // Retrieves the eventual generation-ID
    AttributeType typeNewValue = getAttributeTypeOrDefault(ATTR_TASK_SET_GENERATION_ID_NEW_VALUE);
    List<Attribute> attrList = taskEntry.getAttribute(typeNewValue);
    if (attrList != null && !attrList.isEmpty())
    if (!attrList.isEmpty())
    {
      try
      {
opendj-server-legacy/src/main/java/org/opends/server/tasks/ShutdownTask.java
@@ -96,7 +96,7 @@
    AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(ATTR_SHUTDOWN_MESSAGE);
    List<Attribute> attrList = taskEntry.getAttribute(attrType);
    if (attrList != null && !attrList.isEmpty())
    if (!attrList.isEmpty())
    {
      Attribute attr = attrList.get(0);
      if (!attr.isEmpty())
@@ -109,7 +109,7 @@
    attrType = DirectoryServer.getAttributeTypeOrDefault(ATTR_RESTART_SERVER);
    attrList = taskEntry.getAttribute(attrType);
    if (attrList != null && !attrList.isEmpty())
    if (!attrList.isEmpty())
    {
      Attribute attr = attrList.get(0);
      if (!attr.isEmpty())
opendj-server-legacy/src/main/java/org/opends/server/tasks/TaskUtils.java
@@ -167,11 +167,8 @@
        {
          continue;
        }
        else
        {
          backendID = idAttr.activeValue();
        }
      }
      catch (org.opends.server.config.ConfigException ce)
      {
        logger.error(ERR_CANNOT_DETERMINE_BACKEND_ID, configEntry.getDN(), ce.getMessage());
@@ -196,7 +193,7 @@
   * @return The configuration entry of the backend, or null if it could not
   * be found.
   */
  public static BackendCfg getConfigEntry(Backend backend)
  public static BackendCfg getConfigEntry(Backend<?> backend)
  {
    RootCfg root = ServerManagementContext.getInstance().
         getRootConfiguration();
@@ -262,8 +259,7 @@
   * @param backendID Identifies the backend to be disabled.
   * @throws DirectoryException If the internal modify operation failed.
   */
  public static void disableBackend(String backendID)
       throws DirectoryException
  public static void disableBackend(String backendID) throws DirectoryException
  {
    DN configEntryDN;
    RootCfg root = ServerManagementContext.getInstance().getRootConfiguration();
@@ -312,11 +308,6 @@
  public static boolean getBoolean(List<Attribute> attrList,
                                   boolean defaultValue)
  {
    if (attrList == null || attrList.isEmpty())
    {
      return defaultValue;
    }
    for (Attribute a : attrList)
    {
      for (ByteString v  : a)
@@ -351,8 +342,7 @@
  public static ArrayList<String> getMultiValueString(List<Attribute> attrList)
  {
    ArrayList<String> valueStrings = new ArrayList<>();
    if (attrList != null && !attrList.isEmpty())
    if (!attrList.isEmpty())
    {
      Attribute attr = attrList.get(0);
      if (!attr.isEmpty())
@@ -378,7 +368,7 @@
   */
  public static String getSingleValueString(List<Attribute> attrList)
  {
    if (attrList != null && !attrList.isEmpty())
    if (!attrList.isEmpty())
    {
      Attribute attr = attrList.get(0);
      if (!attr.isEmpty())
@@ -401,10 +391,9 @@
   * @return The integer value of the attribute, or the provided default value
   * if there is no value.
   */
  public static int getSingleValueInteger(List<Attribute> attrList,
                                          int defaultValue)
  public static int getSingleValueInteger(List<Attribute> attrList, int defaultValue)
  {
    if (attrList != null && !attrList.isEmpty())
    if (!attrList.isEmpty())
    {
      Attribute attr = attrList.get(0);
      if (!attr.isEmpty())
opendj-server-legacy/src/main/java/org/opends/server/tools/tasks/TaskEntry.java
@@ -431,7 +431,7 @@
  private String getSingleStringValue(Entry entry, String attrName) {
    List<Attribute> attrList = entry.getAttribute(attrName);
    if (attrList != null && attrList.size() == 1) {
    if (attrList.size() == 1) {
      Attribute attr = attrList.get(0);
      if (!attr.isEmpty()) {
        return attr.iterator().next().toString();
@@ -442,14 +442,11 @@
  private List<String> getMultiStringValue(Entry entry, String attrName) {
    List<String> valuesList = new ArrayList<>();
    List<Attribute> attrList = entry.getAttribute(attrName);
    if (attrList != null) {
      for (Attribute attr : attrList) {
    for (Attribute attr : entry.getAttribute(attrName)) {
        for (ByteString value : attr) {
          valuesList.add(value.toString());
        }
      }
    }
    return valuesList;
  }
opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java
@@ -464,8 +464,7 @@
    if (!includeSubordinates)
    {
      // It's possible that there could be an attribute without any
      // values, which we should treat as not having the requested
      // attribute.
      // values, which we should treat as not having the requested attribute.
      Attribute attribute = getExactAttribute(attributeType, options);
      return attribute != null && !attribute.isEmpty();
    }
@@ -477,8 +476,7 @@
      for (Attribute attribute : attributes)
      {
        // It's possible that there could be an attribute without any
        // values, which we should treat as not having the requested
        // attribute.
        // values, which we should treat as not having the requested attribute.
        if (!attribute.isEmpty() && attribute.hasAllOptions(options))
        {
          return true;
@@ -576,7 +574,7 @@
   * @param attributeType
   *          The attribute type to retrieve.
   * @return The requested attribute element(s) for the specified
   *         attribute type, or <CODE>null</CODE> if the specified
   *         attribute type, or an empty list if the specified
   *         attribute type is not present in this entry.
   */
  public List<Attribute> getAttribute(AttributeType attributeType)
@@ -597,7 +595,7 @@
   *                             being retrieved.
   *
   * @return  The requested attribute element(s) for the specified
   *          attribute type, or <CODE>null</CODE> if the specified
   *          attribute type, or an empty list if the specified
   *          attribute type is not present in this entry.
   */
  public List<Attribute> getAttribute(AttributeType attributeType,
@@ -615,12 +613,8 @@
        addAllIfNotNull(attributes, operationalAttributes.get(at));
      }
      if (!attributes.isEmpty())
      {
        return attributes;
      }
      return null;
    }
    List<Attribute> attributes = userAttributes.get(attributeType);
    if (attributes != null)
@@ -636,7 +630,7 @@
    {
      return newArrayList(getObjectClassAttribute());
    }
    return null;
    return Collections.emptyList();
  }
  /**
@@ -675,7 +669,7 @@
   *                    formatted in all lowercase characters.
   *
   * @return  The requested attribute element(s) for the specified
   *          attribute type, or <CODE>null</CODE> if the specified
   *          attribute type, or an empty list if the specified
   *          attribute type is not present in this entry.
   */
  public List<Attribute> getAttribute(String lowerName)
@@ -701,7 +695,7 @@
    {
      return newLinkedList(getObjectClassAttribute());
    }
    return null;
    return Collections.emptyList();
  }
  /**
@@ -716,40 +710,15 @@
   *                             include in matching elements.
   *
   * @return  The requested attribute element(s) for the specified
   *          attribute type, or <CODE>null</CODE> if the specified
   *          attribute type, or an empty list if the specified
   *          attribute type is not present in this entry with the
   *          provided set of options.
   */
  public List<Attribute> getAttribute(AttributeType attributeType,
                                      Set<String> options)
  {
    return getAttribute(attributeType, true, options);
  }
  /**
   * Retrieves the requested attribute element(s) for the specified
   * attribute type.  The list returned may include multiple elements
   * if the same attribute exists in the entry multiple times with
   * different sets of options.
   *
   * @param  attributeType       The attribute type to retrieve.
   * @param  includeSubordinates Whether to include any subordinate
   *                             attributes of the attribute type
   *                             being retrieved.
   * @param  options             The set of attribute options to
   *                             include in matching elements.
   *
   * @return  The requested attribute element(s) for the specified
   *          attribute type, or <CODE>null</CODE> if the specified
   *          attribute type is not present in this entry with the
   *          provided set of options.
   */
  public List<Attribute> getAttribute(AttributeType attributeType,
                                      boolean includeSubordinates,
                                      Set<String> options)
  {
    List<Attribute> attributes = new LinkedList<>();
    if (includeSubordinates && attributeType.mayHaveSubordinateTypes())
    if (attributeType.mayHaveSubordinateTypes())
    {
      addAllIfNotNull(attributes, userAttributes.get(attributeType));
      addAllIfNotNull(attributes, operationalAttributes.get(attributeType));
@@ -775,7 +744,7 @@
            attributes.add(getObjectClassAttribute());
            return attributes;
          }
          return null;
          return Collections.emptyList();
        }
      }
      attributes.addAll(attrs);
@@ -783,64 +752,8 @@
    onlyKeepAttributesWithAllOptions(attributes, options);
    if (!attributes.isEmpty())
    {
      return attributes;
    }
    return null;
  }
  /**
   * Retrieves the requested attribute element(s) for the attribute
   * with the specified name or OID and set of options.  The list
   * returned may include multiple elements if the same attribute
   * exists in the entry multiple times with different sets of
   * matching options.
   * <BR><BR>
   * Note that this method should only be used in cases in which the
   * Directory Server schema has no reference of an attribute type
   * with the specified name.  It is not as accurate or efficient as
   * the version of this method that takes an
   * <CODE>AttributeType</CODE> argument.
   *
   * @param  lowerName  The name or OID of the attribute to return,
   *                    formatted in all lowercase characters.
   * @param  options    The set of attribute options to include in
   *                    matching elements.
   *
   * @return  The requested attribute element(s) for the specified
   *          attribute type, or <CODE>null</CODE> if the specified
   *          attribute type is not present in this entry.
   */
  public List<Attribute> getAttribute(String lowerName,
                                      Set<String> options)
  {
    for (AttributeType attr : userAttributes.keySet())
    {
      if (attr.hasNameOrOID(lowerName))
      {
        return getAttribute(attr, options);
      }
    }
    for (AttributeType attr : operationalAttributes.keySet())
    {
      if (attr.hasNameOrOID(lowerName))
      {
        return getAttribute(attr, options);
      }
    }
    if (lowerName.equals(OBJECTCLASS_ATTRIBUTE_TYPE_NAME) &&
        (options == null || options.isEmpty()))
    {
      return newLinkedList(getObjectClassAttribute());
    }
    return null;
  }
  /**
   * Returns a parser for the named attribute contained in this entry.
@@ -861,8 +774,7 @@
      throws LocalizedIllegalArgumentException, NullPointerException
  {
    final List<Attribute> attribute = getAttribute(attributeDescription);
    boolean notEmpty = attribute != null && !attribute.isEmpty();
    return AttributeParser.parseAttribute(notEmpty ? attribute.get(0) : null);
    return AttributeParser.parseAttribute(!attribute.isEmpty() ? attribute.get(0) : null);
  }
@@ -892,7 +804,7 @@
   * @param  attributeType  The attribute type to retrieve.
   *
   * @return  The requested attribute element(s) for the specified
   *          attribute type, or <CODE>null</CODE> if there is no such
   *          attribute type, or an empty list if there is no such
   *          user attribute.
   */
  public List<Attribute> getUserAttribute(AttributeType attributeType)
@@ -920,39 +832,15 @@
      {
        addAllIfNotNull(attributes, attrs.get(at));
      }
      if (!attributes.isEmpty())
      {
        return attributes;
      }
      return null;
    }
    return attrs.get(attributeType);
    List<Attribute> results = attrs.get(attributeType);
    return results != null ? results : Collections.<Attribute> emptyList();
  }
  /**
   * Retrieves the requested user attribute element(s) for the
   * specified attribute type.  The list returned may include multiple
   * elements if the same attribute exists in the entry multiple times
   * with different sets of options.
   *
   * @param  attributeType  The attribute type to retrieve.
   * @param  options        The set of attribute options to include in
   *                        matching elements.
   *
   * @return  The requested attribute element(s) for the specified
   *          attribute type, or <CODE>null</CODE> if there is no such
   *          user attribute with the specified set of options.
   */
  public List<Attribute> getUserAttribute(AttributeType attributeType,
                                          Set<String> options)
  {
    return getAttribute(attributeType, options, userAttributes);
  }
  /**
   * Returns the List of attributes for a given attribute type having all the
   * required options.
   *
@@ -979,13 +867,8 @@
    }
    onlyKeepAttributesWithAllOptions(attributes, options);
    if (!attributes.isEmpty())
    {
      return attributes;
    }
    return null;
  }
  /**
   * Removes all the attributes that do not have all the supplied options.
@@ -1056,7 +939,7 @@
   * @param  attributeType  The attribute type to retrieve.
   *
   * @return  The requested attribute element(s) for the specified
   *          attribute type, or <CODE>null</CODE> if there is no such
   *          attribute type, or an empty list if there is no such
   *          operational attribute.
   */
  public List<Attribute> getOperationalAttribute(AttributeType attributeType)
@@ -1078,7 +961,7 @@
   *                        matching elements.
   *
   * @return  The requested attribute element(s) for the specified
   *          attribute type, or <CODE>null</CODE> if there is no such
   *          attribute type, or an empty list if there is no such
   *          operational attribute with the specified set of options.
   */
  public List<Attribute> getOperationalAttribute(
@@ -1441,16 +1324,9 @@
   * @return  <CODE>true</CODE> if this entry contains the specified
   *          attribute value, or <CODE>false</CODE> if it does not.
   */
  public boolean hasValue(AttributeType attributeType,
                          Set<String> options, ByteString value)
  public boolean hasValue(AttributeType attributeType, Set<String> options, ByteString value)
  {
    List<Attribute> attrList = getAttribute(attributeType, true);
    if (attrList == null || attrList.isEmpty())
    {
      return false;
    }
    for (Attribute a : attrList)
    for (Attribute a : getAttribute(attributeType))
    {
      if (a.optionsEqual(options) && a.contains(value))
      {
@@ -3005,8 +2881,7 @@
            try
            {
              DN inheritFromDN = null;
              for (Attribute attr : getAttribute(
                   subEntry.getInheritFromDNType()))
              for (Attribute attr : getAttribute(subEntry.getInheritFromDNType()))
              {
                for (ByteString value : attr)
                {
@@ -3041,8 +2916,7 @@
            {
              try
              {
                for (Attribute attr : getAttribute(
                   subEntry.getInheritFromRDNAttrType()))
                for (Attribute attr : getAttribute(subEntry.getInheritFromRDNAttrType()))
                {
                  inheritFromDN = subEntry.getInheritFromBaseDN();
                  for (ByteString value : attr)
@@ -4726,7 +4600,7 @@
          else
          {
            List<Attribute> attrList = getUserAttribute(attrType);
            if (attrList != null)
            if (!attrList.isEmpty())
            {
              mergeAttributeLists(attrList, userAttrsCopy, attrType,
                  attrName, options, omitValues, omitReal, omitVirtual);
@@ -4734,7 +4608,7 @@
            else
            {
              attrList = getOperationalAttribute(attrType);
              if (attrList != null)
              if (!attrList.isEmpty())
              {
                mergeAttributeLists(attrList, operationalAttrsCopy,
                    attrType, attrName, options, omitValues, omitReal,
opendj-server-legacy/src/main/java/org/opends/server/types/SearchFilter.java
@@ -2637,9 +2637,8 @@
    }
    // See if the entry has an attribute with the requested type.
    List<Attribute> attrs = entry.getAttribute(attributeType,
                                               attributeOptions);
    if (attrs == null || attrs.isEmpty())
    List<Attribute> attrs = entry.getAttribute(attributeType, attributeOptions);
    if (attrs.isEmpty())
    {
      if (logger.isTraceEnabled())
      {
@@ -2743,7 +2742,7 @@
    // See if the entry has an attribute with the requested type.
    List<Attribute> attrs = entry.getAttribute(attributeType, attributeOptions);
    if (attrs == null || attrs.isEmpty())
    if (attrs.isEmpty())
    {
      if (logger.isTraceEnabled())
      {
@@ -2844,7 +2843,7 @@
    // See if the entry has an attribute with the requested type.
    List<Attribute> attrs = entry.getAttribute(attributeType, attributeOptions);
    if (attrs == null || attrs.isEmpty())
    if (attrs.isEmpty())
    {
      if (logger.isTraceEnabled())
      {
@@ -2857,8 +2856,7 @@
      return ConditionResult.FALSE;
    }
    // Iterate through all the attributes and see if we can find a
    // match.
    // Iterate through all the attributes and see if we can find a match.
    ConditionResult result = ConditionResult.FALSE;
    for (Attribute a : attrs)
    {
@@ -2942,9 +2940,8 @@
    }
    // See if the entry has an attribute with the requested type.
    List<Attribute> attrs =
         entry.getAttribute(attributeType, attributeOptions);
    if (attrs == null || attrs.isEmpty())
    List<Attribute> attrs = entry.getAttribute(attributeType, attributeOptions);
    if (attrs.isEmpty())
    {
      if (logger.isTraceEnabled())
      {
@@ -3087,9 +3084,8 @@
    }
    // See if the entry has an attribute with the requested type.
    List<Attribute> attrs =
         entry.getAttribute(attributeType, attributeOptions);
    if (attrs == null || attrs.isEmpty())
    List<Attribute> attrs = entry.getAttribute(attributeType, attributeOptions);
    if (attrs.isEmpty())
    {
      if (logger.isTraceEnabled())
      {
@@ -3390,11 +3386,7 @@
    }
    else
    {
      List<Attribute> attrList = entry.getAttribute(attributeType,
                                                    attributeOptions);
      if (attrList != null)
      {
        for (Attribute a : attrList)
      for (Attribute a : entry.getAttribute(attributeType, attributeOptions))
        {
          for (ByteString v : a)
          {
@@ -3413,25 +3405,21 @@
                  break;
                default:
                  LocalizableMessage message =
                      ERR_SEARCH_FILTER_INVALID_RESULT_TYPE.
                        get(entry.getName(), completeFilter, r);
                  throw new DirectoryException(
                                 ResultCode.PROTOCOL_ERROR, message);
                  ERR_SEARCH_FILTER_INVALID_RESULT_TYPE.get(entry.getName(), completeFilter, r);
              throw new DirectoryException(ResultCode.PROTOCOL_ERROR, message);
              }
            }
            catch (Exception e)
            {
              logger.traceException(e);
              // We couldn't normalize one of the values.  If we don't
              // find a definite match, then we should return
              // undefined.
            // We couldn't normalize one of the values.
            // If we don't find a definite match, then we should return undefined.
              result = ConditionResult.UNDEFINED;
            }
          }
        }
      }
    }
    // If we've gotten here, then we know that there is no definite
opendj-server-legacy/src/main/java/org/opends/server/types/SubEntry.java
@@ -190,18 +190,14 @@
    String specString = null;
    boolean isValidSpec = true;
    AttributeType specAttrType = DirectoryServer.getAttributeTypeOrDefault(ATTR_SUBTREE_SPEC_LC);
    List<Attribute> specAttrList = entry.getAttribute(specAttrType);
    if (specAttrList != null)
    {
      for (Attribute attr : specAttrList)
    for (Attribute attr : entry.getAttribute(specAttrType))
      {
        for (ByteString value : attr)
        {
          specString = value.toString();
          try
          {
            this.subTreeSpec = SubtreeSpecification.valueOf(
                    entry.getName().parent(), specString);
          this.subTreeSpec = SubtreeSpecification.valueOf(entry.getName().parent(), specString);
            isValidSpec = true;
          }
          catch (DirectoryException de)
@@ -218,7 +214,6 @@
          break;
        }
      }
    }
    // Check that the subtree spec is flagged as valid. If it is not
    // that means all parsers have failed and it is invalid syntax.
@@ -288,11 +283,7 @@
    {
      if (this.isInheritedFromDNCollective)
      {
        List<Attribute> attrList = entry.getAttribute(
                ATTR_INHERIT_COLLECTIVE_FROM_DN);
        if (attrList != null && !attrList.isEmpty())
        {
          for (Attribute attr : attrList)
        for (Attribute attr : entry.getAttribute(ATTR_INHERIT_COLLECTIVE_FROM_DN))
          {
            for (ByteString value : attr)
            {
@@ -302,14 +293,10 @@
            }
          }
        }
      }
      if (this.isInheritedFromRDNCollective)
      {
        List<Attribute> attrList = entry.getAttribute(ATTR_INHERIT_COLLECTIVE_FROM_RDN);
        if (attrList != null && !attrList.isEmpty())
        {
          for (Attribute attr : attrList)
        for (Attribute attr : entry.getAttribute(ATTR_INHERIT_COLLECTIVE_FROM_RDN))
          {
            for (ByteString value : attr)
            {
@@ -318,11 +305,7 @@
              break;
            }
          }
        }
        attrList = entry.getAttribute(ATTR_INHERIT_COLLECTIVE_FROM_RDN_TYPE);
        if (attrList != null && !attrList.isEmpty())
        {
          for (Attribute attr : attrList)
        for (Attribute attr : entry.getAttribute(ATTR_INHERIT_COLLECTIVE_FROM_RDN_TYPE))
          {
            for (ByteString value : attr)
            {
@@ -330,11 +313,7 @@
              break;
            }
          }
        }
        attrList = entry.getAttribute(ATTR_INHERIT_COLLECTIVE_FROM_BASE);
        if (attrList != null && !attrList.isEmpty())
        {
          for (Attribute attr : attrList)
        for (Attribute attr : entry.getAttribute(ATTR_INHERIT_COLLECTIVE_FROM_BASE))
          {
            for (ByteString value : attr)
            {
@@ -345,38 +324,26 @@
            }
          }
        }
      }
      List<Attribute> attrList = entry.getAttribute(
              ATTR_INHERIT_COLLECTIVE_ATTR);
      if (attrList != null && !attrList.isEmpty())
      {
        for (Attribute attr : attrList)
      for (Attribute attr : entry.getAttribute(ATTR_INHERIT_COLLECTIVE_ATTR))
        {
          for (ByteString value : attr)
          {
            CollectiveVirtualAttribute collectiveAttr =
              new CollectiveVirtualAttribute(
                Attributes.empty(value.toString()));
              new CollectiveVirtualAttribute(Attributes.empty(value.toString()));
            this.collectiveAttributes.add(collectiveAttr);
          }
        }
      }
    }
    // Establish collective attribute conflict behavior.
    if (this.isCollective || this.isInheritedCollective)
    {
      List<Attribute> attrList = entry.getAttribute(
              ATTR_COLLECTIVE_CONFLICT_BEHAVIOR);
      if (attrList != null && !attrList.isEmpty())
      {
        for (Attribute attr : attrList)
      for (Attribute attr : entry.getAttribute(ATTR_COLLECTIVE_CONFLICT_BEHAVIOR))
        {
          for (ByteString value : attr)
          {
            for (CollectiveConflictBehavior behavior :
              CollectiveConflictBehavior.values())
          for (CollectiveConflictBehavior behavior : CollectiveConflictBehavior.values())
            {
              if (behavior.toString().equals(value.toString()))
              {
@@ -388,7 +355,6 @@
        }
      }
    }
  }
  /**
   * Retrieves the distinguished name for this subentry.
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java
@@ -703,7 +703,7 @@
    // See if a password was specified.
    AttributeType passwordAttribute = passwordPolicy.getPasswordAttribute();
    List<Attribute> attrList = entry.getAttribute(passwordAttribute);
    if (attrList == null || attrList.isEmpty())
    if (attrList.isEmpty())
    {
      // The entry doesn't have a password, so no action is required.
      return;
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendBindOperation.java
@@ -420,8 +420,7 @@
      PasswordPolicy policy = pwPolicyState.getAuthenticationPolicy();
      AttributeType pwType = policy.getPasswordAttribute();
      List<Attribute> pwAttr = userEntry.getAttribute(pwType);
      if (pwAttr == null || pwAttr.isEmpty())
      if (userEntry.getAttribute(pwType).isEmpty())
      {
        throw new DirectoryException(ResultCode.INVALID_CREDENTIALS,
            ERR_BIND_OPERATION_NO_PASSWORD.get());
@@ -1026,7 +1025,7 @@
  {
    AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attributeTypeName);
    List<Attribute> attrList = userEntry.getAttribute(attrType);
    if (attrList != null && attrList.size() == 1)
    if (attrList.size() == 1)
    {
      Attribute a = attrList.get(0);
      if (a.size() == 1)
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendCompareOperation.java
@@ -25,6 +25,7 @@
 *      Portions Copyright 2011-2015 ForgeRock AS
 */
package org.opends.server.workflowelement.localbackend;
import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -235,7 +236,7 @@
      // Actually perform the compare operation.
      List<Attribute> attrList = entry.getAttribute(attrType, options);
      if (attrList == null || attrList.isEmpty())
      if (attrList.isEmpty())
      {
        setResultCode(ResultCode.NO_SUCH_ATTRIBUTE);
        Arg2<Object, Object> errorMsg = options == null
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendModifyOperation.java
@@ -1072,7 +1072,7 @@
        // We still need to check if the pre-encoded password matches
        // an existing value, to decrease the number of passwords.
        List<Attribute> attrList = currentEntry.getAttribute(pwAttr.getAttributeType());
        if (attrList == null || attrList.isEmpty())
        if (attrList.isEmpty())
        {
          throw new DirectoryException(ResultCode.NO_SUCH_ATTRIBUTE, ERR_MODIFY_NO_EXISTING_VALUES.get());
        }
@@ -1085,10 +1085,9 @@
      else
      {
        List<Attribute> attrList = currentEntry.getAttribute(pwAttr.getAttributeType());
        if (attrList == null || attrList.isEmpty())
        if (attrList.isEmpty())
        {
          throw new DirectoryException(ResultCode.NO_SUCH_ATTRIBUTE,
              ERR_MODIFY_NO_EXISTING_VALUES.get());
          throw new DirectoryException(ResultCode.NO_SUCH_ATTRIBUTE, ERR_MODIFY_NO_EXISTING_VALUES.get());
        }
        if (addIfAttributeValueExistsNoPreEncodedPassword(builder, attrList, v))
opendj-server-legacy/src/test/java/org/opends/server/TestCaseUtils.java
@@ -1845,17 +1845,13 @@
  public static HashSet<PluginType> getPluginTypes(Entry e)
  {
    HashSet<PluginType> pluginTypes = new HashSet<>();
    List<Attribute> attrList = e.getAttribute("ds-cfg-plugin-type");
    if (attrList != null)
    {
      for (Attribute a : attrList)
    for (Attribute a : e.getAttribute("ds-cfg-plugin-type"))
      {
        for (ByteString v : a)
        {
          pluginTypes.add(PluginType.forName(v.toString().toLowerCase()));
        }
      }
    }
    return pluginTypes;
  }
opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/AciTestCase.java
@@ -79,9 +79,8 @@
    // Save Global ACI.
    Entry e = DirectoryServer.getEntry(DN.valueOf(ACCESS_HANDLER_DN));
    List<Attribute> attrs =
        e.getAttribute(ConfigConstants.ATTR_AUTHZ_GLOBAL_ACI);
    if (attrs != null && !attrs.isEmpty())
    List<Attribute> attrs = e.getAttribute(ConfigConstants.ATTR_AUTHZ_GLOBAL_ACI);
    if (!attrs.isEmpty())
    {
      Reporter.log("Saved global ACI attribute");
opendj-server-legacy/src/test/java/org/opends/server/backends/ChangelogBackendTestCase.java
@@ -1491,7 +1491,7 @@
  private static String getAttributeValue(Entry entry, String attrName)
  {
    List<Attribute> attrs = entry.getAttribute(attrName.toLowerCase());
    if (attrs == null)
    if (attrs.isEmpty())
    {
      return null;
    }
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/TestDnKeyFormat.java
@@ -390,13 +390,10 @@
        }
        // check the user attributes were not changed
        for (AttributeType attrType : entryBefore.getUserAttributes()
            .keySet()) {
        for (AttributeType attrType : entryBefore.getUserAttributes().keySet()) {
          List<Attribute> listBefore = entryBefore.getAttribute(attrType);
          List<Attribute> listAfter = entryAfter.getAttribute(attrType);
          assertNotNull(listAfter);
          assertEquals(listBefore.size(), listAfter.size());
          assertThat(listBefore).hasSameSizeAs(listAfter);
          for (Attribute attrBefore : listBefore) {
            boolean found = false;
@@ -404,7 +401,6 @@
            for (Attribute attrAfter : listAfter) {
              if (attrAfter.optionsEqual(attrBefore.getOptions())) {
                // Found the corresponding attribute
                assertEquals(attrBefore, attrAfter);
                found = true;
              }
opendj-server-legacy/src/test/java/org/opends/server/core/AddOperationTestCase.java
@@ -68,6 +68,7 @@
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.assertj.core.api.Assertions.*;
import static org.opends.server.TestCaseUtils.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.protocols.ldap.LDAPConstants.*;
@@ -402,7 +403,6 @@
    Entry e = DirectoryServer.getEntry(DN.valueOf("ou=People,o=test"));
    List<Attribute> attrList = e.getAttribute(a.getAttributeType());
    assertNotNull(attrList);
    assertFalse(attrList.isEmpty());
    boolean foundFoo = false;
@@ -455,9 +455,7 @@
    retrieveCompletedOperationElements(addOperation);
    Entry e = DirectoryServer.getEntry(DN.valueOf("ou=People,o=test"));
    List<Attribute> attrList = e.getAttribute(a.getAttributeType());
    assertNotNull(attrList);
    assertFalse(attrList.isEmpty());
    assertThat(e.getAttribute(a.getAttributeType())).isNotEmpty();
    UpdatePreOpPlugin.reset();
  }
@@ -491,8 +489,7 @@
    retrieveCompletedOperationElements(addOperation);
    Entry e = DirectoryServer.getEntry(DN.valueOf("ou=People,o=test"));
    List<Attribute> attrList = e.getAttribute(attrType);
    assertNull(attrList);
    assertThat(e.getAttribute(attrType)).isEmpty();
    UpdatePreOpPlugin.reset();
  }
@@ -889,7 +886,7 @@
    Entry e = DirectoryServer.getEntry(DN.valueOf("ou=People,o=test"));
    List<Attribute> attrList = e.getAttribute("ou");
    assertNotNull(attrList);
    assertThat(attrList).isNotEmpty();
  }
@@ -944,9 +941,7 @@
    retrieveCompletedOperationElements(addOperation);
    Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user,o=test"));
    List<Attribute> attrList =
         e.getAttribute(DirectoryServer.getObjectClassAttributeType());
    assertNotNull(attrList);
    List<Attribute> attrList = e.getAttribute(DirectoryServer.getObjectClassAttributeType());
    boolean found = false;
    for (Attribute a : attrList)
opendj-server-legacy/src/test/java/org/opends/server/core/ModifyOperationTestCase.java
@@ -77,6 +77,7 @@
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.assertj.core.api.Assertions.*;
import static org.opends.server.TestCaseUtils.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.protocols.internal.Requests.*;
@@ -435,7 +436,7 @@
  public void testGetAndAddModifications() throws Exception
  {
    Entry e = DirectoryServer.getEntry(DN.valueOf("o=test"));
    assertNull(e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("description")));
    assertThat(e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("description"))).isEmpty();
    UpdatePreOpPlugin.reset();
    UpdatePreOpPlugin.addModification(
@@ -453,7 +454,7 @@
    retrieveSuccessfulOperationElements(modifyOperation);
    e = DirectoryServer.getEntry(DN.valueOf("o=test"));
    assertNotNull(e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("description")));
    assertThat(e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("description"))).isNotEmpty();
    UpdatePreOpPlugin.reset();
  }
@@ -552,7 +553,7 @@
  public void testSuccessAddAttribute() throws Exception
  {
    Entry e = DirectoryServer.getEntry(DN.valueOf("o=test"));
    assertNull(e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("description")));
    assertThat(e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("description"))).isEmpty();
    LDAPAttribute attr = newLDAPAttribute("description", "foo");
    ModifyOperation modifyOperation = processModify("o=test", replace(attr));
@@ -560,7 +561,7 @@
    retrieveSuccessfulOperationElements(modifyOperation);
    e = DirectoryServer.getEntry(DN.valueOf("o=test"));
    assertNotNull(e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("description")));
    assertThat(e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("description"))).isNotEmpty();
  }
@@ -576,8 +577,7 @@
  {
    Entry e = DirectoryServer.getEntry(DN.valueOf("o=test"));
    List<Attribute> attrList =
         e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("o"));
    List<Attribute> attrList = e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("o"));
    assertEquals(countValues(attrList), 1);
    LDAPAttribute attr = newLDAPAttribute("o", "test2");
@@ -604,8 +604,7 @@
  {
    Entry e = DirectoryServer.getEntry(DN.valueOf(baseDN));
    List<Attribute> attrList =
         e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("o"));
    List<Attribute> attrList = e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("o"));
    assertEquals(countValues(attrList), 1);
    LDAPAttribute attr = newLDAPAttribute("o;lang-en-us", "test");
@@ -1879,7 +1878,6 @@
    Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user," + baseDN));
    List<Attribute> attrList =
         e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("employeenumber"));
    assertNotNull(attrList);
    assertIntegerValueExists(attrList, 2);
  }
@@ -1918,7 +1916,6 @@
    Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user," + baseDN));
    List<Attribute> attrList =
         e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("employeenumber"));
    assertNotNull(attrList);
    assertIntegerValueExists(attrList, 11);
  }
@@ -1957,7 +1954,6 @@
    Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user," + baseDN));
    List<Attribute> attrList =
         e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("employeenumber"));
    assertNotNull(attrList);
    assertIntegerValueExists(attrList, 0);
  }
@@ -3423,7 +3419,6 @@
    List<Attribute> attrList =
         e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("userpassword"));
    assertNotNull(attrList);
    String passwd = null;
    for (Attribute a : attrList)
@@ -3490,7 +3485,6 @@
    e = DirectoryServer.getEntry(DN.valueOf("cn=Test User,o=test"));
    List<Attribute> attrList = e.getAttribute("userpassword");
    assertNotNull(attrList);
    assertEquals(attrList.size(), 1);
    assertFalse(attrList.get(0).hasOptions());
    assertEquals(attrList.get(0).size(), 1);
@@ -3531,7 +3525,6 @@
    e = DirectoryServer.getEntry(DN.valueOf("cn=Test User,o=test"));
    List<Attribute> attrList = e.getAttribute("userpassword");
    assertNotNull(attrList);
    assertEquals(attrList.size(), 1);
    assertFalse(attrList.get(0).hasOptions());
    assertEquals(attrList.get(0).size(), 1);
@@ -3568,7 +3561,6 @@
    Entry e = DirectoryServer.getEntry(DN.valueOf("cn=Test User,o=test"));
    List<Attribute> attrList = e.getAttribute("userpassword");
    assertNotNull(attrList);
    assertEquals(attrList.size(), 1);
    assertFalse(attrList.get(0).hasOptions());
    assertEquals(attrList.get(0).size(), 1);
@@ -3605,7 +3597,6 @@
    Entry e = DirectoryServer.getEntry(DN.valueOf("cn=Test User,o=test"));
    List<Attribute> attrList = e.getAttribute("userpassword");
    assertNotNull(attrList);
    assertEquals(attrList.size(), 1);
    assertFalse(attrList.get(0).hasOptions());
    assertEquals(attrList.get(0).size(), 1);
@@ -3660,10 +3651,8 @@
    retrieveSuccessfulOperationElements(modifyOperation);
    Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user," + baseDN));
    List<Attribute> attrList =
         e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("usercertificate"));
    assertNotNull(attrList);
    assertEquals(attrList.size(), 1);
    List<Attribute> attrList = e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("usercertificate"));
    assertThat(attrList).hasSize(1);
    Attribute a = attrList.get(0);
    assertTrue(a.hasOption("binary"));
    assertEquals(a.size(), 1);
opendj-server-legacy/src/test/java/org/opends/server/core/SearchOperationTestCase.java
@@ -988,14 +988,14 @@
      if (stripVirtualAttributes)
      {
        if (attrList != null)
        if (!attrList.isEmpty())
        {
          messages.add("Unexpected virtual attribute: " + attrType);
        }
      }
      else if (filterType == AttributeFilterType.DEFAULT)
      {
        if (attrList != null)
        if (!attrList.isEmpty())
        {
          messages.add("Unexpected operational attribute: " + attrType);
        }
@@ -1003,14 +1003,14 @@
      else if ("ismemberof".equals(attrType))
      {
        // isMemberOf should never be returned as user is not in any groups.
        if (attrList != null)
        if (!attrList.isEmpty())
        {
          messages.add("Unexpected isMemberOf attribute");
        }
      }
      else
      {
        if (attrList == null)
        if (attrList.isEmpty())
        {
          messages.add("Missing virtual attribute: " + attrType);
        }
@@ -1045,14 +1045,14 @@
      if (stripRealAttributes)
      {
        if (attrList != null)
        if (!attrList.isEmpty())
        {
          messages.add("Unexpected real attribute: " + attrType);
        }
      }
      else
      {
        if (attrList == null)
        if (attrList.isEmpty())
        {
          messages.add("Missing real attribute: " + attrType);
        }
opendj-server-legacy/src/test/java/org/opends/server/core/SubentryManagerTestCase.java
@@ -239,15 +239,14 @@
      assertNotNull(e);
      List<Attribute> description = e.getAttribute("description");
      assertNull(description);
      assertThat(description).isEmpty();
      // Collective user will inherit the collective description attribute.
      e = DirectoryServer.getEntry(DN.valueOf("uid=collective user,ou=people,o=test"));
      assertNotNull(e);
      description = e.getAttribute("description");
      assertNotNull(description);
      assertEquals(description.size(), 1);
      assertThat(description).hasSize(1);
      Attribute attribute = description.get(0);
      assertEquals(attribute.size(), 1);
      assertFalse(attribute.hasOptions());
opendj-server-legacy/src/test/java/org/opends/server/core/TestModifyDNOperation.java
@@ -69,6 +69,7 @@
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import static org.assertj.core.api.Assertions.*;
import static org.forgerock.opendj.ldap.ResultCode.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.util.ServerConstants.*;
@@ -432,7 +433,7 @@
  {
    AttributeType at = DirectoryServer.getAttributeTypeOrNull(attrName);
    List<Attribute> attrList = newEntry.getAttribute(at);
    assertEquals(attrList.size(), 1);
    assertThat(attrList).hasSize(1);
    // Because deleteOldRDN is true, the values from RDN and the entry have to be identical
    ByteString valueFromEntry = attrList.get(0).iterator().next();
@@ -561,7 +562,7 @@
        runModifyDNOperation(oldEntryDN, "cn=Aaccf Amar Test", true, "dc=example,dc=com");
    assertSuccess(modifyDNOperation);
    Entry entry = assertCnAttrValues(newEntryDN, oldEntryDN);
    assertNull(entry.getAttribute("uid"));
    assertThat(entry.getAttribute("uid")).isEmpty();
    examineCompletedOPNoExtraPluginCounts(modifyDNOperation);
    InvocationCounterPlugin.resetAllCounters();
opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryDNVirtualAttributeProviderTestCase.java
@@ -40,12 +40,18 @@
import org.opends.server.protocols.internal.InternalSearchOperation;
import org.opends.server.protocols.internal.SearchRequest;
import org.opends.server.protocols.ldap.LDAPControl;
import org.opends.server.types.*;
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeType;
import org.opends.server.types.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.SearchFilter;
import org.opends.server.types.VirtualAttributeRule;
import org.opends.server.workflowelement.localbackend.LocalBackendSearchOperation;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.assertj.core.api.Assertions.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.protocols.internal.Requests.*;
import static org.opends.server.util.CollectionUtils.*;
@@ -128,8 +134,7 @@
    assertTrue(e.hasAttribute(entryDNType));
    List<Attribute> attrList = e.getAttribute(entryDNType);
    assertNotNull(attrList);
    assertFalse(attrList.isEmpty());
    assertThat(attrList).isNotEmpty();
    for (Attribute a : attrList)
    {
      assertFalse(a.isEmpty());
opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryUUIDVirtualAttributeProviderTestCase.java
@@ -38,11 +38,17 @@
import org.opends.server.protocols.internal.InternalSearchOperation;
import org.opends.server.protocols.internal.SearchRequest;
import org.opends.server.protocols.ldap.LDAPControl;
import org.opends.server.types.*;
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeType;
import org.opends.server.types.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.SearchFilter;
import org.opends.server.types.VirtualAttributeRule;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.assertj.core.api.Assertions.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.protocols.internal.Requests.*;
import static org.opends.server.util.ServerConstants.*;
@@ -123,8 +129,7 @@
    assertTrue(e.hasAttribute(entryUUIDType));
    List<Attribute> attrList = e.getAttribute(entryUUIDType);
    assertNotNull(attrList);
    assertFalse(attrList.isEmpty());
    assertThat(attrList).isNotEmpty();
    for (Attribute a : attrList)
    {
      assertFalse(a.isEmpty());
@@ -159,8 +164,7 @@
    assertTrue(e.hasAttribute(entryUUIDType));
    List<Attribute> attrList = e.getAttribute(entryUUIDType);
    assertNotNull(attrList);
    assertFalse(attrList.isEmpty());
    assertThat(attrList).isNotEmpty();
    for (Attribute a : attrList)
    {
      assertFalse(a.isEmpty());
opendj-server-legacy/src/test/java/org/opends/server/extensions/GoverningStructureRuleVirtualAttributeProviderTestCase.java
@@ -50,6 +50,7 @@
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.assertj.core.api.Assertions.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.protocols.internal.Requests.*;
import static org.opends.server.util.ServerConstants.*;
@@ -184,8 +185,7 @@
    assertTrue(e.hasAttribute(governingStructureRuleType));
    List<Attribute> attrList = e.getAttribute(governingStructureRuleType);
    assertNotNull(attrList);
    assertFalse(attrList.isEmpty());
    assertThat(attrList).isNotEmpty();
    for (Attribute a : attrList)
    {
      assertFalse(a.isEmpty());
opendj-server-legacy/src/test/java/org/opends/server/extensions/HasSubordinatesVirtualAttributeProviderTestCase.java
@@ -46,6 +46,7 @@
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.assertj.core.api.Assertions.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.protocols.internal.Requests.*;
import static org.opends.server.util.ServerConstants.*;
@@ -222,8 +223,7 @@
    assertTrue(e.hasAttribute(hasSubordinatesType));
    List<Attribute> attrList = e.getAttribute(hasSubordinatesType);
    assertNotNull(attrList);
    assertFalse(attrList.isEmpty());
    assertThat(attrList).isNotEmpty();
    for (Attribute a : attrList)
    {
      assertFalse(a.isEmpty());
opendj-server-legacy/src/test/java/org/opends/server/extensions/NumSubordinatesVirtualAttributeProviderTestCase.java
@@ -44,6 +44,7 @@
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.assertj.core.api.Assertions.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.protocols.internal.Requests.*;
import static org.opends.server.util.ServerConstants.*;
@@ -220,8 +221,7 @@
    assertTrue(e.hasAttribute(numSubordinatesType));
    List<Attribute> attrList = e.getAttribute(numSubordinatesType);
    assertNotNull(attrList);
    assertFalse(attrList.isEmpty());
    assertThat(attrList).isNotEmpty();
    for (Attribute a : attrList)
    {
      assertFalse(a.isEmpty());
opendj-server-legacy/src/test/java/org/opends/server/extensions/PasswordExpirationTimeVirtualAttributeProviderTestCase.java
@@ -215,7 +215,6 @@
    assertNotNull(entry);
    List<Attribute> attrs = entry.getAttribute(attributeName);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 1);
    Attribute attr = attrs.get(0);
opendj-server-legacy/src/test/java/org/opends/server/extensions/StructuralObjectClassVirtualAttributeProviderTestCase.java
@@ -47,6 +47,7 @@
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.assertj.core.api.Assertions.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.protocols.internal.Requests.*;
import static org.opends.server.util.ServerConstants.*;
@@ -150,8 +151,7 @@
    assertTrue(e.hasAttribute(structuralObjectClassType));
    List<Attribute> attrList = e.getAttribute(structuralObjectClassType);
    assertNotNull(attrList);
    assertFalse(attrList.isEmpty());
    assertThat(attrList).isNotEmpty();
    for (Attribute a : attrList)
    {
      assertFalse(a.isEmpty());
opendj-server-legacy/src/test/java/org/opends/server/extensions/SubschemaSubentryVirtualAttributeProviderTestCase.java
@@ -47,6 +47,7 @@
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.assertj.core.api.Assertions.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.protocols.internal.Requests.*;
import static org.opends.server.util.ServerConstants.*;
@@ -128,8 +129,7 @@
    assertTrue(e.hasAttribute(subschemaSubentryType));
    List<Attribute> attrList = e.getAttribute(subschemaSubentryType);
    assertNotNull(attrList);
    assertFalse(attrList.isEmpty());
    assertThat(attrList).isNotEmpty();
    for (Attribute a : attrList)
    {
      assertFalse(a.isEmpty());
opendj-server-legacy/src/test/java/org/opends/server/extensions/UserDefinedVirtualAttributeProviderTestCase.java
@@ -246,10 +246,7 @@
      final SearchRequest request = newSearchRequest(DN.valueOf(userDN), SearchScope.BASE_OBJECT);
      InternalSearchOperation searchOperation = conn.processSearch(request);
      List<Attribute> attrList =
          searchOperation.getSearchEntries().get(0).getAttribute(
              descriptionType);
      assertNotNull(attrList);
      List<Attribute> attrList = searchOperation.getSearchEntries().get(0).getAttribute(descriptionType);
      assertEquals(attrList.size(), 1);
      Attribute attr = attrList.get(0);
@@ -314,10 +311,7 @@
      final SearchRequest request = newSearchRequest(DN.valueOf(userDN), SearchScope.BASE_OBJECT);
      InternalSearchOperation searchOperation = conn.processSearch(request);
      List<Attribute> attrList =
          searchOperation.getSearchEntries().get(0).getAttribute(
              descriptionType);
      assertNotNull(attrList);
      List<Attribute> attrList = searchOperation.getSearchEntries().get(0).getAttribute(descriptionType);
      assertEquals(attrList.size(), 1);
      Attribute attr = attrList.get(0);
@@ -383,10 +377,7 @@
      final SearchRequest request = newSearchRequest(DN.valueOf(userDN), SearchScope.BASE_OBJECT);
      InternalSearchOperation searchOperation = conn.processSearch(request);
      List<Attribute> attrList =
          searchOperation.getSearchEntries().get(0).getAttribute(
              descriptionType);
      assertNotNull(attrList);
      List<Attribute> attrList = searchOperation.getSearchEntries().get(0).getAttribute(descriptionType);
      assertEquals(attrList.size(), 1);
      Attribute attr = attrList.get(0);
@@ -451,10 +442,7 @@
      final SearchRequest request = newSearchRequest(DN.valueOf(userDN), SearchScope.BASE_OBJECT);
      InternalSearchOperation searchOperation = conn.processSearch(request);
      List<Attribute> attrList =
          searchOperation.getSearchEntries().get(0).getAttribute(
              descriptionType);
      assertNotNull(attrList);
      List<Attribute> attrList = searchOperation.getSearchEntries().get(0).getAttribute(descriptionType);
      assertEquals(attrList.size(), 1);
      Attribute attr = attrList.get(0);
@@ -518,10 +506,7 @@
      final SearchRequest request = newSearchRequest(DN.valueOf(userDN), SearchScope.BASE_OBJECT);
      InternalSearchOperation searchOperation = conn.processSearch(request);
      List<Attribute> attrList =
          searchOperation.getSearchEntries().get(0).getAttribute(
              descriptionType);
      assertNotNull(attrList);
      List<Attribute> attrList = searchOperation.getSearchEntries().get(0).getAttribute(descriptionType);
      assertEquals(attrList.size(), 1);
      Attribute a = attrList.get(0);
@@ -595,7 +580,6 @@
      InternalSearchOperation searchOperation = conn.processSearch(request);
      List<Attribute> attrList = searchOperation.getSearchEntries().get(0).getAttribute(descriptionType);
      assertNotNull(attrList);
      assertEquals(attrList.size(), 1);
      Attribute a = attrList.get(0);
opendj-server-legacy/src/test/java/org/opends/server/plugins/EntryUUIDPluginTestCase.java
@@ -26,7 +26,7 @@
 */
package org.opends.server.plugins;
import static org.assertj.core.api.Assertions.*;
import java.io.ByteArrayInputStream;
import java.util.ArrayList;
@@ -49,8 +49,6 @@
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.testng.Assert.*;
/**
 * This class defines a set of tests for the
 * org.opends.server.plugins.EntryUUIDPlugin class.
@@ -274,7 +272,7 @@
         DirectoryServer.getPluginConfigManager().getRegisteredPlugin(dn);
    plugin.doLDIFImport(importConfig, e);
    assertNotNull(e.getAttribute("entryuuid"));
    assertThat(e.getAttribute("entryuuid")).isNotEmpty();
  }
@@ -315,7 +313,7 @@
         DirectoryServer.getPluginConfigManager().getRegisteredPlugin(dn);
    plugin.doLDIFImport(importConfig, e);
    assertNotNull(e.getAttribute("entryuuid"));
    assertThat(e.getAttribute("entryuuid")).isNotEmpty();
  }
@@ -334,7 +332,7 @@
                                      "objectClass: top",
                                      "objectClass: device",
                                      "cn: test");
    assertNotNull(e.getAttribute("entryuuid"));
    assertThat(e.getAttribute("entryuuid")).isNotEmpty();
  }
@@ -356,7 +354,6 @@
                                      "objectClass: device",
                                      "cn: test",
                                      "entryUUID: " + UUID.randomUUID());
    assertNotNull(e.getAttribute("entryuuid"));
    assertThat(e.getAttribute("entryuuid")).isNotEmpty();
  }
}
opendj-server-legacy/src/test/java/org/opends/server/plugins/LDAPADListPluginTestCase.java
@@ -26,6 +26,11 @@
 */
package org.opends.server.plugins;
import static org.assertj.core.api.Assertions.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.protocols.internal.Requests.*;
import static org.testng.Assert.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@@ -46,10 +51,6 @@
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.protocols.internal.Requests.*;
import static org.testng.Assert.*;
/**
 * This class defines a set of tests for the
 * org.opends.server.plugins.LDAPADListPlugin class.
@@ -280,7 +281,6 @@
    assertFalse(searchOperation.getSearchEntries().isEmpty());
    Entry e = searchOperation.getSearchEntries().get(0);
    assertNotNull(e.getAttribute("o"));
    assertThat(e.getAttribute("o")).isNotEmpty();
  }
}
opendj-server-legacy/src/test/java/org/opends/server/plugins/LastModPluginTestCase.java
@@ -26,6 +26,10 @@
 */
package org.opends.server.plugins;
import static org.assertj.core.api.Assertions.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.testng.Assert.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@@ -53,9 +57,6 @@
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.testng.Assert.*;
/**
 * This class defines a set of tests for the
 * org.opends.server.plugins.LastModPlugin class.
@@ -285,8 +286,8 @@
                                      "objectClass: top",
                                      "objectClass: device",
                                      "cn: test");
    assertNotNull(e.getAttribute("creatorsname"));
    assertNotNull(e.getAttribute("createtimestamp"));
    assertThat(e.getAttribute("creatorsname")).isNotEmpty();
    assertThat(e.getAttribute("createtimestamp")).isNotEmpty();
  }
@@ -314,8 +315,8 @@
    Entry e = DirectoryConfig.getEntry(DN.valueOf("o=test"));
    assertNotNull(e);
    assertNotNull(e.getAttribute("modifiersname"));
    assertNotNull(e.getAttribute("modifytimestamp"));
    assertThat(e.getAttribute("modifiersname")).isNotEmpty();
    assertThat(e.getAttribute("modifytimestamp")).isNotEmpty();
  }
@@ -341,8 +342,7 @@
    e = DirectoryConfig.getEntry(DN.valueOf("cn=test2,o=test"));
    assertNotNull(e);
    assertNotNull(e.getAttribute("modifiersname"));
    assertNotNull(e.getAttribute("modifytimestamp"));
    assertThat(e.getAttribute("modifiersname")).isNotEmpty();
    assertThat(e.getAttribute("modifytimestamp")).isNotEmpty();
  }
}
opendj-server-legacy/src/test/java/org/opends/server/plugins/SambaPasswordPluginTestCase.java
@@ -26,6 +26,7 @@
 */
package org.opends.server.plugins;
import static org.assertj.core.api.Assertions.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.util.CollectionUtils.*;
import static org.opends.server.util.StaticUtils.*;
@@ -240,7 +241,6 @@
    assertNotNull(entry);
    List<Attribute> sambaAttribute = entry.getAttribute("sambantpassword");
    assertNotNull(sambaAttribute);
    boolean foundNTPassword = false;
    for (Attribute a : sambaAttribute)
    {
@@ -253,7 +253,6 @@
    assertTrue(foundNTPassword, "NT password not found in test entry");
    sambaAttribute = entry.getAttribute("sambalmpassword");
    assertNotNull(sambaAttribute);
    boolean foundLMPassword = false;
    for (Attribute a : sambaAttribute)
    {
@@ -346,8 +345,8 @@
    Entry entry = DirectoryServer.getEntry(testEntry.getName());
    assertNotNull(entry);
    assertNull(entry.getAttribute("sambantpassword"));
    assertNull(entry.getAttribute("sambalmpassword"));
    assertThat(entry.getAttribute("sambantpassword")).isEmpty();
    assertThat(entry.getAttribute("sambalmpassword")).isEmpty();
    TestCaseUtils.deleteEntry(entry);
  }
@@ -546,14 +545,8 @@
    Entry entry = DirectoryServer.getEntry(testEntry.getName());
    assertNotNull(entry);
    List<Attribute> sambaAttribute = entry.getAttribute("sambantpassword");
    assertNull(sambaAttribute);
    sambaAttribute = entry.getAttribute("sambalmpassword");
    assertNull(sambaAttribute);
    assertThat(entry.getAttribute("sambantpassword")).isEmpty();
    assertThat(entry.getAttribute("sambalmpassword")).isEmpty();
    TestCaseUtils.deleteEntry(entry);
  }
opendj-server-legacy/src/test/java/org/opends/server/replication/UpdateOperationTest.java
@@ -1080,7 +1080,7 @@
   */
  private boolean assertConflictAttributeExists(Entry entry)
  {
    return entry.getAttribute("ds-sync-confict") != null;
    return !entry.getAttribute("ds-sync-confict").isEmpty();
  }
  @DataProvider(name="assured")
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/AssuredReplicationPluginTest.java
@@ -1463,7 +1463,7 @@
    }
    List<Attribute> attrs = entry.getAttribute(assuredAttr);
    if (attrs == null || attrs.isEmpty())
    if (attrs.isEmpty())
    {
      return Collections.emptyMap();
    }
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/AttrHistoricalMultipleTest.java
@@ -441,7 +441,7 @@
  private List<ByteString> getValues(List<Attribute> attributes)
  {
    if (attributes != null)
    if (!attributes.isEmpty())
    {
      assertThat(attributes).hasSize(1);
      return getValues(attributes.get(0));
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/AttrHistoricalSingleTest.java
@@ -368,7 +368,7 @@
  private ByteString getActualValue(List<Attribute> attributes)
  {
    if (attributes != null)
    if (!attributes.isEmpty())
    {
      assertThat(attributes).hasSize(1);
      Attribute attribute = attributes.get(0);
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/FractionalReplicationTest.java
@@ -50,6 +50,8 @@
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.testng.Assert.fail;
import static org.assertj.core.api.Assertions.*;
import static org.opends.server.TestCaseUtils.*;
import static org.opends.server.util.CollectionUtils.*;
import static org.testng.Assert.*;
@@ -547,9 +549,8 @@
      AttributeType synchronizationGenIDType =
          DirectoryServer.getAttributeTypeOrNull(REPLICATION_GENERATION_ID);
      List<Attribute> attrs =
          resultEntry.getAttribute(synchronizationGenIDType);
      if (attrs != null)
      List<Attribute> attrs = resultEntry.getAttribute(synchronizationGenIDType);
      if (!attrs.isEmpty())
      {
        Attribute attr = attrs.get(0);
        if (attr.size() == 1)
@@ -774,24 +775,17 @@
   * Check that the provided entry has a single value attribute which has the
   * expected attribute value
   */
  private static void checkEntryAttributeValue(Entry entry, String attributeName,
    String attributeValue)
  private static void checkEntryAttributeValue(Entry entry, String attributeName, String attributeValue)
  {
    List<Attribute> attrs = entry.getAttribute(attributeName.toLowerCase());
    assertNotNull(attrs, "Was expecting attribute " + attributeName + "=" +
      attributeValue + " but got no attribute");
    assertEquals(attrs.size(), 1);
    assertThat(attrs).as("Was expecting attribute " + attributeName + "=" + attributeValue).hasSize(1);
    Attribute attr = attrs.get(0);
    assertNotNull(attr);
    Iterator<ByteString> attrValues = attr.iterator();
    assertNotNull(attrValues);
    assertTrue(attrValues.hasNext());
    ByteString attrValue = attrValues.next();
    assertNotNull(attrValue);
    assertFalse(attrValues.hasNext());
    assertEquals(attrValue.toString(), attributeValue, "Was expecting attribute " +
      attributeName + "=" + attributeValue + " but got value: " + attrValue);
  }
  /**
@@ -1472,17 +1466,14 @@
      replicationDomain.publish(modDnMsg);
      /*
       * check that entry has been renamed  and has only attribute left in the
       * new RDN
       */
      // check that entry has been renamed and has only attribute left in the new RDN
      newEntry = getEntry(newEntryDn, TIMEOUT, true);
      assertNotNull(newEntry);
      assertEquals(newEntryDn, newEntry.getName());
      objectClass = DirectoryServer.getObjectClass("inetOrgPerson".toLowerCase());
      assertTrue(newEntry.hasObjectClass(objectClass));
      checkEntryAttributeValue(newEntry, "displayName", "ValueToBeKept");
      assertNull(newEntry.getAttribute("description"));
      assertThat(newEntry.getAttribute("description")).isEmpty();
    }
    finally
    {
@@ -1553,17 +1544,14 @@
      replicationDomain.publish(modDnMsg);
      /*
       * check that entry has been renamed  and has only attribute left in the
       * new RDN
       */
      // check that entry has been renamed and has only attribute left in the * new RDN
      newEntry = getEntry(newEntryDn, TIMEOUT, true);
      assertNotNull(newEntry);
      assertEquals(newEntryDn, newEntry.getName());
      objectClass = DirectoryServer.getObjectClass("inetOrgPerson".toLowerCase());
      assertTrue(newEntry.hasObjectClass(objectClass));
      checkEntryAttributeValue(newEntry, "displayName", "ValueToBeKept");
      assertNull(newEntry.getAttribute("description"));
      assertThat(newEntry.getAttribute("description")).isEmpty();
    }
    finally
    {
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ModifyConflictTest.java
@@ -1244,8 +1244,7 @@
    testModify(entry, hist, 1, true, newModification(DELETE, DISPLAYNAME, "aValue"));
    // The entry should have no value
    List<Attribute> attrs = entry.getAttribute(DISPLAYNAME);
    assertNull(attrs);
    assertThat(entry.getAttribute(DISPLAYNAME)).isEmpty();
  }
  /**
@@ -1275,8 +1274,7 @@
    assertEquals(hist.encodeAndPurge(), attr);
    // The entry should have no value
    List<Attribute> attrs = entry.getAttribute(DISPLAYNAME);
    assertNull(attrs);
    assertThat(entry.getAttribute(DISPLAYNAME)).isEmpty();
  }
  /**
@@ -1318,8 +1316,7 @@
    assertEquals(hist.encodeAndPurge(), attrDel);
    // The entry should have no value
    List<Attribute> attrs = entry.getAttribute(DISPLAYNAME);
    assertNull(attrs);
    assertThat(entry.getAttribute(DISPLAYNAME)).isEmpty();
  }
  /**
@@ -1364,8 +1361,7 @@
    // The entry should have no value
    List<Attribute> attrs = entry.getAttribute(DESCRIPTION);
    attr = Attributes.create(DESCRIPTION, "value2", "value3", "value4");
    assertEquals(attrs.get(0), attr);
    assertEquals(attrs.get(0), Attributes.create(DESCRIPTION, "value2", "value3", "value4"));
  }
  /**
@@ -1412,8 +1408,7 @@
    // The entry should have no value
    List<Attribute> attrs = entry.getAttribute(DESCRIPTION);
    attr = Attributes.create(DESCRIPTION, "value3", "value4");
    assertEquals(attrs.get(0), attr);
    assertEquals(attrs.get(0), Attributes.create(DESCRIPTION, "value3", "value4"));
  }
  /**
@@ -1455,8 +1450,7 @@
    assertEquals(hist.encodeAndPurge(), attrDel);
    // The entry should have no value
    List<Attribute> attrs = entry.getAttribute(DISPLAYNAME);
    assertNull(attrs);
    assertThat(entry.getAttribute(DISPLAYNAME)).isEmpty();
  }
  /**
@@ -1486,8 +1480,7 @@
    assertEquals(hist.encodeAndPurge(), attr);
    // The entry should have no value
    List<Attribute> attrs = entry.getAttribute(DISPLAYNAME);
    assertNull(attrs);
    assertThat(entry.getAttribute(DISPLAYNAME)).isEmpty();
  }
  /**
@@ -1517,8 +1510,7 @@
    assertEquals(hist.encodeAndPurge(), attr);
    // The entry should have no value
    List<Attribute> attrs = entry.getAttribute(DISPLAYNAME);
    assertNull(attrs);
    assertThat(entry.getAttribute(DISPLAYNAME)).isEmpty();
  }
  /**
@@ -1557,8 +1549,7 @@
    assertEquals(hist.encodeAndPurge(), attrDel);
    // The entry should have no value
    List<Attribute> attrs = entry.getAttribute(DISPLAYNAME);
    assertNull(attrs);
    assertThat(entry.getAttribute(DISPLAYNAME)).isEmpty();
  }
  /**
@@ -1597,8 +1588,7 @@
    assertEquals(hist.encodeAndPurge(), attrDel);
    // The entry should have no value
    List<Attribute> attrs = entry.getAttribute(DISPLAYNAME);
    assertNull(attrs);
    assertThat(entry.getAttribute(DISPLAYNAME)).isEmpty();
  }
  /**
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/NamingConflictTest.java
@@ -50,6 +50,7 @@
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import static org.assertj.core.api.Assertions.*;
import static org.opends.server.TestCaseUtils.*;
import static org.opends.server.core.DirectoryServer.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
@@ -158,7 +159,7 @@
    assertEquals(getEntryUUID(resultEntry.getName()),
        "c9cb8c3c-615a-4122-865d-50323aaaed48",
        "The wrong entry has been renamed");
    assertNull(resultEntry.getAttribute(LDAPReplicationDomain.DS_SYNC_CONFLICT));
    assertThat(resultEntry.getAttribute(LDAPReplicationDomain.DS_SYNC_CONFLICT)).isEmpty();
  }
  private AddMsg addMsg(Entry entry, CSN csn, String parentUUID, String childUUID)
@@ -199,7 +200,7 @@
    assertEquals(getEntryUUID(resultEntry.getName()),
        "c9cb8c3c-615a-4122-865d-50323aaaed48",
        "The wrong entry has been renamed");
    assertNull(resultEntry.getAttribute(LDAPReplicationDomain.DS_SYNC_CONFLICT));
    assertThat(resultEntry.getAttribute(LDAPReplicationDomain.DS_SYNC_CONFLICT)).isEmpty();
  }
  private Entry createAndAddEntry(String commonName) throws Exception
opendj-server-legacy/src/test/java/org/opends/server/schema/GenericSchemaTestCase.java
@@ -27,35 +27,29 @@
 */
package org.opends.server.schema;
import java.io.File;
import java.util.List;
import java.util.TreeSet;
import java.util.StringTokenizer;
import java.util.TreeSet;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.ldap.schema.Syntax;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.schema.MatchingRule;
import org.forgerock.opendj.ldap.schema.Syntax;
import org.opends.server.TestCaseUtils;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeType;
import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.types.Entry;
import org.opends.server.types.LDIFImportConfig;
import org.opends.server.types.NameForm;
import org.opends.server.types.ObjectClass;
import org.opends.server.types.Schema;
import org.opends.server.util.LDIFReader;
import static org.testng.Assert.*;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import static org.opends.server.util.ServerConstants.*;
import static org.testng.Assert.*;
/**
 * This class defines a set of generic tests that may be used to examine the
@@ -69,6 +63,7 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Override
  @BeforeClass
  public void setUp()
         throws Exception
@@ -185,7 +180,7 @@
      AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("attributetypes");
      assertNotNull(attrType);
      List<Attribute> attrList = e.getAttribute(attrType);
      if (attrList == null)
      if (attrList.isEmpty())
      {
        // No attribute types in the schema file.  This is OK.
        continue;
@@ -260,7 +255,7 @@
      AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("objectclasses");
      assertNotNull(attrType);
      List<Attribute> attrList = e.getAttribute(attrType);
      if (attrList == null)
      if (attrList.isEmpty())
      {
        // No attribute types in the schema file.  This is OK.
        continue;
@@ -334,7 +329,7 @@
      AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("nameforms");
      assertNotNull(attrType);
      List<Attribute> attrList = e.getAttribute(attrType);
      if (attrList == null)
      if (attrList.isEmpty())
      {
        // No attribute types in the schema file.  This is OK.
        continue;
opendj-server-legacy/src/test/java/org/opends/server/tasks/DummyTask.java
@@ -58,7 +58,6 @@
    return LocalizableMessage.raw("Dummy");
  }
  /** {@inheritDoc} */
  @Override
  public void initializeTask()
         throws DirectoryException
@@ -69,11 +68,7 @@
    Entry taskEntry = getTaskEntry();
    if (taskEntry != null)
    {
      List<Attribute> attrList =
           taskEntry.getAttribute("ds-task-dummy-sleep-time");
      if (attrList != null)
      {
        for (Attribute a : attrList)
      for (Attribute a : taskEntry.getAttribute("ds-task-dummy-sleep-time"))
        {
          for (ByteString v : a)
          {
@@ -82,7 +77,6 @@
        }
      }
    }
  }
opendj-server-legacy/src/test/java/org/opends/server/tools/LDIFSearchTestCase.java
@@ -27,22 +27,25 @@
package org.opends.server.tools;
import static org.assertj.core.api.Assertions.*;
import static org.testng.Assert.*;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import org.opends.server.TestCaseUtils;
import org.opends.server.types.Entry;
import org.opends.server.types.LDIFImportConfig;
import org.opends.server.util.LDIFException;
import org.opends.server.util.LDIFReader;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.testng.annotations.AfterClass;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertEquals;
import org.opends.server.TestCaseUtils;
import org.opends.server.types.LDIFImportConfig;
import org.opends.server.types.Entry;
import org.opends.server.util.LDIFReader;
import java.io.*;
/**
 * LDIFSearch test cases.
 */
/** LDIFSearch test cases. */
@SuppressWarnings("javadoc")
public class LDIFSearchTestCase extends ToolsTestCase {
@@ -117,12 +120,8 @@
      "*", "+"
    };
    assertEquals(LDIFSearch.mainSearch(args, false, System.out, System.err), 0);
    LDIFImportConfig ldifConfig = new LDIFImportConfig(outLdifFilePath);
    ldifConfig.setValidateSchema(false);
    LDIFReader reader = new LDIFReader(ldifConfig);
    Entry e=reader.readEntry();
    reader.close();
    assertNotNull(e.getAttribute("objectclass"));
    Entry e = readEntry();
    assertThat(e.getAttribute("objectclass")).isNotEmpty();
  }
  /**
@@ -143,12 +142,8 @@
      "+"
    };
    assertEquals(LDIFSearch.mainSearch(args, false, System.out, System.err), 0);
    LDIFImportConfig ldifConfig = new LDIFImportConfig(outLdifFilePath);
    ldifConfig.setValidateSchema(false);
    LDIFReader reader = new LDIFReader(ldifConfig);
    Entry e=reader.readEntry();
    reader.close();
    assertNull(e.getAttribute("objectclass"));
    Entry e = readEntry();
    assertThat(e.getAttribute("objectclass")).isEmpty();
  }
  /**
@@ -170,14 +165,21 @@
      "+", "mail", "uid"
    };
    assertEquals(LDIFSearch.mainSearch(args, false, System.out, System.err), 0);
    Entry e = readEntry();
    assertThat(e.getAttribute("objectclass")).isEmpty();
    assertThat(e.getAttribute("mail")).isNotEmpty();
    assertThat(e.getAttribute("uid")).isNotEmpty();
  }
  private Entry readEntry() throws IOException, LDIFException
  {
    LDIFImportConfig ldifConfig = new LDIFImportConfig(outLdifFilePath);
    ldifConfig.setValidateSchema(false);
    LDIFReader reader = new LDIFReader(ldifConfig);
    Entry e=reader.readEntry();
    reader.close();
    assertNull(e.getAttribute("objectclass"));
    assertNotNull(e.getAttribute("mail"));
    assertNotNull(e.getAttribute("uid"));
    try (LDIFReader reader = new LDIFReader(ldifConfig))
    {
      return reader.readEntry();
    }
  }
  /**
@@ -187,7 +189,6 @@
   * @throws Exception  The objectclass attribute is returned or one of the
   * specified attributes is not returned.
   */
 @Test
  public void testLDIFSearchAttrsOnly() throws Exception {
@@ -201,13 +202,9 @@
      "mail", "uid"
    };
    assertEquals(LDIFSearch.mainSearch(args, false, System.out, System.err), 0);
    LDIFImportConfig ldifConfig = new LDIFImportConfig(outLdifFilePath);
    ldifConfig.setValidateSchema(false);
    LDIFReader reader = new LDIFReader(ldifConfig);
    Entry e=reader.readEntry();
    reader.close();
    assertNull(e.getAttribute("objectclass"));
    assertNotNull(e.getAttribute("mail"));
    assertNotNull(e.getAttribute("uid"));
    Entry e = readEntry();
    assertThat(e.getAttribute("objectclass")).isEmpty();
    assertThat(e.getAttribute("mail")).isNotEmpty();
    assertThat(e.getAttribute("uid")).isNotEmpty();
  }
}
opendj-server-legacy/src/test/java/org/opends/server/tools/makeldif/MakeLDIFTestCase.java
@@ -26,8 +26,8 @@
 */
package org.opends.server.tools.makeldif;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -37,6 +37,7 @@
import org.opends.server.tasks.LdifFileWriter;
import org.opends.server.tools.ToolsTestCase;
import org.opends.server.types.*;
import org.opends.server.util.LDIFException;
import org.opends.server.util.LDIFReader;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
@@ -45,7 +46,6 @@
import static org.testng.Assert.*;
import static org.opends.messages.ToolMessages.*;
/**
 * A set of test cases for the MakeLDIF tool.
 */
@@ -324,14 +324,7 @@
    LdifFileWriter.makeLdif(outLdifFilePath, resourcePath, lines);
    LDIFImportConfig ldifConfig = new LDIFImportConfig(outLdifFilePath);
    ldifConfig.setValidateSchema(false);
    LDIFReader reader = new LDIFReader(ldifConfig);
    Entry top = reader.readEntry();
    Entry e = reader.readEntry();
    reader.close();
    assertNotNull(top);
    Entry e = readEntry(outLdifFilePath);
    assertNotNull(e);
    List<Attribute> attrs = e.getAttribute(attrName);
    assertFalse(attrs.isEmpty());
@@ -340,6 +333,17 @@
    assertEquals(a, expectedRes);
  }
  private Entry readEntry(String outLdifFilePath) throws IOException, LDIFException
  {
    LDIFImportConfig ldifConfig = new LDIFImportConfig(outLdifFilePath);
    ldifConfig.setValidateSchema(false);
    try (LDIFReader reader = new LDIFReader(ldifConfig))
    {
      assertNotNull(reader.readEntry());
      return reader.readEntry();
    }
  }
  /**
   * Test for escaped characters in templates, check LDIF output when
   * the templates combines escaped characters and variables.
@@ -370,14 +374,7 @@
    LdifFileWriter.makeLdif(outLdifFilePath, resourcePath, lines);
    LDIFImportConfig ldifConfig = new LDIFImportConfig(outLdifFilePath);
    ldifConfig.setValidateSchema(false);
    LDIFReader reader = new LDIFReader(ldifConfig);
    Entry top = reader.readEntry();
    Entry e = reader.readEntry();
    reader.close();
    assertNotNull(top);
    Entry e = readEntry(outLdifFilePath);
    assertNotNull(e);
    List<Attribute> attrs = e.getAttribute("cn");
    assertFalse(attrs.isEmpty());
@@ -386,4 +383,3 @@
        "cn value doesn't match the expected value");
  }
}
opendj-server-legacy/src/test/java/org/opends/server/types/TestEntry.java
@@ -26,6 +26,10 @@
 */
package org.opends.server.types;
import static org.assertj.core.api.Assertions.*;
import static org.opends.server.util.CollectionUtils.*;
import static org.testng.Assert.*;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
@@ -42,14 +46,12 @@
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import static org.opends.server.util.CollectionUtils.*;
import static org.testng.Assert.*;
/**
 * This class defines a set of tests for the {@link Entry} class.
 * <p>
 * At the moment this test suite only tests the parseAttribute method.
 */
@SuppressWarnings("javadoc")
public final class TestEntry extends TypesTestCase {
  /**
@@ -474,220 +476,56 @@
    AttributeType uidType  = DirectoryServer.getAttributeTypeOrNull("uid");
    AttributeType mnType   = DirectoryServer.getAttributeTypeOrNull("modifiersname");
    List<Attribute> attrs = e.getAttribute(ocType);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 1);
    assertThat(e.getAttribute(ocType)).hasSize(1);
    assertThat(e.getAttribute(cnType)).hasSize(2);
    assertThat(e.getAttribute(nameType)).hasSize(6);
    attrs = e.getAttribute(cnType);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 2);
    attrs = e.getAttribute(nameType);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 6);
    attrs = e.getAttribute(nameType, false);
    assertNull(attrs);
    attrs = e.getAttribute(uidType);
    assertNull(attrs);
    attrs = e.getAttribute(mnType);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 1);
    attrs = e.getAttribute("objectclass");
    assertNotNull(attrs);
    assertEquals(attrs.size(), 1);
    attrs = e.getAttribute("cn");
    assertNotNull(attrs);
    assertEquals(attrs.size(), 2);
    attrs = e.getAttribute("uid");
    assertNull(attrs);
    attrs = e.getAttribute("modifiersname");
    assertNotNull(attrs);
    assertEquals(attrs.size(), 1);
    assertThat(e.getAttribute(nameType, false)).isEmpty();
    assertThat(e.getAttribute(uidType)).isEmpty();
    assertThat(e.getAttribute(mnType)).hasSize(1);
    assertThat(e.getAttribute("objectclass")).hasSize(1);
    assertThat(e.getAttribute("cn")).hasSize(2);
    assertThat(e.getAttribute("uid")).isEmpty();
    assertThat(e.getAttribute("modifiersname")).hasSize(1);
    LinkedHashSet<String> options = null;
    attrs = e.getAttribute(ocType, options);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 1);
    assertThat(e.getAttribute(ocType, options)).hasSize(1);
    assertThat(e.getAttribute(cnType, options)).hasSize(2);
    assertThat(e.getAttribute(nameType, options)).hasSize(6);
    attrs = e.getAttribute(cnType, options);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 2);
    attrs = e.getAttribute(nameType, options);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 6);
    attrs = e.getAttribute(nameType, false, options);
    assertNull(attrs);
    attrs = e.getAttribute(uidType, options);
    assertNull(attrs);
    attrs = e.getAttribute(mnType, options);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 1);
    attrs = e.getAttribute("objectclass", options);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 1);
    attrs = e.getAttribute("cn", options);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 2);
    attrs = e.getAttribute("uid", options);
    assertNull(attrs);
    attrs = e.getAttribute("modifiersname", options);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 1);
    assertThat(e.getAttribute(uidType, options)).isEmpty();
    assertThat(e.getAttribute(mnType, options)).hasSize(1);
    options = new LinkedHashSet<>();
    attrs = e.getAttribute(ocType, options);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 1);
    assertThat(e.getAttribute(ocType, options)).hasSize(1);
    assertThat(e.getAttribute(cnType, options)).hasSize(2);
    assertThat(e.getAttribute(nameType, options)).hasSize(6);
    attrs = e.getAttribute(cnType, options);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 2);
    attrs = e.getAttribute(nameType, options);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 6);
    attrs = e.getAttribute(nameType, false, options);
    assertNull(attrs);
    attrs = e.getAttribute(uidType, options);
    assertNull(attrs);
    attrs = e.getAttribute(mnType, options);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 1);
    attrs = e.getAttribute("objectclass", options);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 1);
    attrs = e.getAttribute("cn", options);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 2);
    attrs = e.getAttribute("uid", options);
    assertNull(attrs);
    attrs = e.getAttribute("modifiersname", options);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 1);
    assertThat(e.getAttribute(uidType, options)).isEmpty();
    assertThat(e.getAttribute(mnType, options)).hasSize(1);
    options.add("lang-en-US");
    attrs = e.getAttribute(ocType, options);
    assertNull(attrs);
    assertThat(e.getAttribute(ocType, options)).isEmpty();
    assertThat(e.getAttribute(cnType, options)).hasSize(1);
    assertThat(e.getAttribute(nameType, options)).hasSize(3);
    attrs = e.getAttribute(cnType, options);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 1);
    attrs = e.getAttribute(nameType, options);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 3);
    attrs = e.getAttribute(nameType, false, options);
    assertNull(attrs);
    attrs = e.getAttribute(uidType, options);
    assertNull(attrs);
    attrs = e.getAttribute(mnType, options);
    assertNull(attrs);
    attrs = e.getAttribute("objectclass", options);
    assertNull(attrs);
    attrs = e.getAttribute("cn", options);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 1);
    attrs = e.getAttribute("uid", options);
    assertNull(attrs);
    attrs = e.getAttribute("modifiersname", options);
    assertNull(attrs);
    assertThat(e.getAttribute(uidType, options)).isEmpty();
    assertThat(e.getAttribute(mnType, options)).isEmpty();
    options.add("lang-en-GB");
    attrs = e.getAttribute(ocType, options);
    assertNull(attrs);
    attrs = e.getAttribute(cnType, options);
    assertNull(attrs);
    attrs = e.getAttribute(nameType, options);
    assertNull(attrs);
    attrs = e.getAttribute(uidType, options);
    assertNull(attrs);
    attrs = e.getAttribute(mnType, options);
    assertNull(attrs);
    attrs = e.getAttribute("objectclass", options);
    assertNull(attrs);
    attrs = e.getAttribute("cn", options);
    assertNull(attrs);
    attrs = e.getAttribute("uid", options);
    assertNull(attrs);
    attrs = e.getAttribute("modifiersname", options);
    assertNull(attrs);
    assertThat(e.getAttribute(ocType, options)).isEmpty();
    assertThat(e.getAttribute(cnType, options)).isEmpty();
    assertThat(e.getAttribute(nameType, options)).isEmpty();
    assertThat(e.getAttribute(uidType, options)).isEmpty();
    assertThat(e.getAttribute(mnType, options)).isEmpty();
    options.clear();
    options.add("lang-en-GB");
    attrs = e.getAttribute(ocType, options);
    assertNull(attrs);
    attrs = e.getAttribute(cnType, options);
    assertNull(attrs);
    attrs = e.getAttribute(nameType, options);
    assertNull(attrs);
    attrs = e.getAttribute(uidType, options);
    assertNull(attrs);
    attrs = e.getAttribute(mnType, options);
    assertNull(attrs);
    attrs = e.getAttribute("objectclass", options);
    assertNull(attrs);
    attrs = e.getAttribute("cn", options);
    assertNull(attrs);
    attrs = e.getAttribute("uid", options);
    assertNull(attrs);
    attrs = e.getAttribute("modifiersname", options);
    assertNull(attrs);
    assertThat(e.getAttribute(ocType, options)).isEmpty();
    assertThat(e.getAttribute(cnType, options)).isEmpty();
    assertThat(e.getAttribute(nameType, options)).isEmpty();
    assertThat(e.getAttribute(uidType, options)).isEmpty();
    assertThat(e.getAttribute(mnType, options)).isEmpty();
  }
@@ -729,114 +567,11 @@
    AttributeType uidType  = DirectoryServer.getAttributeTypeOrNull("uid");
    AttributeType mnType   = DirectoryServer.getAttributeTypeOrNull("modifiersname");
    List<Attribute> attrs = e.getUserAttribute(ocType);
    assertNull(attrs);
    attrs = e.getUserAttribute(cnType);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 2);
    attrs = e.getUserAttribute(nameType);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 6);
    attrs = e.getUserAttribute(uidType);
    assertNull(attrs);
    attrs = e.getUserAttribute(mnType);
    assertNull(attrs);
    LinkedHashSet<String> options = null;
    attrs = e.getUserAttribute(ocType, options);
    assertNull(attrs);
    attrs = e.getUserAttribute(cnType, options);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 2);
    attrs = e.getUserAttribute(nameType, options);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 6);
    attrs = e.getUserAttribute(uidType, options);
    assertNull(attrs);
    attrs = e.getUserAttribute(mnType, options);
    assertNull(attrs);
    options = new LinkedHashSet<>();
    attrs = e.getUserAttribute(ocType, options);
    assertNull(attrs);
    attrs = e.getUserAttribute(cnType, options);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 2);
    attrs = e.getUserAttribute(nameType, options);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 6);
    attrs = e.getUserAttribute(uidType, options);
    assertNull(attrs);
    attrs = e.getUserAttribute(mnType, options);
    assertNull(attrs);
    options.add("lang-en-US");
    attrs = e.getUserAttribute(ocType, options);
    assertNull(attrs);
    attrs = e.getUserAttribute(cnType, options);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 1);
    attrs = e.getUserAttribute(nameType, options);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 3);
    attrs = e.getUserAttribute(uidType, options);
    assertNull(attrs);
    attrs = e.getUserAttribute(mnType, options);
    assertNull(attrs);
    options.add("lang-en-GB");
    attrs = e.getUserAttribute(ocType, options);
    assertNull(attrs);
    attrs = e.getUserAttribute(cnType, options);
    assertNull(attrs);
    attrs = e.getUserAttribute(nameType, options);
    assertNull(attrs);
    attrs = e.getUserAttribute(uidType, options);
    assertNull(attrs);
    attrs = e.getUserAttribute(mnType, options);
    assertNull(attrs);
    options.clear();
    options.add("lang-en-GB");
    attrs = e.getUserAttribute(ocType, options);
    assertNull(attrs);
    attrs = e.getUserAttribute(cnType, options);
    assertNull(attrs);
    attrs = e.getUserAttribute(nameType, options);
    assertNull(attrs);
    attrs = e.getUserAttribute(uidType, options);
    assertNull(attrs);
    attrs = e.getUserAttribute(mnType, options);
    assertNull(attrs);
    assertThat(e.getUserAttribute(ocType)).isEmpty();
    assertThat(e.getUserAttribute(cnType)).hasSize(2);
    assertThat(e.getUserAttribute(nameType)).hasSize(6);
    assertThat(e.getUserAttribute(uidType)).isEmpty();
    assertThat(e.getUserAttribute(mnType)).isEmpty();
  }
@@ -878,109 +613,46 @@
    AttributeType uidType  = DirectoryServer.getAttributeTypeOrNull("uid");
    AttributeType mnType   = DirectoryServer.getAttributeTypeOrNull("modifiersname");
    List<Attribute> attrs = e.getOperationalAttribute(ocType);
    assertNull(attrs);
    attrs = e.getOperationalAttribute(cnType);
    assertNull(attrs);
    attrs = e.getOperationalAttribute(nameType);
    assertNull(attrs);
    attrs = e.getOperationalAttribute(uidType);
    assertNull(attrs);
    attrs = e.getOperationalAttribute(mnType);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 1);
    assertThat(e.getOperationalAttribute(ocType)).isEmpty();
    assertThat(e.getOperationalAttribute(cnType)).isEmpty();
    assertThat(e.getOperationalAttribute(nameType)).isEmpty();
    assertThat(e.getOperationalAttribute(uidType)).isEmpty();
    assertThat(e.getOperationalAttribute(mnType)).hasSize(1);
    LinkedHashSet<String> options = null;
    attrs = e.getOperationalAttribute(ocType, options);
    assertNull(attrs);
    attrs = e.getOperationalAttribute(cnType, options);
    assertNull(attrs);
    attrs = e.getOperationalAttribute(nameType, options);
    assertNull(attrs);
    attrs = e.getOperationalAttribute(uidType, options);
    assertNull(attrs);
    attrs = e.getOperationalAttribute(mnType, options);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 1);
    assertThat(e.getOperationalAttribute(ocType, options)).isEmpty();
    assertThat(e.getOperationalAttribute(cnType, options)).isEmpty();
    assertThat(e.getOperationalAttribute(nameType, options)).isEmpty();
    assertThat(e.getOperationalAttribute(uidType, options)).isEmpty();
    assertThat(e.getOperationalAttribute(mnType, options)).hasSize(1);
    options = new LinkedHashSet<>();
    attrs = e.getOperationalAttribute(ocType, options);
    assertNull(attrs);
    attrs = e.getOperationalAttribute(cnType, options);
    assertNull(attrs);
    attrs = e.getOperationalAttribute(nameType, options);
    assertNull(attrs);
    attrs = e.getOperationalAttribute(uidType, options);
    assertNull(attrs);
    attrs = e.getOperationalAttribute(mnType, options);
    assertNotNull(attrs);
    assertEquals(attrs.size(), 1);
    assertThat(e.getOperationalAttribute(ocType, options)).isEmpty();
    assertThat(e.getOperationalAttribute(cnType, options)).isEmpty();
    assertThat(e.getOperationalAttribute(nameType, options)).isEmpty();
    assertThat(e.getOperationalAttribute(uidType, options)).isEmpty();
    assertThat(e.getOperationalAttribute(mnType, options)).hasSize(1);
    options.add("lang-en-US");
    attrs = e.getOperationalAttribute(ocType, options);
    assertNull(attrs);
    attrs = e.getOperationalAttribute(cnType, options);
    assertNull(attrs);
    attrs = e.getOperationalAttribute(nameType, options);
    assertNull(attrs);
    attrs = e.getOperationalAttribute(uidType, options);
    assertNull(attrs);
    attrs = e.getOperationalAttribute(mnType, options);
    assertNull(attrs);
    assertThat(e.getOperationalAttribute(ocType, options)).isEmpty();
    assertThat(e.getOperationalAttribute(cnType, options)).isEmpty();
    assertThat(e.getOperationalAttribute(nameType, options)).isEmpty();
    assertThat(e.getOperationalAttribute(uidType, options)).isEmpty();
    assertThat(e.getOperationalAttribute(mnType, options)).isEmpty();
    options.add("lang-en-GB");
    attrs = e.getOperationalAttribute(ocType, options);
    assertNull(attrs);
    attrs = e.getOperationalAttribute(cnType, options);
    assertNull(attrs);
    attrs = e.getOperationalAttribute(nameType, options);
    assertNull(attrs);
    attrs = e.getOperationalAttribute(uidType, options);
    assertNull(attrs);
    attrs = e.getOperationalAttribute(mnType, options);
    assertNull(attrs);
    assertThat(e.getOperationalAttribute(ocType, options)).isEmpty();
    assertThat(e.getOperationalAttribute(cnType, options)).isEmpty();
    assertThat(e.getOperationalAttribute(nameType, options)).isEmpty();
    assertThat(e.getOperationalAttribute(uidType, options)).isEmpty();
    assertThat(e.getOperationalAttribute(mnType, options)).isEmpty();
    options.clear();
    options.add("lang-en-GB");
    attrs = e.getOperationalAttribute(ocType, options);
    assertNull(attrs);
    attrs = e.getOperationalAttribute(cnType, options);
    assertNull(attrs);
    attrs = e.getOperationalAttribute(nameType, options);
    assertNull(attrs);
    attrs = e.getOperationalAttribute(uidType, options);
    assertNull(attrs);
    attrs = e.getOperationalAttribute(mnType, options);
    assertNull(attrs);
    assertThat(e.getOperationalAttribute(ocType, options)).isEmpty();
    assertThat(e.getOperationalAttribute(cnType, options)).isEmpty();
    assertThat(e.getOperationalAttribute(nameType, options)).isEmpty();
    assertThat(e.getOperationalAttribute(uidType, options)).isEmpty();
    assertThat(e.getOperationalAttribute(mnType, options)).isEmpty();
  }
}