From f15e69d46eb0444e28427f49fb519ea476c7feae Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Thu, 15 Oct 2015 19:38:35 +0000
Subject: [PATCH] Replaced calls to DirectoryServer.getDefaultAttributeType() by DirectoryServer.getAttributeTypeOrDefault(). + Directly used Attributes and AttributeBuilder methods which accepts a String instead of AttributeType parameter.

---
 opendj-server-legacy/src/main/java/org/opends/server/schema/DITContentRuleSyntax.java                   |    2 
 opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java                          |   26 --
 opendj-server-legacy/src/main/java/org/opends/server/schema/NameFormSyntax.java                         |    2 
 opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciEffectiveRights.java   |   17 -
 opendj-server-legacy/src/main/java/org/opends/server/monitors/VersionMonitorProvider.java               |  167 ++------------
 opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/DatabaseEnvironmentMonitor.java       |    7 
 opendj-server-legacy/src/main/java/org/opends/server/types/RDN.java                                     |    6 
 opendj-server-legacy/src/main/java/org/opends/server/types/Attributes.java                              |   16 -
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyEntryTask.java           |   13 
 opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java                        |   17 -
 opendj-server-legacy/src/main/java/org/opends/server/types/DN.java                                      |   15 
 opendj-server-legacy/src/main/java/org/opends/server/types/SearchFilter.java                            |    2 
 opendj-server-legacy/src/main/java/org/opends/server/monitors/MemoryUsageMonitorProvider.java           |   64 +----
 opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestModifyResponseProtocolOp.java   |   29 -
 opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestCompareResponseProtocolOp.java  |   29 -
 opendj-server-legacy/src/main/java/org/opends/server/monitors/StackTraceMonitorProvider.java            |    6 
 opendj-server-legacy/src/main/java/org/opends/server/backends/task/RecurringTask.java                   |   13 
 opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationMonitor.java        |   60 +----
 opendj-server-legacy/src/main/java/org/opends/server/schema/MatchingRuleUseSyntax.java                  |    2 
 opendj-server-legacy/src/main/java/org/opends/server/monitors/SystemInfoMonitorProvider.java            |   48 +---
 opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestModifyDNResponseProtocolOp.java |   24 -
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/Utilities.java                 |    2 
 opendj-server-legacy/src/test/java/org/opends/server/types/TestObjectClass.java                         |    2 
 opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestAddResponseProtocolOp.java      |   17 -
 opendj-server-legacy/src/main/java/org/opends/server/schema/AttributeTypeSyntax.java                    |    2 
 opendj-server-legacy/src/main/java/org/opends/server/schema/ObjectClassSyntax.java                      |    2 
 opendj-server-legacy/src/test/java/org/opends/server/types/AttributeTypeTest.java                       |    4 
 opendj-server-legacy/src/main/java/org/opends/server/monitors/ClientConnectionMonitorProvider.java      |    4 
 opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestDeleteResponseProtocolOp.java   |   26 -
 29 files changed, 161 insertions(+), 463 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyEntryTask.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyEntryTask.java
index 9c8cae7..092bf2a 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyEntryTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyEntryTask.java
@@ -61,8 +61,12 @@
 import org.opends.guitools.controlpanel.ui.nodes.BasicNode;
 import org.opends.guitools.controlpanel.util.Utilities;
 import org.opends.messages.AdminToolMessages;
-import org.opends.server.core.DirectoryServer;
-import org.opends.server.types.*;
+import org.opends.server.types.DN;
+import org.opends.server.types.DirectoryException;
+import org.opends.server.types.Entry;
+import org.opends.server.types.OpenDsException;
+import org.opends.server.types.RDN;
+import org.opends.server.types.Schema;
 
 /** The task that is called when we must modify an entry. */
 public class ModifyEntryTask extends Task
@@ -491,11 +495,6 @@
       {
         continue;
       }
-      AttributeType attrType = schema.getAttributeType(attr.getName().toLowerCase());
-      if (attrType == null)
-      {
-        attrType = DirectoryServer.getDefaultAttributeType(attr.getName().toLowerCase());
-      }
       List<ByteString> newValues = new ArrayList<>();
       Iterator<ByteString> it = attr.iterator();
       while (it.hasNext())
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/Utilities.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/Utilities.java
index be874dc..c5ae8b6 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/Utilities.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/Utilities.java
@@ -1491,7 +1491,7 @@
    */
   public static String getRDNString(String attrName, String attrValue)
   {
-    AttributeType attrType = DirectoryServer.getDefaultAttributeType(attrName);
+    AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attrName);
     RDN rdn = new RDN(attrType, attrName, ByteString.valueOf(attrValue));
     return rdn.toString();
   }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciEffectiveRights.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciEffectiveRights.java
index c4d71e6..9b7ad78 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciEffectiveRights.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciEffectiveRights.java
@@ -406,7 +406,7 @@
       // Only add the aclRights information if the aclRights attribute type was seen.
       if(hasAttrMask(mask, ACL_RIGHTS))  {
         String typeStr = aclRightsAttributeLevelStr + ";" + a.getNameOrOID();
-        AttributeType attributeType = DirectoryServer.getDefaultAttributeType(typeStr);
+        AttributeType attributeType = DirectoryServer.getAttributeTypeOrDefault(typeStr);
         Attribute attr = Attributes.create(attributeType, evalInfo.toString());
         //It is possible that the user might have specified the same attributes
         //in both the search and the specific attribute part of the control.
@@ -540,9 +540,7 @@
     evalInfo.append(rightsString(container, handler, skipCheck, "proxy"));
     addEntryLevelRightsInfo(container, mask, retEntry, "proxy");
     if(hasAttrMask(mask, ACL_RIGHTS)) {
-      AttributeType attributeType=
-              DirectoryServer.getDefaultAttributeType(aclRightsEntryLevelStr);
-      Attribute attr = Attributes.create(attributeType, evalInfo.toString());
+      Attribute attr = Attributes.create(aclRightsEntryLevelStr, evalInfo.toString());
       retEntry.addAttribute(attr,null);
     }
   }
@@ -645,10 +643,8 @@
       String typeStr=
               aclRightsInfoAttrLogsStr + ";" + rightStr + ";" +
               aType.getPrimaryName();
-      AttributeType attributeType=
-                DirectoryServer.getDefaultAttributeType(typeStr);
-      Attribute attr = Attributes.create(attributeType,
-          container.getEvalSummary());
+      AttributeType attributeType = DirectoryServer.getAttributeTypeOrDefault(typeStr);
+      Attribute attr = Attributes.create(attributeType, container.getEvalSummary());
       // The attribute type might have already been added, probably
       // not but it is possible.
       if(!retEntry.hasAttribute(attributeType))
@@ -676,10 +672,7 @@
      //Check if the aclRightsInfo attribute was requested.
      if(hasAttrMask(mask,ACL_RIGHTS_INFO)) {
       String typeStr = aclRightsInfoEntryLogsStr + ";" + rightStr;
-       AttributeType attributeType=
-                 DirectoryServer.getDefaultAttributeType(typeStr);
-       Attribute attr = Attributes.create(attributeType,
-           container.getEvalSummary());
+      Attribute attr = Attributes.create(typeStr, container.getEvalSummary());
        retEntry.addAttribute(attr,null);
      }
    }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/DatabaseEnvironmentMonitor.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/DatabaseEnvironmentMonitor.java
index 5039cbe..4a59926 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/DatabaseEnvironmentMonitor.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/DatabaseEnvironmentMonitor.java
@@ -215,9 +215,7 @@
 
     ArrayList<Attribute> monitorAttrs = new ArrayList<>();
     String jeVersion = JEVersion.CURRENT_VERSION.getVersionString();
-    AttributeType versionType =
-         DirectoryServer.getDefaultAttributeType("JEVersion");
-    monitorAttrs.add(Attributes.create(versionType, jeVersion));
+    monitorAttrs.add(Attributes.create("JEVersion", jeVersion));
 
     addAttributesForStatsObject(monitorAttrs, environmentStats, "Environment");
     addAttributesForStatsObject(monitorAttrs, transactionStats, "Transaction");
@@ -242,8 +240,7 @@
 
     if(filterUseEnabled)
     {
-      monitorAttrs.add(Attributes.create("filter-use-startTime",
-          startTimeStamp));
+      monitorAttrs.add(Attributes.create("filter-use-startTime", startTimeStamp));
       AttributeBuilder builder = new AttributeBuilder("filter-use");
 
       StringBuilder stringBuilder = new StringBuilder();
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/task/RecurringTask.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/task/RecurringTask.java
index 6be86a0..f600a91 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/task/RecurringTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/task/RecurringTask.java
@@ -188,11 +188,8 @@
 
 
     // Get the schedule for this task.
-    attrType = DirectoryServer.getAttributeTypeOrNull(ATTR_RECURRING_TASK_SCHEDULE.toLowerCase());
-    if (attrType == null)
-    {
-      attrType = DirectoryServer.getDefaultAttributeType(ATTR_RECURRING_TASK_SCHEDULE);
-    }
+    attrType = DirectoryServer.getAttributeTypeOrDefault(
+        ATTR_RECURRING_TASK_SCHEDULE.toLowerCase(), ATTR_RECURRING_TASK_SCHEDULE);
 
     attrList = recurringTaskEntry.getAttribute(attrType);
     if (attrList == null || attrList.isEmpty())
@@ -238,11 +235,7 @@
     weekdayArray = taskArrays[WEEKDAY_INDEX];
 
     // Get the class name from the entry.  If there isn't one, then fail.
-    attrType = DirectoryServer.getAttributeTypeOrNull(ATTR_TASK_CLASS.toLowerCase());
-    if (attrType == null)
-    {
-      attrType = DirectoryServer.getDefaultAttributeType(ATTR_TASK_CLASS);
-    }
+    attrType = DirectoryServer.getAttributeTypeOrDefault(ATTR_TASK_CLASS.toLowerCase(), ATTR_TASK_CLASS);
 
     attrList = recurringTaskEntry.getAttribute(attrType);
     if (attrList == null || attrList.isEmpty())
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java b/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
index 0d08982..8fd628c 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
@@ -2658,12 +2658,7 @@
    */
   public static AttributeType getAttributeTypeOrDefault(String lowerName)
   {
-    AttributeType type = directoryServer.schema.getAttributeType(lowerName);
-    if (type == null)
-    {
-      type = getDefaultAttributeType(lowerName);
-    }
-    return type;
+    return getAttributeTypeOrDefault(lowerName, lowerName);
   }
 
   /**
@@ -2680,10 +2675,10 @@
    */
   public static AttributeType getAttributeTypeOrDefault(String lowerName, String upperName)
   {
-    AttributeType type = directoryServer.schema.getAttributeType(lowerName);
+    AttributeType type = getAttributeTypeOrNull(lowerName);
     if (type == null)
     {
-      type = getDefaultAttributeType(upperName);
+      type = getDefaultAttributeType(upperName, getDefaultAttributeSyntax());
     }
     return type;
   }
@@ -2778,21 +2773,6 @@
 
   /**
    * Causes the Directory Server to construct a new attribute type definition
-   * with the provided name and using the default attribute syntax.  This should
-   * only be used if there is no real attribute type for the specified name.
-   *
-   * @param  name  The name to use for the attribute type, as provided by the
-   *               user.
-   *
-   * @return  The constructed attribute type definition.
-   */
-  public static AttributeType getDefaultAttributeType(String name)
-  {
-    return getDefaultAttributeType(name, getDefaultAttributeSyntax());
-  }
-
-  /**
-   * Causes the Directory Server to construct a new attribute type definition
    * with the provided name and syntax.  This should only be used if there is no
    * real attribute type for the specified name.
    *
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/monitors/ClientConnectionMonitorProvider.java b/opendj-server-legacy/src/main/java/org/opends/server/monitors/ClientConnectionMonitorProvider.java
index 1f97475..78feed1 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/monitors/ClientConnectionMonitorProvider.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/monitors/ClientConnectionMonitorProvider.java
@@ -37,7 +37,6 @@
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.types.Attribute;
 import org.opends.server.types.AttributeBuilder;
-import org.opends.server.types.AttributeType;
 import org.opends.server.types.InitializationException;
 
 /**
@@ -153,8 +152,7 @@
       }
     }
 
-    AttributeType attrType = DirectoryServer.getDefaultAttributeType("connection");
-    AttributeBuilder builder = new AttributeBuilder(attrType);
+    AttributeBuilder builder = new AttributeBuilder("connection");
     for (ClientConnection conn : connMap.values())
     {
       builder.add(conn.getMonitorSummary());
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/monitors/MemoryUsageMonitorProvider.java b/opendj-server-legacy/src/main/java/org/opends/server/monitors/MemoryUsageMonitorProvider.java
index 1ec12a4..92c3358 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/monitors/MemoryUsageMonitorProvider.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/monitors/MemoryUsageMonitorProvider.java
@@ -34,13 +34,15 @@
 import java.lang.management.MemoryUsage;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.concurrent.TimeUnit;
 
+import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.admin.std.server.MemoryUsageMonitorProviderCfg;
 import org.opends.server.api.MonitorProvider;
-import org.forgerock.opendj.config.server.ConfigException;
-import org.opends.server.core.DirectoryServer;
-import org.opends.server.types.*;
+import org.opends.server.types.Attribute;
+import org.opends.server.types.Attributes;
+import org.opends.server.types.InitializationException;
 
 /**
  * This class defines a monitor provider that reports information about
@@ -111,9 +113,8 @@
 
 
 
-  /** {@inheritDoc} */
   @Override
-  public ArrayList<Attribute> getMonitorData()
+  public List<Attribute> getMonitorData()
   {
     ArrayList<Attribute> attrs = new ArrayList<>();
 
@@ -143,14 +144,10 @@
         gcSafeNames.put(gcName, safeName);
       }
 
-      attrs.add(createAttribute(safeName + "-total-collection-count",
-                                String.valueOf(gcCount)));
-      attrs.add(createAttribute(safeName + "-total-collection-duration",
-                                String.valueOf(gcTime)));
-      attrs.add(createAttribute(safeName + "-average-collection-duration",
-                                String.valueOf(avgGCDuration)));
-      attrs.add(createAttribute(safeName + "-recent-collection-duration",
-                                String.valueOf(recentGCDuration)));
+      attrs.add(createAttribute(safeName + "-total-collection-count", gcCount));
+      attrs.add(createAttribute(safeName + "-total-collection-duration", gcTime));
+      attrs.add(createAttribute(safeName + "-average-collection-duration", avgGCDuration));
+      attrs.add(createAttribute(safeName + "-recent-collection-duration", recentGCDuration));
     }
 
     for (MemoryPoolMXBean mp : ManagementFactory.getMemoryPoolMXBeans())
@@ -166,48 +163,19 @@
         gcSafeNames.put(poolName, safeName);
       }
 
-      if (currentUsage == null)
-      {
-        attrs.add(createAttribute(safeName + "-current-bytes-used", "0"));
-      }
-      else
-      {
-        attrs.add(createAttribute(safeName + "-current-bytes-used",
-                                  String.valueOf(currentUsage.getUsed())));
-      }
+      long currentBytesUsed = currentUsage != null ? currentUsage.getUsed() : 0;
+      attrs.add(createAttribute(safeName + "-current-bytes-used", currentBytesUsed));
 
-      if (collectionUsage == null)
-      {
-        attrs.add(createAttribute(safeName +
-                                       "-bytes-used-after-last-collection",
-                                  "0"));
-      }
-      else
-      {
-        attrs.add(createAttribute(safeName +
-                                       "-bytes-used-after-last-collection",
-                                  String.valueOf(collectionUsage.getUsed())));
-      }
+      long collectionBytesUsed = collectionUsage != null ? collectionUsage.getUsed() : 0;
+      attrs.add(createAttribute(safeName + "-bytes-used-after-last-collection", collectionBytesUsed));
     }
 
     return attrs;
   }
 
-
-
-  /**
-   * Constructs an attribute using the provided information.  It will have the
-   * default syntax.
-   *
-   * @param  name   The name to use for the attribute.
-   * @param  value  The value to use for the attribute.
-   *
-   * @return  The attribute created from the provided information.
-   */
-  private Attribute createAttribute(String name, String value)
+  private Attribute createAttribute(String name, Object value)
   {
-    AttributeType attrType = DirectoryServer.getDefaultAttributeType(name);
-    return Attributes.create(attrType, value);
+    return Attributes.create(name, String.valueOf(value));
   }
 
 
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/monitors/StackTraceMonitorProvider.java b/opendj-server-legacy/src/main/java/org/opends/server/monitors/StackTraceMonitorProvider.java
index 1ce0960..887aa40 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/monitors/StackTraceMonitorProvider.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/monitors/StackTraceMonitorProvider.java
@@ -35,10 +35,8 @@
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.admin.std.server.StackTraceMonitorProviderCfg;
 import org.opends.server.api.MonitorProvider;
-import org.opends.server.core.DirectoryServer;
 import org.opends.server.types.Attribute;
 import org.opends.server.types.AttributeBuilder;
-import org.opends.server.types.AttributeType;
 import org.opends.server.types.InitializationException;
 
 /**
@@ -75,9 +73,7 @@
       orderedStacks.put(e.getKey().getId(), e);
     }
 
-    AttributeType attrType =
-         DirectoryServer.getDefaultAttributeType("jvmThread");
-    AttributeBuilder builder = new AttributeBuilder(attrType);
+    AttributeBuilder builder = new AttributeBuilder("jvmThread");
     for (Map.Entry<Thread,StackTraceElement[]> e : orderedStacks.values())
     {
       Thread t                          = e.getKey();
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/monitors/SystemInfoMonitorProvider.java b/opendj-server-legacy/src/main/java/org/opends/server/monitors/SystemInfoMonitorProvider.java
index d5adbac..089859c 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/monitors/SystemInfoMonitorProvider.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/monitors/SystemInfoMonitorProvider.java
@@ -47,7 +47,6 @@
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.types.Attribute;
 import org.opends.server.types.AttributeBuilder;
-import org.opends.server.types.AttributeType;
 import org.opends.server.types.Attributes;
 import org.opends.server.types.InitializationException;
 
@@ -80,19 +79,13 @@
   {
     ArrayList<Attribute> attrs = new ArrayList<>(13);
 
-    attrs.add(createAttribute("javaVersion",
-                              System.getProperty("java.version")));
+    attrs.add(createAttribute("javaVersion", System.getProperty("java.version")));
     attrs.add(createAttribute("javaVendor", System.getProperty("java.vendor")));
-    attrs.add(createAttribute("jvmVersion",
-                              System.getProperty("java.vm.version")));
-    attrs.add(createAttribute("jvmVendor",
-                              System.getProperty("java.vm.vendor")));
-    attrs.add(createAttribute("javaHome",
-                              System.getProperty("java.home")));
-    attrs.add(createAttribute("classPath",
-                              System.getProperty("java.class.path")));
-    attrs.add(createAttribute("workingDirectory",
-                              System.getProperty("user.dir")));
+    attrs.add(createAttribute("jvmVersion", System.getProperty("java.vm.version")));
+    attrs.add(createAttribute("jvmVendor", System.getProperty("java.vm.vendor")));
+    attrs.add(createAttribute("javaHome", System.getProperty("java.home")));
+    attrs.add(createAttribute("classPath", System.getProperty("java.class.path")));
+    attrs.add(createAttribute("workingDirectory", System.getProperty("user.dir")));
 
     String osInfo = System.getProperty("os.name") + " " +
                     System.getProperty("os.version") + " " +
@@ -125,14 +118,10 @@
 
 
     Runtime runtime = Runtime.getRuntime();
-    attrs.add(createAttribute("availableCPUs",
-                              String.valueOf(runtime.availableProcessors())));
-    attrs.add(createAttribute("maxMemory",
-                              String.valueOf(runtime.maxMemory())));
-    attrs.add(createAttribute("usedMemory",
-                              String.valueOf(runtime.totalMemory())));
-    attrs.add(createAttribute("freeUsedMemory",
-                              String.valueOf(runtime.freeMemory())));
+    attrs.add(createAttribute("availableCPUs", runtime.availableProcessors()));
+    attrs.add(createAttribute("maxMemory", runtime.maxMemory()));
+    attrs.add(createAttribute("usedMemory", runtime.totalMemory()));
+    attrs.add(createAttribute("freeUsedMemory", runtime.freeMemory()));
     String installPath = DirectoryServer.getServerRoot();
     if (installPath != null)
     {
@@ -190,25 +179,14 @@
 
   private void addAttribute(ArrayList<Attribute> attrs, String attrName, Collection<String> values)
   {
-    AttributeType attrType = DirectoryServer.getDefaultAttributeType(attrName);
-    AttributeBuilder builder = new AttributeBuilder(attrType);
+    AttributeBuilder builder = new AttributeBuilder(attrName);
     builder.addAllStrings(values);
     attrs.add(builder.toAttribute());
   }
 
-  /**
-   * Constructs an attribute using the provided information.  It will have the
-   * default syntax.
-   *
-   * @param  name   The name to use for the attribute.
-   * @param  value  The value to use for the attribute.
-   *
-   * @return  The attribute created from the provided information.
-   */
-  private Attribute createAttribute(String name, String value)
+  private Attribute createAttribute(String name, Object value)
   {
-    AttributeType attrType = DirectoryServer.getDefaultAttributeType(name);
-    return Attributes.create(attrType, value);
+    return Attributes.create(name, String.valueOf(value));
   }
 }
 
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/monitors/VersionMonitorProvider.java b/opendj-server-legacy/src/main/java/org/opends/server/monitors/VersionMonitorProvider.java
index ad2d129..6241905 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/monitors/VersionMonitorProvider.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/monitors/VersionMonitorProvider.java
@@ -26,156 +26,69 @@
  */
 package org.opends.server.monitors;
 
-
-
 import java.util.ArrayList;
+import java.util.List;
 
+import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.admin.std.server.VersionMonitorProviderCfg;
 import org.opends.server.api.MonitorProvider;
-import org.forgerock.opendj.config.server.ConfigException;
-import org.opends.server.core.DirectoryServer;
-import org.forgerock.i18n.slf4j.LocalizedLogger;
-import org.opends.server.types.*;
+import org.opends.server.types.Attribute;
+import org.opends.server.types.Attributes;
+import org.opends.server.types.InitializationException;
 import org.opends.server.util.DynamicConstants;
 
-
-
-/**
- * This class defines a monitor provider that reports Directory Server version
- * information.
- */
+/** This class defines a monitor provider that reports Directory Server version information. */
 public class VersionMonitorProvider
        extends MonitorProvider<VersionMonitorProviderCfg>
 {
-  private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
-
-  /**
-   * The name of the attribute used to provide the product name.
-   */
+  /** The name of the attribute used to provide the product name. */
   public static final String ATTR_PRODUCT_NAME = "productName";
-
-
-
-  /**
-   * The name of the attribute used to provide the short name.
-   */
+  /** The name of the attribute used to provide the short name. */
   public static final String ATTR_SHORT_NAME = "shortName";
-
-
-
-  /**
-   * The name of the attribute used to provide the major version number.
-   */
+  /** The name of the attribute used to provide the major version number. */
   public static final String ATTR_MAJOR_VERSION = "majorVersion";
-
-
-
-  /**
-   * The name of the attribute used to provide the minor version number.
-   */
+  /** The name of the attribute used to provide the minor version number. */
   public static final String ATTR_MINOR_VERSION = "minorVersion";
-
-
-
-  /**
-   * The name of the attribute used to provide the point version number.
-   */
+  /** The name of the attribute used to provide the point version number. */
   public static final String ATTR_POINT_VERSION = "pointVersion";
-
-
-
-  /**
-   * The name of the attribute used to provide the version qualifier string.
-   */
+  /** The name of the attribute used to provide the version qualifier string. */
   public static final String ATTR_VERSION_QUALIFIER = "versionQualifier";
-
-
-
-  /**
-   * The name of the attribute used to provide the weekly build number.
-   */
+  /** The name of the attribute used to provide the weekly build number. */
   public static final String ATTR_BUILD_NUMBER = "buildNumber";
-
-
-
-  /**
-   * The name of the attribute used to provide the list of bugfix IDs.
-   */
+  /** The name of the attribute used to provide the list of bugfix IDs. */
   public static final String ATTR_FIX_IDS = "fixIDs";
-
-
-
-  /**
-   * The name of the attribute used to provide the Subversion revision number.
-   */
+  /** The name of the attribute used to provide the Subversion revision number. */
   public static final String ATTR_REVISION_NUMBER = "revisionNumber";
-
-
-
-  /**
-   * The name of the attribute used to provide the build ID (aka the build
-   * timestamp).
-   */
+  /** The name of the attribute used to provide the build ID (aka the build timestamp). */
   public static final String ATTR_BUILD_ID = "buildID";
-
-
-
-  /**
-   * The name of the attribute used to provide the compact version string.
-   */
+  /** The name of the attribute used to provide the compact version string. */
   public static final String ATTR_COMPACT_VERSION = "compactVersion";
-
-
-
-  /**
-   * The name of the attribute used to provide the full version string.
-   */
+  /** The name of the attribute used to provide the full version string. */
   public static final String ATTR_FULL_VERSION = "fullVersion";
 
-
-
-  /** {@inheritDoc} */
+  @Override
   public void initializeMonitorProvider(VersionMonitorProviderCfg configuration)
          throws ConfigException, InitializationException
   {
     // No initialization is required.
   }
 
-
-
-  /**
-   * Retrieves the name of this monitor provider.  It should be unique among all
-   * monitor providers, including all instances of the same monitor provider.
-   *
-   * @return  The name of this monitor provider.
-   */
+  @Override
   public String getMonitorInstanceName()
   {
     return "Version";
   }
 
-
-  /**
-   * Retrieves a set of attributes containing monitor data that should be
-   * returned to the client if the corresponding monitor entry is requested.
-   *
-   * @return  A set of attributes containing monitor data that should be
-   *          returned to the client if the corresponding monitor entry is
-   *          requested.
-   */
-  public ArrayList<Attribute> getMonitorData()
+  @Override
+  public List<Attribute> getMonitorData()
   {
     ArrayList<Attribute> attrs = new ArrayList<>(12);
 
-    attrs.add(createAttribute(ATTR_PRODUCT_NAME,
-                              DynamicConstants.PRODUCT_NAME));
+    attrs.add(createAttribute(ATTR_PRODUCT_NAME, DynamicConstants.PRODUCT_NAME));
     attrs.add(createAttribute(ATTR_SHORT_NAME, DynamicConstants.SHORT_NAME));
-    attrs.add(createAttribute(ATTR_MAJOR_VERSION,
-                              String.valueOf(DynamicConstants.MAJOR_VERSION)));
-    attrs.add(createAttribute(ATTR_MINOR_VERSION,
-                              String.valueOf(DynamicConstants.MINOR_VERSION)));
-    attrs.add(createAttribute(ATTR_POINT_VERSION,
-                              String.valueOf(DynamicConstants.POINT_VERSION)));
+    attrs.add(createAttribute(ATTR_MAJOR_VERSION, DynamicConstants.MAJOR_VERSION));
+    attrs.add(createAttribute(ATTR_MINOR_VERSION, DynamicConstants.MINOR_VERSION));
+    attrs.add(createAttribute(ATTR_POINT_VERSION, DynamicConstants.POINT_VERSION));
 
     String versionQualifier = DynamicConstants.VERSION_QUALIFIER;
     if (versionQualifier != null && versionQualifier.length() > 0)
@@ -186,8 +99,7 @@
     int buildNumber = DynamicConstants.BUILD_NUMBER;
     if (buildNumber > 0)
     {
-      attrs.add(createAttribute(ATTR_BUILD_NUMBER,
-                                String.valueOf(buildNumber)));
+      attrs.add(createAttribute(ATTR_BUILD_NUMBER, buildNumber));
     }
 
     String fixIDs = DynamicConstants.FIX_IDS;
@@ -196,31 +108,16 @@
       attrs.add(createAttribute(ATTR_FIX_IDS, fixIDs));
     }
 
-    attrs.add(createAttribute(ATTR_REVISION_NUMBER, String.valueOf(DynamicConstants.REVISION)));
+    attrs.add(createAttribute(ATTR_REVISION_NUMBER, DynamicConstants.REVISION));
     attrs.add(createAttribute(ATTR_BUILD_ID, DynamicConstants.BUILD_ID));
-    attrs.add(createAttribute(ATTR_COMPACT_VERSION,
-                              DynamicConstants.COMPACT_VERSION_STRING));
-    attrs.add(createAttribute(ATTR_FULL_VERSION,
-                              DynamicConstants.FULL_VERSION_STRING));
+    attrs.add(createAttribute(ATTR_COMPACT_VERSION, DynamicConstants.COMPACT_VERSION_STRING));
+    attrs.add(createAttribute(ATTR_FULL_VERSION, DynamicConstants.FULL_VERSION_STRING));
 
     return attrs;
   }
 
-
-
-  /**
-   * Constructs an attribute using the provided information.  It will have the
-   * default syntax.
-   *
-   * @param  name   The name to use for the attribute.
-   * @param  value  The value to use for the attribute.
-   *
-   * @return  The attribute created from the provided information.
-   */
-  private Attribute createAttribute(String name, String value)
+  private Attribute createAttribute(String name, Object value)
   {
-    AttributeType attrType = DirectoryServer.getDefaultAttributeType(name);
-    return Attributes.create(attrType, value);
+    return Attributes.create(name, String.valueOf(value));
   }
 }
-
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationMonitor.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationMonitor.java
index baa1b51..09e7273 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationMonitor.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationMonitor.java
@@ -33,11 +33,9 @@
 
 import org.opends.server.admin.std.server.MonitorProviderCfg;
 import org.opends.server.api.MonitorProvider;
-import org.opends.server.core.DirectoryServer;
 import org.opends.server.replication.service.ReplicationDomain.ImportExportContext;
 import org.opends.server.types.Attribute;
 import org.opends.server.types.AttributeBuilder;
-import org.opends.server.types.AttributeType;
 import org.opends.server.types.Attributes;
 
 /**
@@ -91,8 +89,8 @@
   {
     List<Attribute> attributes = new ArrayList<>();
 
-    attributes.add(Attributes.create("domain-name", String.valueOf(domain.getBaseDN())));
-    attributes.add(Attributes.create("connected-to", domain.getReplicationServer()));
+    addMonitorData(attributes, "domain-name", domain.getBaseDN());
+    addMonitorData(attributes, "connected-to", domain.getReplicationServer());
     addMonitorData(attributes, "lost-connections", domain.getNumLostConnections());
     addMonitorData(attributes, "received-updates", domain.getNumRcvdUpdates());
     addMonitorData(attributes, "sent-updates", domain.getNumSentUpdates());
@@ -110,13 +108,12 @@
 
     // get the Server State
     final String ATTR_SERVER_STATE = "server-state";
-    AttributeType type = DirectoryServer.getDefaultAttributeType(ATTR_SERVER_STATE);
-    AttributeBuilder builder = new AttributeBuilder(type, ATTR_SERVER_STATE);
+    AttributeBuilder builder = new AttributeBuilder(ATTR_SERVER_STATE);
     builder.addAllStrings(domain.getServerState().toStringSet());
     attributes.add(builder.toAttribute());
 
-    attributes.add(Attributes.create("ssl-encryption", String.valueOf(domain.isSessionEncrypted())));
-    attributes.add(Attributes.create("generation-id", String.valueOf(domain.getGenerationID())));
+    addMonitorData(attributes, "ssl-encryption", domain.isSessionEncrypted());
+    addMonitorData(attributes, "generation-id", domain.getGenerationID());
 
     // Add import/export monitoring attributes
     final ImportExportContext ieContext = domain.getImportExportContext();
@@ -152,20 +149,19 @@
     addMonitorData(attributes, "assured-sd-server-timeout-updates", domain.getAssuredSdServerTimeoutUpdates());
 
     // Status related monitoring fields
-    addMonitorData(attributes, "last-status-change-date", domain.getLastStatusChangeDate().toString());
+    addMonitorData(attributes, "last-status-change-date", domain.getLastStatusChangeDate());
 
-    addMonitorData(attributes, "status", domain.getStatus().toString());
+    addMonitorData(attributes, "status", domain.getStatus());
 
     return attributes;
   }
 
-  private void addMonitorData(List<Attribute> attributes, String attrType,
+  private void addMonitorData(List<Attribute> attributes, String attrName,
       Map<Integer, Integer> serverIdToNb)
   {
     if (!serverIdToNb.isEmpty())
     {
-      AttributeType type = DirectoryServer.getDefaultAttributeType(attrType);
-      final AttributeBuilder builder = new AttributeBuilder(type, attrType);
+      final AttributeBuilder builder = new AttributeBuilder(attrName);
       for (Entry<Integer, Integer> entry : serverIdToNb.entrySet())
       {
         final Integer serverId = entry.getKey();
@@ -177,42 +173,14 @@
   }
 
   /**
-   * Add an attribute with an integer value to the list of monitoring
-   * attributes.
+   * Adds an attribute with a value to the list of monitoring attributes.
    *
    * @param attributes the list of monitoring attributes
-   * @param name the name of the attribute to add.
-   * @param value The integer value of he attribute to add.
+   * @param attrName the name of the attribute to add.
+   * @param value The value of he attribute to add.
    */
-  public static void addMonitorData(List<Attribute> attributes, String name, int value)
+  public static void addMonitorData(List<Attribute> attributes, String attrName, Object value)
   {
-    addMonitorData(attributes, name, String.valueOf(value));
-  }
-
-  /**
-   * Add an attribute with an integer value to the list of monitoring
-   * attributes.
-   *
-   * @param attributes the list of monitoring attributes
-   * @param name the name of the attribute to add.
-   * @param value The integer value of he attribute to add.
-   */
-  private static void addMonitorData(List<Attribute> attributes, String name, long value)
-  {
-    addMonitorData(attributes, name, String.valueOf(value));
-  }
-
-  /**
-   * Add an attribute with an integer value to the list of monitoring
-   * attributes.
-   *
-   * @param attributes the list of monitoring attributes
-   * @param name the name of the attribute to add.
-   * @param value The String value of he attribute to add.
-   */
-  private static void addMonitorData(List<Attribute> attributes, String name, String value)
-  {
-    AttributeType type = DirectoryServer.getDefaultAttributeType(name);
-    attributes.add(Attributes.create(type, value));
+    attributes.add(Attributes.create(attrName, String.valueOf(value)));
   }
 }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/schema/AttributeTypeSyntax.java b/opendj-server-legacy/src/main/java/org/opends/server/schema/AttributeTypeSyntax.java
index c50ed00..6f5b3ca 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/schema/AttributeTypeSyntax.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/schema/AttributeTypeSyntax.java
@@ -529,7 +529,7 @@
         {
           if (allowUnknownElements)
           {
-            superiorType = DirectoryServer.getDefaultAttributeType(woidString);
+            superiorType = DirectoryServer.getAttributeTypeOrDefault(woidString);
           }
           else
           {
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/schema/DITContentRuleSyntax.java b/opendj-server-legacy/src/main/java/org/opends/server/schema/DITContentRuleSyntax.java
index e731939..7a5339e 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/schema/DITContentRuleSyntax.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/schema/DITContentRuleSyntax.java
@@ -669,7 +669,7 @@
         throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
             msg.get(valueStr, woidString));
       }
-      attr = DirectoryServer.getDefaultAttributeType(woidString);
+      attr = DirectoryServer.getAttributeTypeOrDefault(woidString);
     }
     return attr;
   }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/schema/MatchingRuleUseSyntax.java b/opendj-server-legacy/src/main/java/org/opends/server/schema/MatchingRuleUseSyntax.java
index 91d14d7..38a1102 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/schema/MatchingRuleUseSyntax.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/schema/MatchingRuleUseSyntax.java
@@ -451,7 +451,7 @@
         throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
             ERR_ATTR_SYNTAX_MRUSE_UNKNOWN_ATTR.get(oid, woidString));
       }
-      attr = DirectoryServer.getDefaultAttributeType(woidString);
+      attr = DirectoryServer.getAttributeTypeOrDefault(woidString);
     }
     return attr;
   }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/schema/NameFormSyntax.java b/opendj-server-legacy/src/main/java/org/opends/server/schema/NameFormSyntax.java
index a03d526..11839d4 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/schema/NameFormSyntax.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/schema/NameFormSyntax.java
@@ -540,7 +540,7 @@
         throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
             msg.get(oid, woidString));
       }
-      attr = DirectoryServer.getDefaultAttributeType(woidString);
+      attr = DirectoryServer.getAttributeTypeOrDefault(woidString);
     }
     return attr;
   }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/schema/ObjectClassSyntax.java b/opendj-server-legacy/src/main/java/org/opends/server/schema/ObjectClassSyntax.java
index b205614..ef9b34b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/schema/ObjectClassSyntax.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/schema/ObjectClassSyntax.java
@@ -728,7 +728,7 @@
         LocalizableMessage message = msg.get(oid, woidString);
         throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message);
       }
-      attr = DirectoryServer.getDefaultAttributeType(woidString);
+      attr = DirectoryServer.getAttributeTypeOrDefault(woidString);
     }
     return attr;
   }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java b/opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java
index 57fcef4..b09c187 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java
@@ -970,18 +970,7 @@
     return builder.toAttribute();
   }
 
-
-
-  /**
-   * Gets the named attribute type, creating a default attribute if
-   * necessary.
-   *
-   * @param attributeName
-   *          The name of the attribute type.
-   * @return The attribute type associated with the provided attribute
-   *         name.
-   */
-  private static AttributeType getAttributeType(String attributeName)
+  private static AttributeType getAttributeTypeOrDefault(String attributeName)
   {
     return DirectoryServer.getAttributeTypeOrDefault(toLowerCase(attributeName), attributeName);
   }
@@ -1101,7 +1090,7 @@
    */
   public AttributeBuilder(String attributeName)
   {
-    this(getAttributeType(attributeName), attributeName);
+    this(getAttributeTypeOrDefault(attributeName), attributeName);
   }
 
 
@@ -1506,7 +1495,7 @@
    */
   public void setAttributeType(String attributeName)
   {
-    setAttributeType(getAttributeType(attributeName), attributeName);
+    setAttributeType(getAttributeTypeOrDefault(attributeName), attributeName);
   }
 
   /**
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/Attributes.java b/opendj-server-legacy/src/main/java/org/opends/server/types/Attributes.java
index b5344b9..d119413 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/Attributes.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/Attributes.java
@@ -182,10 +182,9 @@
    *          The String representation of the attribute value.
    * @return A new attribute with the specified name and value.
    */
-  public static Attribute create(String attributeName,
-      String valueString)
+  public static Attribute create(String attributeName, String valueString)
   {
-    return create(getAttributeType(attributeName), attributeName, valueString);
+    return create(getAttributeTypeOrDefault(attributeName), attributeName, valueString);
   }
 
   /**
@@ -287,7 +286,7 @@
    */
   public static Attribute empty(String attributeName)
   {
-    return empty(getAttributeType(attributeName), attributeName);
+    return empty(getAttributeTypeOrDefault(attributeName), attributeName);
   }
 
 
@@ -409,14 +408,7 @@
     return builder.toAttribute();
   }
 
-  /**
-   * Gets the named attribute type, creating a default attribute if necessary.
-   *
-   * @param attributeName
-   *          The name of the attribute type.
-   * @return The attribute type associated with the provided attribute name.
-   */
-  private static AttributeType getAttributeType(String attributeName)
+  private static AttributeType getAttributeTypeOrDefault(String attributeName)
   {
     return DirectoryServer.getAttributeTypeOrDefault(toLowerCase(attributeName), attributeName);
   }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/DN.java b/opendj-server-legacy/src/main/java/org/opends/server/types/DN.java
index 3f9d18c..494be1f 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/DN.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/DN.java
@@ -671,8 +671,7 @@
         // default syntax.  If this is a problem, it will be caught
         // later either by not finding the target entry or by not
         // allowing the entry to be added.
-        attrType = DirectoryServer.getDefaultAttributeType(
-            attributeNameString);
+        attrType = DirectoryServer.getAttributeTypeOrDefault(attributeNameString);
       }
 
       RDN rdn = new RDN(attrType, attributeNameString, parsedValue);
@@ -789,8 +788,7 @@
             // using the default syntax.  If this is a problem, it
             // will be caught later either by not finding the target
             // entry or by not allowing the entry to be added.
-            attrType = DirectoryServer.getDefaultAttributeType(
-                attributeNameString);
+            attrType = DirectoryServer.getAttributeTypeOrDefault(attributeNameString);
           }
 
           rdn.addValue(attrType, attributeNameString, ByteString.empty());
@@ -815,8 +813,7 @@
           // default syntax.  If this is a problem, it will be caught
           // later either by not finding the target entry or by not
           // allowing the entry to be added.
-          attrType = DirectoryServer.getDefaultAttributeType(
-              attributeNameString);
+          attrType = DirectoryServer.getAttributeTypeOrDefault(attributeNameString);
         }
 
         rdn.addValue(attrType, attributeNameString, parsedValue);
@@ -1114,7 +1111,7 @@
             // using the default syntax.  If this is a problem, it
             // will be caught later either by not finding the target
             // entry or by not allowing the entry to be added.
-            attrType = DirectoryServer.getDefaultAttributeType(name);
+            attrType = DirectoryServer.getAttributeTypeOrDefault(name);
           }
 
           rdn.addValue(attrType, name, ByteString.empty());
@@ -1139,7 +1136,7 @@
           // default syntax.  If this is a problem, it will be caught
           // later either by not finding the target entry or by not
           // allowing the entry to be added.
-          attrType = DirectoryServer.getDefaultAttributeType(name);
+          attrType = DirectoryServer.getAttributeTypeOrDefault(name);
         }
 
         rdn.addValue(attrType, name, parsedValue.toByteString());
@@ -1194,7 +1191,7 @@
       // default syntax.  If this is a problem, it will be caught
       // later either by not finding the target entry or by not
       // allowing the entry to be added.
-      attrType = DirectoryServer.getDefaultAttributeType(name);
+      attrType = DirectoryServer.getAttributeTypeOrDefault(name);
     }
     return attrType;
   }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/RDN.java b/opendj-server-legacy/src/main/java/org/opends/server/types/RDN.java
index 7bd24ef..eef5ab7 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/RDN.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/RDN.java
@@ -674,7 +674,7 @@
       // syntax.  If this is a problem, it will be caught later either
       // by not finding the target entry or by not allowing the entry
       // to be added.
-      attrType = DirectoryServer.getDefaultAttributeType(name);
+      attrType = DirectoryServer.getAttributeTypeOrDefault(name);
     }
 
     RDN rdn = new RDN(attrType, name, parsedValue.toByteString());
@@ -794,7 +794,7 @@
           // default syntax.  If this is a problem, it will be caught
           // later either by not finding the target entry or by not
           // allowing the entry to be added.
-          attrType = DirectoryServer.getDefaultAttributeType(name);
+          attrType = DirectoryServer.getAttributeTypeOrDefault(name);
         }
 
         rdn.addValue(attrType, name, ByteString.empty());
@@ -818,7 +818,7 @@
         // default syntax.  If this is a problem, it will be caught
         // later either by not finding the target entry or by not
         // allowing the entry to be added.
-        attrType = DirectoryServer.getDefaultAttributeType(name);
+        attrType = DirectoryServer.getAttributeTypeOrDefault(name);
       }
 
       rdn.addValue(attrType, name, parsedValue.toByteString());
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/SearchFilter.java b/opendj-server-legacy/src/main/java/org/opends/server/types/SearchFilter.java
index 05fdec5..870599b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/SearchFilter.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/SearchFilter.java
@@ -2059,7 +2059,7 @@
     if (attributeType == null)
     {
       String typeStr = attrType.substring(0, lowerType.length());
-      attributeType = DirectoryServer.getDefaultAttributeType(typeStr);
+      attributeType = DirectoryServer.getAttributeTypeOrDefault(typeStr);
     }
     return attributeType;
   }
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestAddResponseProtocolOp.java b/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestAddResponseProtocolOp.java
index 480b56c..78bb4c5 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestAddResponseProtocolOp.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestAddResponseProtocolOp.java
@@ -55,19 +55,11 @@
  * org.opends.server.protocol.ldap.AddResponseProtocolOp class.
  */
 public class TestAddResponseProtocolOp extends DirectoryServerTestCase {
-  /**
-   * The protocol op type for add responses.
-   */
+  /** The protocol op type for add responses. */
   private static final byte OP_TYPE_ADD_RESPONSE = 0x69;
-
-  /**
-   * The result code for add result operations.
-   */
+  /** The result code for add result operations. */
   private static final int resultCode = 10;
-
-  /**
-   * The error message to use for add result operations.
-   */
+  /** The error message to use for add result operations. */
   private static final LocalizableMessage resultMsg = LocalizableMessage.raw("Test Successful");
 
   /** The DN to use for add result operations. */
@@ -80,8 +72,7 @@
     TestCaseUtils.startServer();
 
     //Setup the DN to use in the response tests.
-    AttributeType attribute =
-        DirectoryServer.getDefaultAttributeType("testAttribute");
+    AttributeType attribute = DirectoryServer.getAttributeTypeOrDefault("testAttribute");
     ByteString attributeValue = ByteString.valueOf("testValue");
     dn = new DN(new RDN[] { RDN.create(attribute, attributeValue) });
   }
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestCompareResponseProtocolOp.java b/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestCompareResponseProtocolOp.java
index f09776d..40f18b4 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestCompareResponseProtocolOp.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestCompareResponseProtocolOp.java
@@ -38,7 +38,10 @@
 import org.forgerock.opendj.ldap.ByteStringBuilder;
 import org.opends.server.TestCaseUtils;
 import org.opends.server.core.DirectoryServer;
-import org.opends.server.types.*;
+import org.opends.server.types.AttributeType;
+import org.opends.server.types.DN;
+import org.opends.server.types.LDAPException;
+import org.opends.server.types.RDN;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
@@ -52,24 +55,14 @@
  */
 public class TestCompareResponseProtocolOp extends LdapTestCase
 {
-  /**
-   * The protocol op type for compare responses.
-   */
+  /** The protocol op type for compare responses. */
   public static final byte OP_TYPE_COMPARE_RESPONSE = 0x6F;
-
-  /**
-   * The result code for compare result operations.
-   */
+  /** The result code for compare result operations. */
   private static final int resultCode = 10;
-
-  /**
-   * The error message to use for compare result operations.
-   */
+  /** The error message to use for compare result operations. */
   private static final LocalizableMessage resultMsg = LocalizableMessage.raw("Test Successful");
 
-/**
-   * The DN to use for compare result operations.
-   */
+  /** The DN to use for compare result operations. */
   private DN dn;
 
   @BeforeClass
@@ -79,8 +72,7 @@
     TestCaseUtils.startServer();
 
     //Setup the DN to use in the response tests.
-    AttributeType attribute =
-        DirectoryServer.getDefaultAttributeType("testAttribute");
+    AttributeType attribute = DirectoryServer.getAttributeTypeOrDefault("testAttribute");
     ByteString attributeValue = ByteString.valueOf("testValue");
     dn = new DN(new RDN[] { RDN.create(attribute, attributeValue) });
   }
@@ -93,8 +85,7 @@
   @Test
   public void testOpType() throws Exception
   {
-    CompareResponseProtocolOp compareResponse = new CompareResponseProtocolOp(
-        resultCode);
+    CompareResponseProtocolOp compareResponse = new CompareResponseProtocolOp(resultCode);
     assertEquals(compareResponse.getType(), OP_TYPE_COMPARE_RESPONSE);
   }
 
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestDeleteResponseProtocolOp.java b/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestDeleteResponseProtocolOp.java
index ae6fba9..fd3bff7 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestDeleteResponseProtocolOp.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestDeleteResponseProtocolOp.java
@@ -38,7 +38,10 @@
 import org.forgerock.opendj.ldap.ByteStringBuilder;
 import org.opends.server.TestCaseUtils;
 import org.opends.server.core.DirectoryServer;
-import org.opends.server.types.*;
+import org.opends.server.types.AttributeType;
+import org.opends.server.types.DN;
+import org.opends.server.types.LDAPException;
+import org.opends.server.types.RDN;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
@@ -52,24 +55,14 @@
  */
 public class TestDeleteResponseProtocolOp extends LdapTestCase
 {
-  /**
-   * The protocol op type for delete responses.
-   */
+  /** The protocol op type for delete responses. */
   public static final byte OP_TYPE_DELETE_RESPONSE = 0x6B;
-
-  /**
-   * The result code for delete result operations.
-   */
+  /** The result code for delete result operations. */
   private static final int resultCode = 10;
-
-  /**
-   * The error message to use for delete result operations.
-   */
+  /** The error message to use for delete result operations. */
   private static final LocalizableMessage resultMsg = LocalizableMessage.raw("Test Successful");
 
-/**
-   * The DN to use for delete result operations.
-   */
+  /** The DN to use for delete result operations. */
   private DN dn;
 
   @BeforeClass
@@ -79,8 +72,7 @@
     TestCaseUtils.startServer();
 
     //Setup the DN to use in the response tests.
-    AttributeType attribute =
-        DirectoryServer.getDefaultAttributeType("testAttribute");
+    AttributeType attribute = DirectoryServer.getAttributeTypeOrDefault("testAttribute");
     ByteString attributeValue = ByteString.valueOf("testValue");
     dn = new DN(new RDN[] { RDN.create(attribute, attributeValue) });
   }
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestModifyDNResponseProtocolOp.java b/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestModifyDNResponseProtocolOp.java
index 7181ef0..28f5e64 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestModifyDNResponseProtocolOp.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestModifyDNResponseProtocolOp.java
@@ -56,24 +56,14 @@
  */
 public class TestModifyDNResponseProtocolOp extends DirectoryServerTestCase
 {
-  /**
-   * The protocol op type for modify DN responses.
-   */
+  /** The protocol op type for modify DN responses. */
   public static final byte OP_TYPE_MODIFY_DN_RESPONSE = 0x6D;
-
-  /**
-   * The result code for compare result operations.
-   */
+  /** The result code for compare result operations. */
   private static final int resultCode = 10;
-
-  /**
-   * The error message to use for compare result operations.
-   */
+  /** The error message to use for compare result operations. */
   private static final LocalizableMessage resultMsg = LocalizableMessage.raw("Test Successful");
 
-/**
-   * The DN to use for compare result operations.
-   */
+  /** The DN to use for compare result operations. */
   private DN dn;
 
   @BeforeClass
@@ -83,8 +73,7 @@
     TestCaseUtils.startServer();
 
     //Setup the DN to use in the response tests.
-    AttributeType attribute =
-        DirectoryServer.getDefaultAttributeType("testAttribute");
+    AttributeType attribute = DirectoryServer.getAttributeTypeOrDefault("testAttribute");
     ByteString attributeValue = ByteString.valueOf("testValue");
     dn = new DN(new RDN[] { RDN.create(attribute, attributeValue) });
   }
@@ -97,8 +86,7 @@
   @Test
   public void testOpType() throws Exception
   {
-    ModifyDNResponseProtocolOp modifyResponse = new ModifyDNResponseProtocolOp(
-        resultCode);
+    ModifyDNResponseProtocolOp modifyResponse = new ModifyDNResponseProtocolOp(resultCode);
     assertEquals(modifyResponse.getType(), OP_TYPE_MODIFY_DN_RESPONSE);
   }
 
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestModifyResponseProtocolOp.java b/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestModifyResponseProtocolOp.java
index 8f51cee..a807555 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestModifyResponseProtocolOp.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestModifyResponseProtocolOp.java
@@ -38,7 +38,10 @@
 import org.forgerock.opendj.ldap.ByteStringBuilder;
 import org.opends.server.TestCaseUtils;
 import org.opends.server.core.DirectoryServer;
-import org.opends.server.types.*;
+import org.opends.server.types.AttributeType;
+import org.opends.server.types.DN;
+import org.opends.server.types.LDAPException;
+import org.opends.server.types.RDN;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
@@ -52,24 +55,14 @@
  */
 public class TestModifyResponseProtocolOp extends LdapTestCase
 {
-  /**
-   * The protocol op type for modify responses.
-   */
+  /** The protocol op type for modify responses. */
   public static final byte OP_TYPE_MODIFY_RESPONSE = 0x67;
-
-  /**
-   * The result code for add result operations.
-   */
+  /** The result code for add result operations. */
   private static final int resultCode = 10;
-
-  /**
-   * The error message to use for add result operations.
-   */
+  /** The error message to use for add result operations. */
   private static final LocalizableMessage resultMsg = LocalizableMessage.raw("Test Successful");
 
-/**
-   * The DN to use for add result operations.
-   */
+  /** The DN to use for add result operations. */
   private DN dn;
 
   @BeforeClass
@@ -79,8 +72,7 @@
     TestCaseUtils.startServer();
 
     //Setup the DN to use in the response tests.
-    AttributeType attribute =
-        DirectoryServer.getDefaultAttributeType("testAttribute");
+    AttributeType attribute = DirectoryServer.getAttributeTypeOrDefault("testAttribute");
     ByteString attributeValue = ByteString.valueOf("testValue");
     dn = new DN(new RDN[] { RDN.create(attribute, attributeValue) });
   }
@@ -93,8 +85,7 @@
   @Test
   public void testOpType() throws Exception
   {
-    ModifyResponseProtocolOp modifyResponse = new ModifyResponseProtocolOp(
-        resultCode);
+    ModifyResponseProtocolOp modifyResponse = new ModifyResponseProtocolOp(resultCode);
     assertEquals(modifyResponse.getType(), OP_TYPE_MODIFY_RESPONSE);
   }
 
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/types/AttributeTypeTest.java b/opendj-server-legacy/src/test/java/org/opends/server/types/AttributeTypeTest.java
index d0e5e11..8599cb7 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/types/AttributeTypeTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/types/AttributeTypeTest.java
@@ -51,8 +51,8 @@
   @Test
   public void defaultAttributeTypesWithDifferentCaseEquals()
   {
-    AttributeType attrType = getDefaultAttributeType("displayName");
-    AttributeType attrType2 = getDefaultAttributeType("displayname");
+    AttributeType attrType = getAttributeTypeOrDefault("displayName");
+    AttributeType attrType2 = getAttributeTypeOrDefault("displayname");
     Assert.assertNotSame(attrType, attrType2);
     Assert.assertEquals(attrType, attrType2);
   }
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/types/TestObjectClass.java b/opendj-server-legacy/src/test/java/org/opends/server/types/TestObjectClass.java
index 2fc6b1d..77afee3 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/types/TestObjectClass.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/types/TestObjectClass.java
@@ -341,7 +341,7 @@
 
     for (int i = 0; i < types.length; i++) {
       String name = "testType" + i;
-      types[i] = DirectoryServer.getDefaultAttributeType(name);
+      types[i] = DirectoryServer.getAttributeTypeOrDefault(name);
     }
   }
 

--
Gitblit v1.10.0