From 310df200f78f7d98cc52e4ab97d8a5feb744fa52 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Thu, 28 Apr 2016 09:04:35 +0000
Subject: [PATCH] UCDetector and AutoRefactor code cleanup

---
 opendj-server-legacy/src/main/java/org/opends/server/util/BuildVersion.java                                      |    4 
 opendj-server-legacy/src/main/java/org/opends/server/types/LDIFImportConfig.java                                 |   52 
 opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java  |   94 -
 opendj-server-legacy/src/test/java/org/opends/server/extensions/TLSByteChannelTestCase.java                      |   31 
 opendj-server-legacy/src/main/java/org/opends/server/tools/JavaPropertiesToolArgumentParser.java                 |    4 
 opendj-server-legacy/src/main/java/org/opends/server/tools/JavaPropertiesTool.java                               |   54 
 opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeContext.java                           |   12 
 opendj-server-legacy/src/main/java/org/opends/server/types/SubEntry.java                                         |   30 
 opendj-server-legacy/src/test/java/org/opends/server/util/TestStaticUtils.java                                   |  127 -
 opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeTasks.java                             |   15 
 opendj-server-legacy/src/main/java/org/opends/server/backends/BackupBackend.java                                 |    5 
 opendj-server-legacy/src/main/java/org/opends/server/util/cli/LDAPConnectionArgumentParser.java                  |   35 
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/CancelTaskTask.java                     |   33 
 opendj-server-legacy/src/main/java/org/opends/server/core/DefaultCompressedSchema.java                           |   48 
 opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/Branch.java                                  |   15 
 opendj-server-legacy/src/main/java/org/opends/server/tools/BackendCreationHelper.java                            |    6 
 opendj-server-legacy/src/main/java/org/opends/server/types/DirectoryEnvironmentConfig.java                       |  288 ---
 opendj-server-legacy/src/main/java/org/opends/server/types/NamedCharacterSet.java                                |   30 
 opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/FileManager.java                              |    2 
 opendj-server-legacy/src/main/java/org/opends/server/tools/ExportLDIF.java                                       |   19 
 opendj-server-legacy/src/main/java/org/opends/server/tools/BackendTypeHelper.java                                |    6 
 opendj-server-legacy/src/main/java/org/opends/server/tools/InstallDSArgumentParser.java                          |   36 
 opendj-server-legacy/src/main/java/org/opends/server/util/BackupManager.java                                     |  119 -
 opendj-server-legacy/src/main/java/org/opends/server/tasks/ExportTask.java                                       |    2 
 opendj-server-legacy/src/main/java/org/opends/server/types/LDIFExportConfig.java                                 |  218 --
 opendj-server-legacy/src/main/java/org/opends/server/util/cli/PointAdder.java                                    |    6 
 opendj-server-legacy/src/main/java/org/opends/server/tools/InstallDS.java                                        |   40 
 opendj-server-legacy/src/test/java/org/opends/server/tools/makeldif/MakeLDIFTestCase.java                        |   36 
 opendj-server-legacy/src/main/java/org/opends/server/types/DITContentRule.java                                   |   57 
 opendj-server-legacy/src/main/java/org/opends/server/types/SubtreeSpecification.java                             |   76 
 opendj-server-legacy/src/main/java/org/opends/server/tools/ManageTasks.java                                      |   45 
 opendj-server-legacy/src/main/java/org/opends/server/types/AuthenticationInfo.java                               |   58 
 opendj-server-legacy/src/test/java/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyTestCase.java |   91 -
 opendj-server-legacy/src/main/java/org/opends/server/types/BackupInfo.java                                       |   65 
 opendj-server-legacy/src/main/java/org/opends/server/types/VirtualAttributeRule.java                             |   40 
 opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/Template.java                                |   52 
 opendj-server-legacy/src/main/java/org/opends/server/util/StaticUtils.java                                       |  496 -------
 opendj-server-legacy/src/test/java/org/opends/server/tools/ArgumentParserToolsTestCase.java                      |    4 
 opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java                                        |  110 -
 opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/TemplateEntry.java                           |   30 
 opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/RandomTag.java                               |   66 
 opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/TemplateFile.java                            |  323 ----
 opendj-server-legacy/src/main/java/org/opends/server/types/IntermediateResponse.java                             |   43 
 opendj-server-legacy/src/main/java/org/opends/server/types/LockManager.java                                      |   28 
 opendj-server-legacy/src/main/java/org/opends/server/tools/LDAPPasswordModify.java                               |   45 
 opendj-server-legacy/src/main/java/org/opends/server/types/BackupDirectory.java                                  |   14 
 opendj-server-legacy/src/main/java/org/opends/server/types/LDAPURL.java                                          |   21 
 opendj-server-legacy/src/main/java/org/opends/server/tools/ConfigureWindowsService.java                          |   29 
 opendj-server-legacy/src/main/java/org/opends/server/util/SetupUtils.java                                        |  103 -
 opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeUtils.java                             |   75 
 opendj-server-legacy/src/main/java/org/opends/server/tools/tasks/TaskClient.java                                 |  235 +-
 opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/LicenseFile.java                              |    4 
 opendj-server-legacy/src/main/java/org/opends/server/tools/BackUpDB.java                                         |   12 
 opendj-server-legacy/src/main/java/org/opends/server/tools/ImportLDIF.java                                       |   31 
 opendj-server-legacy/src/main/java/org/opends/server/tools/StopWindowsService.java                               |   14 
 opendj-server-legacy/src/main/java/org/opends/quicksetup/LicenseFile.java                                        |   10 
 opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/TagResult.java                               |   55 
 opendj-server-legacy/src/main/java/org/opends/server/types/FilePermission.java                                   |  215 --
 opendj-server-legacy/src/test/java/org/opends/server/tools/UpgradeTestCase.java                                  |  106 -
 opendj-server-legacy/src/main/java/org/opends/server/types/LDIFImportResult.java                                 |    7 
 opendj-server-legacy/src/main/java/org/opends/server/tools/ConfigureDS.java                                      |   60 
 opendj-server-legacy/src/main/java/org/opends/server/tools/status/StatusCli.java                                 |   63 
 opendj-server-legacy/src/main/java/org/opends/server/util/EMailMessage.java                                      |   55 
 opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java       |   34 
 opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/MonoServerReplicationUserData.java      |   42 
 opendj-server-legacy/src/main/java/org/opends/server/types/Modification.java                                     |    4 
 66 files changed, 858 insertions(+), 3,327 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/CancelTaskTask.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/CancelTaskTask.java
index 0f7373b..9898cbe 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/CancelTaskTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/CancelTaskTask.java
@@ -14,7 +14,6 @@
  * Copyright 2009 Sun Microsystems, Inc.
  * Portions Copyright 2014-2016 ForgeRock AS.
  */
-
 package org.opends.guitools.controlpanel.task;
 
 import static org.opends.messages.AdminToolMessages.*;
@@ -26,12 +25,13 @@
 import java.util.Set;
 import java.util.TreeSet;
 
+import javax.swing.JProgressBar;
 import javax.swing.SwingUtilities;
 
+import org.forgerock.i18n.LocalizableMessage;
 import org.opends.guitools.controlpanel.datamodel.BackendDescriptor;
 import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo;
 import org.opends.guitools.controlpanel.ui.ProgressDialog;
-import org.forgerock.i18n.LocalizableMessage;
 import org.opends.server.tools.ManageTasks;
 import org.opends.server.tools.tasks.TaskEntry;
 
@@ -174,30 +174,27 @@
 
         arguments.toArray(args);
 
-        returnCode = ManageTasks.mainTaskInfo(args, System.in,
-            outPrintStream, errorPrintStream, false);
+        returnCode = ManageTasks.mainTaskInfo(args, outPrintStream, errorPrintStream, false);
         if (returnCode != 0)
         {
           break;
         }
-        else
+
+        numberCanceled++;
+        final int fNumberCanceled = numberCanceled;
+        SwingUtilities.invokeLater(new Runnable()
         {
-          numberCanceled ++;
-          final int fNumberCanceled = numberCanceled;
-          SwingUtilities.invokeLater(new Runnable()
+          @Override
+          public void run()
           {
-            @Override
-            public void run()
+            JProgressBar progressBar = getProgressDialog().getProgressBar();
+            if (fNumberCanceled == 1)
             {
-              if (fNumberCanceled == 1)
-              {
-                getProgressDialog().getProgressBar().setIndeterminate(false);
-              }
-              getProgressDialog().getProgressBar().setValue(
-                  (fNumberCanceled * 100) / totalNumber);
+              progressBar.setIndeterminate(false);
             }
-          });
-        }
+            progressBar.setValue((fNumberCanceled * 100) / totalNumber);
+          }
+        });
       }
       if (returnCode != 0)
       {
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/LicenseFile.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/LicenseFile.java
index cc49924..e7d6212 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/LicenseFile.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/LicenseFile.java
@@ -14,7 +14,6 @@
  * Copyright 2006-2010 Sun Microsystems, Inc.
  * Portions Copyright 2013-2016 ForgeRock AS.
  */
-
 package org.opends.quicksetup;
 
 import java.io.BufferedReader;
@@ -110,7 +109,7 @@
   {
     // Reads the inputstream content.
     try (InputStream input = new FileInputStream(getFile());
-        BufferedReader br = new BufferedReader(new InputStreamReader(input));)
+        BufferedReader br = new BufferedReader(new InputStreamReader(input)))
     {
       final StringBuilder sb = new StringBuilder();
       String read;
@@ -142,12 +141,12 @@
   /**
    * Sets the license approval status.
    *
-   * @param p_approved
+   * @param approved
    *          the license approval status
    */
-  public static void setApproval(boolean p_approved)
+  public static void setApproval(boolean approved)
   {
-    approved = p_approved;
+    LicenseFile.approved = approved;
   }
 
   /**
@@ -190,5 +189,4 @@
   {
     return new File(getInstanceLegalDirectory(), ACCEPTED_LICENSE_FILE_NAME).exists();
   }
-
 }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/BackupBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/BackupBackend.java
index b1e9e9d..7292dad 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/BackupBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/BackupBackend.java
@@ -28,7 +28,6 @@
 import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -610,7 +609,7 @@
     putBoolean(userAttrs, ATTR_BACKUP_ENCRYPTED, backupInfo.isEncrypted());
     putBoolean(userAttrs, ATTR_BACKUP_INCREMENTAL, backupInfo.isIncremental());
 
-    HashSet<String> dependencies = backupInfo.getDependencies();
+    Set<String> dependencies = backupInfo.getDependencies();
     if (dependencies != null && !dependencies.isEmpty()) {
       t = DirectoryServer.getAttributeType(ATTR_BACKUP_DEPENDENCY);
       AttributeBuilder builder = new AttributeBuilder(t);
@@ -628,7 +627,7 @@
       putByteString(userAttrs, ATTR_BACKUP_UNSIGNED_HASH, unsignedHash);
     }
 
-    HashMap<String, String> properties = backupInfo.getBackupProperties();
+    Map<String, String> properties = backupInfo.getBackupProperties();
     if (properties != null && !properties.isEmpty()) {
       for (Map.Entry<String, String> e : properties.entrySet()) {
         t = DirectoryServer.getAttributeType(toLowerCase(e.getKey()));
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/core/DefaultCompressedSchema.java b/opendj-server-legacy/src/main/java/org/opends/server/core/DefaultCompressedSchema.java
index 39b3a68..3a9f611 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/core/DefaultCompressedSchema.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/core/DefaultCompressedSchema.java
@@ -79,20 +79,18 @@
   /** Loads the compressed schema information from disk. */
   private void load()
   {
-    FileInputStream inputStream = null;
-
-    try
+    // Determine the location of the compressed schema data file. It should
+    // be in the config directory with a name of "schematokens.dat". If that
+    // file doesn't exist, then don't do anything.
+    final String path = DirectoryServer.getInstanceRoot() + File.separator
+        + CONFIG_DIR_NAME + File.separator + COMPRESSED_SCHEMA_FILE_NAME;
+    if (!new File(path).exists())
     {
-      // Determine the location of the compressed schema data file. It should
-      // be in the config directory with a name of "schematokens.dat". If that
-      // file doesn't exist, then don't do anything.
-      final String path = DirectoryServer.getInstanceRoot() + File.separator
-          + CONFIG_DIR_NAME + File.separator + COMPRESSED_SCHEMA_FILE_NAME;
-      if (!new File(path).exists())
-      {
-        return;
-      }
-      inputStream = new FileInputStream(path);
+      return;
+    }
+
+    try (FileInputStream inputStream = new FileInputStream(path))
+    {
       final ASN1Reader reader = ASN1.getReader(inputStream);
 
       // The first element in the file should be a sequence of object class
@@ -151,10 +149,6 @@
       // FIXME -- Should we do something else here?
       throw new RuntimeException(e);
     }
-    finally
-    {
-      close(inputStream);
-    }
   }
 
   /**
@@ -167,17 +161,13 @@
   {
     synchronized (saveLock)
     {
-      FileOutputStream outputStream = null;
-      try
+      // Determine the location of the "live" compressed schema data file, and
+      // then append ".tmp" to get the name of the temporary file that we will use.
+      final String path = DirectoryServer.getInstanceRoot() + File.separator
+          + CONFIG_DIR_NAME + File.separator + COMPRESSED_SCHEMA_FILE_NAME;
+      final String tempPath = path + ".tmp";
+      try (FileOutputStream outputStream = new FileOutputStream(tempPath))
       {
-        // Determine the location of the "live" compressed schema data file, and
-        // then append ".tmp" to get the name of the temporary file that we will
-        // use.
-        final String path = DirectoryServer.getInstanceRoot() + File.separator
-            + CONFIG_DIR_NAME + File.separator + COMPRESSED_SCHEMA_FILE_NAME;
-        final String tempPath = path + ".tmp";
-
-        outputStream = new FileOutputStream(tempPath);
         final ASN1Writer writer = ASN1.getWriter(outputStream);
 
         // The first element in the file should be a sequence of object class
@@ -256,10 +246,6 @@
         throw new DirectoryException(
             DirectoryServer.getServerErrorResultCode(), message, e);
       }
-      finally
-      {
-        close(outputStream);
-      }
     }
   }
 }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tasks/ExportTask.java b/opendj-server-legacy/src/main/java/org/opends/server/tasks/ExportTask.java
index 3f32052..b5ca9a0 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tasks/ExportTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tasks/ExportTask.java
@@ -61,7 +61,7 @@
   private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
 
   /** Stores mapping between configuration attribute name and its label. */
-  private static Map<String,LocalizableMessage> argDisplayMap = new HashMap<>();
+  private static final Map<String, LocalizableMessage> argDisplayMap = new HashMap<>();
   static {
     argDisplayMap.put(ATTR_TASK_EXPORT_LDIF_FILE, INFO_EXPORT_ARG_LDIF_FILE.get());
     argDisplayMap.put(ATTR_TASK_EXPORT_BACKEND_ID, INFO_EXPORT_ARG_BACKEND_ID.get());
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/BackUpDB.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/BackUpDB.java
index 88bb917..62ae22d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/BackUpDB.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/BackUpDB.java
@@ -93,18 +93,6 @@
   /**
    * Processes the command-line arguments and invokes the backup process.
    *
-   * @param  args  The command-line arguments provided to this program.
-   *
-   * @return The error code.
-   */
-  public static int mainBackUpDB(String[] args)
-  {
-    return mainBackUpDB(args, true, System.out, System.err);
-  }
-
-  /**
-   * Processes the command-line arguments and invokes the backup process.
-   *
    * @param  args              The command-line arguments provided to this
    *                           program.
    * @param  initializeServer  Indicates whether to initialize the server.
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/BackendCreationHelper.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/BackendCreationHelper.java
index 042cd14..accb6d1 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/BackendCreationHelper.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/BackendCreationHelper.java
@@ -41,12 +41,12 @@
   /** Describes an attribute index which should be created during installation. */
   public static final class DefaultIndex
   {
-    static DefaultIndex withEqualityAndSubstring(final String name)
+    private static DefaultIndex withEqualityAndSubstring(final String name)
     {
       return new DefaultIndex(name, true);
     }
 
-    static DefaultIndex withEquality(final String name)
+    private static DefaultIndex withEquality(final String name)
     {
       return new DefaultIndex(name, false);
     }
@@ -133,7 +133,7 @@
    * @throws Exception
    *           If any problems occurred
    */
-  public static void createBackend(RootCfgClient rootConfiguration, String backendName, Collection<DN> baseDNs,
+  private static void createBackend(RootCfgClient rootConfiguration, String backendName, Collection<DN> baseDNs,
       ManagedObjectDefinition<? extends BackendCfgClient, ? extends BackendCfg> backendType) throws Exception
   {
       final BackendCfgClient backendCfgClient = rootConfiguration.createBackend(backendType, backendName, null);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/BackendTypeHelper.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/BackendTypeHelper.java
index f4e5c7b..516c320 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/BackendTypeHelper.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/BackendTypeHelper.java
@@ -36,7 +36,6 @@
  */
 public class BackendTypeHelper
 {
-
   /**
    * Filter the provided backend name by removing the backend suffix.
    *
@@ -104,7 +103,6 @@
     {
       return backend;
     }
-
   }
 
   private final List<ManagedObjectDefinition<? extends BackendCfgClient, ? extends BackendCfg>> backends;
@@ -150,7 +148,6 @@
     }
   }
 
-
   ManagedObjectDefinition<? extends BackendCfgClient, ? extends BackendCfg> retrieveBackendTypeFromName(
       final String backendTypeStr)
   {
@@ -227,10 +224,9 @@
    *          the backend type to adapt.
    * @return a BackendTypeUIAdapter which adapts the provided backend.
    */
-  public static BackendTypeUIAdapter getBackendTypeAdapter(
+  private static BackendTypeUIAdapter getBackendTypeAdapter(
       ManagedObjectDefinition<? extends BackendCfgClient, ? extends BackendCfg> backend)
   {
     return new BackendTypeUIAdapter(backend);
   }
-
 }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/ConfigureDS.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/ConfigureDS.java
index 181976d..994b7ca 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/ConfigureDS.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/ConfigureDS.java
@@ -16,19 +16,19 @@
  */
 package org.opends.server.tools;
 
+import static com.forgerock.opendj.cli.ArgumentConstants.*;
 import static com.forgerock.opendj.cli.CliMessages.INFO_FILE_PLACEHOLDER;
 import static com.forgerock.opendj.cli.CliMessages.INFO_JMXPORT_PLACEHOLDER;
 import static com.forgerock.opendj.cli.CliMessages.INFO_PORT_PLACEHOLDER;
+import static com.forgerock.opendj.cli.CommonArguments.*;
+import static com.forgerock.opendj.cli.Utils.*;
+
 import static org.opends.messages.ConfigMessages.*;
 import static org.opends.messages.ToolMessages.*;
 import static org.opends.server.config.ConfigConstants.*;
 import static org.opends.server.util.ServerConstants.*;
 import static org.opends.server.util.StaticUtils.*;
 
-import static com.forgerock.opendj.cli.ArgumentConstants.*;
-import static com.forgerock.opendj.cli.Utils.*;
-import static com.forgerock.opendj.cli.CommonArguments.*;
-
 import java.io.File;
 import java.io.OutputStream;
 import java.io.PrintStream;
@@ -46,22 +46,21 @@
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
 import org.forgerock.opendj.adapter.server3x.Converters;
+import org.forgerock.opendj.config.DefaultBehaviorProvider;
+import org.forgerock.opendj.config.DefinedDefaultBehaviorProvider;
 import org.forgerock.opendj.config.ManagedObjectDefinition;
+import org.forgerock.opendj.config.StringPropertyDefinition;
+import org.forgerock.opendj.config.server.ConfigException;
+import org.forgerock.opendj.ldap.AttributeDescription;
 import org.forgerock.opendj.ldap.DN;
 import org.forgerock.opendj.ldap.LinkedAttribute;
 import org.forgerock.opendj.ldap.LinkedHashMapEntry;
-import org.forgerock.opendj.ldap.AttributeDescription;
 import org.forgerock.opendj.ldap.schema.AttributeType;
 import org.forgerock.opendj.ldap.schema.Syntax;
 import org.forgerock.opendj.server.config.client.BackendCfgClient;
+import org.forgerock.opendj.server.config.meta.CryptoManagerCfgDefn;
 import org.forgerock.opendj.server.config.server.BackendCfg;
 import org.opends.quicksetup.installer.Installer;
-import org.forgerock.opendj.config.DefaultBehaviorProvider;
-import org.forgerock.opendj.config.DefinedDefaultBehaviorProvider;
-import org.forgerock.opendj.config.StringPropertyDefinition;
-import org.forgerock.opendj.config.server.ConfigException;
-import org.forgerock.opendj.server.config.meta.CryptoManagerCfgDefn;
-import org.opends.server.types.Entry;
 import org.opends.server.core.ConfigurationHandler;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.core.LockFileManager;
@@ -69,6 +68,7 @@
 import org.opends.server.protocols.ldap.LDAPResultCode;
 import org.opends.server.types.DirectoryEnvironmentConfig;
 import org.opends.server.types.DirectoryException;
+import org.opends.server.types.Entry;
 import org.opends.server.types.InitializationException;
 import org.opends.server.types.LDIFImportConfig;
 import org.opends.server.types.NullOutputStream;
@@ -185,36 +185,26 @@
       + "ds-cfg-trust-store-type: JCEKS" + NEW_LINE
       + "ds-cfg-trust-store-file: config/truststore" + NEW_LINE;
 
-  /** The fully-qualified name of this class. */
-  private static final String CLASS_NAME = "org.opends.server.tools.ConfigureDS";
-
   /** The DN of the configuration entry defining the LDAP connection handler. */
-  public static final String DN_LDAP_CONNECTION_HANDLER = "cn=LDAP Connection Handler," + DN_CONNHANDLER_BASE;
-
+  private static final String DN_LDAP_CONNECTION_HANDLER = "cn=LDAP Connection Handler," + DN_CONNHANDLER_BASE;
   /** The DN of the configuration entry defining the Administration connector. */
-  public static final String DN_ADMIN_CONNECTOR = "cn=Administration Connector," + DN_CONFIG_ROOT;
-
+  private static final String DN_ADMIN_CONNECTOR = "cn=Administration Connector," + DN_CONFIG_ROOT;
   /** The DN of the configuration entry defining the LDAPS connection handler. */
   private static final String DN_LDAPS_CONNECTION_HANDLER = "cn=LDAPS Connection Handler," + DN_CONNHANDLER_BASE;
-
   /** The DN of the configuration entry defining the HTTP connection handler. */
   private static final String DN_HTTP_CONNECTION_HANDLER =
       "cn=HTTP Connection Handler,cn=Connection Handlers,cn=config";
-
   /** The DN of the configuration entry defining the JMX connection handler. */
   private static final String DN_JMX_CONNECTION_HANDLER = "cn=JMX Connection Handler," + DN_CONNHANDLER_BASE;
-
   /** The DN of the configuration entry defining the initial root user. */
-  public static final String DN_ROOT_USER = "cn=Directory Manager," + DN_ROOT_DN_CONFIG_BASE;
-
+  private static final String DN_ROOT_USER = "cn=Directory Manager," + DN_ROOT_DN_CONFIG_BASE;
   /** The DN of the Crypto Manager. */
-  public static final String DN_CRYPTO_MANAGER = "cn=Crypto Manager,cn=config";
-
+  private static final String DN_CRYPTO_MANAGER = "cn=Crypto Manager,cn=config";
   /** The DN of the DIGEST-MD5 SASL mechanism handler. */
-  public static final String DN_DIGEST_MD5_SASL_MECHANISM = "cn=DIGEST-MD5,cn=SASL Mechanisms,cn=config";
+  private static final String DN_DIGEST_MD5_SASL_MECHANISM = "cn=DIGEST-MD5,cn=SASL Mechanisms,cn=config";
 
-  private static int SUCCESS = 0;
-  private static int ERROR = 1;
+  private static final int SUCCESS = 0;
+  private static final int ERROR = 1;
 
   /**
    * Provides the command-line arguments to the <CODE>configMain</CODE> method
@@ -283,7 +273,7 @@
     arguments = args;
     out = NullOutputStream.wrapOrNullStream(outStream);
     err = NullOutputStream.wrapOrNullStream(errStream);
-    argParser = new ArgumentParser(CLASS_NAME, INFO_CONFIGDS_TOOL_DESCRIPTION.get(), false);
+    argParser = new ArgumentParser(ConfigureDS.class.getName(), INFO_CONFIGDS_TOOL_DESCRIPTION.get(), false);
   }
 
   private int run()
@@ -1188,27 +1178,25 @@
    * Returns <CODE>null</CODE> if no alternative cipher could be found.
    * @return a cipher that is supported by the JVM we are running at.
    */
-  public static String getAlternativeCipher()
+  private static String getAlternativeCipher()
   {
     final String[] preferredAlternativeCiphers =
     {
         "RSA/ECB/OAEPWITHSHA1ANDMGF1PADDING",
         "RSA/ECB/PKCS1Padding"
     };
-    String alternativeCipher = null;
     for (final String cipher : preferredAlternativeCiphers)
     {
       try
       {
         Cipher.getInstance(cipher);
-        alternativeCipher = cipher;
-        break;
+        return cipher;
       }
-      catch (final Throwable t)
+      catch (final Throwable ignored)
       {
+        // ignored
       }
     }
-    return alternativeCipher;
+    return null;
   }
 }
-
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/ConfigureWindowsService.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/ConfigureWindowsService.java
index 280b7f2..70609fa 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/ConfigureWindowsService.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/ConfigureWindowsService.java
@@ -16,9 +16,9 @@
  */
 package org.opends.server.tools;
 
+import static com.forgerock.opendj.cli.CommonArguments.*;
 import static com.forgerock.opendj.cli.Utils.*;
 import static com.forgerock.opendj.util.OperatingSystem.*;
-import static com.forgerock.opendj.cli.CommonArguments.*;
 
 import static org.opends.messages.ToolMessages.*;
 
@@ -83,9 +83,9 @@
   /** The service was already enabled. */
   public static final int SERVICE_ALREADY_ENABLED = 1;
   /** The service name was already in use. */
-  public static final int SERVICE_NAME_ALREADY_IN_USE = 2;
+  private static final int SERVICE_NAME_ALREADY_IN_USE = 2;
   /** An error occurred enabling the service. */
-  public static final int SERVICE_ENABLE_ERROR = 3;
+  private static final int SERVICE_ENABLE_ERROR = 3;
 
   /** Return codes for the method disableService. */
   /** The service was successfully disabled. */
@@ -93,7 +93,7 @@
   /** The service was already disabled. */
   public static final int SERVICE_ALREADY_DISABLED = 1;
   /** The service is marked for deletion. */
-  public static final int SERVICE_MARKED_FOR_DELETION = 2;
+  private static final int SERVICE_MARKED_FOR_DELETION = 2;
   /** An error occurred disabling the service. */
   public static final int SERVICE_DISABLE_ERROR = 3;
 
@@ -101,19 +101,19 @@
   /** The service is enabled. */
   public static final int SERVICE_STATE_ENABLED = 0;
   /** The service is disabled. */
-  public static final int SERVICE_STATE_DISABLED = 1;
+  private static final int SERVICE_STATE_DISABLED = 1;
   /** An error occurred checking the service state. */
-  public static final int SERVICE_STATE_ERROR = 2;
+  private static final int SERVICE_STATE_ERROR = 2;
 
   /** Return codes for the method cleanupService. */
   /** The service cleanup worked. */
-  public static final int SERVICE_CLEANUP_SUCCESS = 0;
+  private static final int SERVICE_CLEANUP_SUCCESS = 0;
   /** The service could not be found. */
-  public static final int SERVICE_NOT_FOUND = 1;
+  private static final int SERVICE_NOT_FOUND = 1;
   /** An error occurred cleaning up the service. */
-  public static final int SERVICE_CLEANUP_ERROR = 2;
+  private static final int SERVICE_CLEANUP_ERROR = 2;
   /** The service is marked for deletion. */
-  public static final int SERVICE_CLEANUP_MARKED_FOR_DELETION = 3;
+  private static final int SERVICE_CLEANUP_MARKED_FOR_DELETION = 3;
 
   /**
    * Configures the Windows service for this instance on this machine. This tool
@@ -144,7 +144,7 @@
    * @return the integer code describing if the operation could be completed or
    *         not.
    */
-  public static int configureWindowsService(String[] args, OutputStream outStream, OutputStream errStream)
+  private static int configureWindowsService(String[] args, OutputStream outStream, OutputStream errStream)
   {
     PrintStream out = NullOutputStream.wrapOrNullStream(outStream);
     PrintStream err = NullOutputStream.wrapOrNullStream(errStream);
@@ -342,7 +342,7 @@
    *         <CODE>SERVICE_ALREADY_ENABLED</CODE> depending on whether the
    *         service could be enabled or not.
    */
-  public static int enableService(PrintStream out, PrintStream err, String serviceName, String serviceDescription)
+  private static int enableService(PrintStream out, PrintStream err, String serviceName, String serviceDescription)
   {
     String serverRoot = getServerRoot();
     String[] cmd;
@@ -511,8 +511,7 @@
    *         <CODE>SERVICE_CLEANUP_ERROR</CODE> depending on whether the service
    *         could be found or not.
    */
-  public static int cleanupService(String serviceName, PrintStream out,
-      PrintStream err)
+  private static int cleanupService(String serviceName, PrintStream out, PrintStream err)
   {
     String[] cmd;
     if (hasUAC())
@@ -593,7 +592,7 @@
    *         <CODE>SERVICE_STATE_ERROR</CODE> depending on the state of the
    *         service.
    */
-  public static int serviceState(PrintStream out, PrintStream err)
+  private static int serviceState(PrintStream out, PrintStream err)
   {
     String serviceName = null;
 
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/ExportLDIF.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/ExportLDIF.java
index 4181bc2..30a55ee 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/ExportLDIF.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/ExportLDIF.java
@@ -78,7 +78,6 @@
   public static void main(String[] args)
   {
     int retCode = mainExportLDIF(args, true, System.out, System.err);
-
     if(retCode != 0)
     {
       System.exit(filterExitCode(retCode));
@@ -88,18 +87,6 @@
   /**
    * Processes the command-line arguments and invokes the export process.
    *
-   * @param  args  The command-line arguments provided to this program.
-   *
-   * @return The error code.
-   */
-  public static int mainExportLDIF(String[] args)
-  {
-    return mainExportLDIF(args, true, System.out, System.err);
-  }
-
-  /**
-   * Processes the command-line arguments and invokes the export process.
-   *
    * @param  args              The command-line arguments provided to this
    *                           program.
    * @param  initializeServer  Indicates whether to initialize the server.
@@ -243,13 +230,13 @@
               BooleanArgument.builder("encryptLDIF")
                       .shortIdentifier('y')
                       .description(INFO_LDIFEXPORT_DESCRIPTION_ENCRYPT_LDIF.get())
-                      .hidden() // See issue #27
+                      .hidden() // See issue OPENDJ-448
                       .buildAndAddToParser(argParser);
       signHash =
               BooleanArgument.builder("signHash")
                       .shortIdentifier('s')
                       .description(INFO_LDIFEXPORT_DESCRIPTION_SIGN_HASH.get())
-                      .hidden() // See issue #28
+                      .hidden() // See issue OPENDJ-448
                       .buildAndAddToParser(argParser);
 
       displayUsage = showUsageArgument();
@@ -306,7 +293,6 @@
     return process(argParser, initializeServer, out, err);
   }
 
-  /** {@inheritDoc} */
   @Override
   public void addTaskAttributes(List<RawAttribute> attributes)
   {
@@ -660,7 +646,6 @@
     return results;
   }
 
-  /** {@inheritDoc} */
   @Override
   public String getTaskId() {
     // NYI.
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/ImportLDIF.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/ImportLDIF.java
index d851208..2c9cd44 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/ImportLDIF.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/ImportLDIF.java
@@ -73,14 +73,10 @@
  * server process (e.g., via the tasks interface).
  */
 public class ImportLDIF extends TaskTool {
-
   private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
 
-  /**
-   * The buffer size that should be used when reading data from LDIF.
-   */
-  public static final int LDIF_BUFFER_SIZE = 1048576;
-
+  /** The buffer size that should be used when reading data from LDIF. */
+  private static final int LDIF_BUFFER_SIZE = 1048576;
 
   /**
    * The main method for ImportLDIF tool.
@@ -90,7 +86,6 @@
   public static void main(String[] args)
   {
     int retCode = mainImportLDIF(args, true, System.out, System.err);
-
     if(retCode != 0)
     {
       System.exit(filterExitCode(retCode));
@@ -100,17 +95,6 @@
   /**
    * Processes the command-line arguments and invokes the import process.
    *
-   * @param  args  The command-line arguments provided to this program.
-   * @return The error code.
-   */
-  public static int mainImportLDIF(String[] args)
-  {
-    return mainImportLDIF(args, true, System.out, System.err);
-  }
-
-  /**
-   * Processes the command-line arguments and invokes the import process.
-   *
    * @param  args              The command-line arguments provided to this
    *                           program.
    * @param  initializeServer  Indicates whether to initialize the server.
@@ -157,14 +141,12 @@
 
   private int process(String[] args, boolean initializeServer,
                       OutputStream outStream, OutputStream errStream) {
-
     PrintStream out = NullOutputStream.wrapOrNullStream(outStream);
     PrintStream err = NullOutputStream.wrapOrNullStream(errStream);
     JDKLogging.disableLogging();
 
     // FIXME -- Need to add a mechanism for verifying the file signature.
 
-
     // Create the command-line argument parser for use with this program.
     LDAPConnectionArgumentParser argParser =
             createArgParser("org.opends.server.tools.ImportLDIF", INFO_LDIFIMPORT_TOOL_DESCRIPTION.get());
@@ -203,13 +185,11 @@
       return 1;
     }
 
-
     if (argParser.usageOrVersionDisplayed())
     {
       return 0;
     }
 
-
     // Make sure that either the "ldifFile" argument or the "templateFile"
     // argument was provided, but not both.
     if (ldifFiles.isPresent())
@@ -617,7 +597,6 @@
       }
     }
 
-
     // Get information about the backends defined in the server.  Iterate
     // through them, finding the one backend into which the LDIF should be
     // imported and finding backends with subordinate base DNs that should be
@@ -747,7 +726,6 @@
       }
     }
 
-
     // See if the data should be read from LDIF files or generated via MakeLDIF.
     LDIFImportConfig importConfig;
     if (ldifFiles.isPresent())
@@ -791,7 +769,6 @@
       importConfig = new LDIFImportConfig(tf);
     }
 
-
     // Create the LDIF import configuration to use when reading the LDIF.
     importConfig.setCompressed(isCompressed.isPresent());
     importConfig.setClearBackend(clearBackend.isPresent());
@@ -876,7 +853,6 @@
     DN[] baseDNs = new DN[defaultIncludeBranches.size()];
     defaultIncludeBranches.toArray(baseDNs);
 
-
     // Acquire an exclusive lock for the backend.
     try
     {
@@ -894,7 +870,6 @@
       return 1;
     }
 
-
     // Launch the import.
     int retCode = 0;
     try
@@ -933,7 +908,6 @@
       retCode = 1;
     }
 
-
     // Release the exclusive lock on the backend.
     try
     {
@@ -951,7 +925,6 @@
       retCode = 1;
     }
 
-
     // Clean up after the import by closing the import config.
     importConfig.close();
     return retCode;
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/InstallDS.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/InstallDS.java
index 6bc8fde..d5e48b5 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/InstallDS.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/InstallDS.java
@@ -29,7 +29,6 @@
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.IOException;
-import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.io.PrintStream;
@@ -41,13 +40,13 @@
 import java.util.LinkedList;
 import java.util.List;
 
-import javax.naming.ldap.LdapName;
-
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizableMessageDescriptor.Arg0;
 import org.forgerock.i18n.LocalizableMessageDescriptor.Arg1;
+import org.forgerock.i18n.LocalizedIllegalArgumentException;
 import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.forgerock.opendj.config.ManagedObjectDefinition;
+import org.forgerock.opendj.ldap.DN;
 import org.forgerock.opendj.server.config.client.BackendCfgClient;
 import org.forgerock.opendj.server.config.server.BackendCfg;
 import org.opends.messages.QuickSetupMessages;
@@ -205,7 +204,6 @@
 
   private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
 
-
   /**
    * Constructor for the InstallDS object.
    *
@@ -213,12 +211,10 @@
    *          the print stream to use for standard output.
    * @param err
    *          the print stream to use for standard error.
-   * @param in
-   *          the input stream to use for standard input.
    * @param tempLogFile
    *          the temporary log file where messages will be logged.
    */
-  public InstallDS(PrintStream out, PrintStream err, InputStream in, TempLogFile tempLogFile)
+  private InstallDS(PrintStream out, PrintStream err, TempLogFile tempLogFile)
   {
     super(out, err);
     this.tempLogFile = tempLogFile;
@@ -236,7 +232,7 @@
    */
   public static int mainCLI(String[] args, final TempLogFile tempLogFile)
   {
-    return mainCLI(args, System.out, System.err, System.in, tempLogFile);
+    return mainCLI(args, System.out, System.err, tempLogFile);
   }
 
   /**
@@ -251,21 +247,19 @@
    * @param errStream
    *          The output stream to use for standard error, or <CODE>null</CODE>
    *          if standard error is not needed.
-   * @param inStream
-   *          The input stream to use for standard input.
    * @param tempLogFile
    *          the temporary log file where messages will be logged.
    * @return The error code.
    */
-  public static int mainCLI(
-      String[] args, OutputStream outStream, OutputStream errStream, InputStream inStream, TempLogFile tempLogFile)
+  private static int mainCLI(
+      String[] args, OutputStream outStream, OutputStream errStream, TempLogFile tempLogFile)
   {
     final PrintStream out = NullOutputStream.wrapOrNullStream(outStream);
 
     System.setProperty(Constants.CLI_JAVA_PROPERTY, "true");
 
     final PrintStream err = NullOutputStream.wrapOrNullStream(errStream);
-    final InstallDS install = new InstallDS(out, err, inStream, tempLogFile);
+    final InstallDS install = new InstallDS(out, err, tempLogFile);
 
     return install.execute(args);
   }
@@ -278,7 +272,7 @@
    *          the command-line arguments provided to this program.
    * @return the return code (SUCCESSFUL, USER_DATA_ERROR or BUG).
    */
-  public int execute(String[] args)
+  private int execute(String[] args)
   {
     argParser = new InstallDSArgumentParser(InstallDS.class.getName());
     try
@@ -343,7 +337,6 @@
       return printAndReturnErrorCode(e.getMessageObject()).getReturnCode();
     }
 
-
     System.setProperty(Constants.CLI_JAVA_PROPERTY, "true");
     final Installer installer = new Installer();
     installer.setTempLogFile(tempLogFile);
@@ -511,7 +504,6 @@
     println();
   }
 
-
   private InstallReturnCode printAndReturnErrorCode(LocalizableMessage message)
   {
     println(message);
@@ -562,40 +554,33 @@
     }
   }
 
-  /** {@inheritDoc} */
   @Override
   public boolean isQuiet()
   {
     return argParser.quietArg.isPresent();
   }
 
-  /** {@inheritDoc} */
   @Override
   public boolean isInteractive()
   {
     return !argParser.noPromptArg.isPresent();
   }
 
-  /** {@inheritDoc} */
   @Override
   public boolean isMenuDrivenMode() {
     return true;
   }
 
-  /** {@inheritDoc} */
   @Override
   public boolean isScriptFriendly() {
     return false;
   }
 
-  /** {@inheritDoc} */
   @Override
   public boolean isAdvancedMode() {
     return false;
   }
 
-
-  /** {@inheritDoc} */
   @Override
   public boolean isVerbose() {
     return argParser.verboseArg.isPresent();
@@ -685,9 +670,9 @@
   {
     try
     {
-      new LdapName(baseDN);
+      DN.valueOf(baseDN);
     }
-    catch (final Exception e)
+    catch (final LocalizedIllegalArgumentException | NullPointerException e)
     {
       errorMessages.add(ERR_INSTALLDS_CANNOT_PARSE_DN.get(baseDN, e.getMessage()));
     }
@@ -1010,7 +995,7 @@
       {
         try
         {
-          new LdapName(dn);
+          DN.valueOf(dn);
           if (dn.trim().length() == 0)
           {
             toRemove.add(dn);
@@ -1199,7 +1184,6 @@
     final List<String> baseDNs = promptIfRequiredForDNs(
             argParser.baseDNArg, lastResetBaseDN, INFO_INSTALLDS_PROMPT_BASEDN.get(), true);
     return promptIfRequiredForDataOptions(baseDNs);
-
   }
 
   private ManagedObjectDefinition<? extends BackendCfgClient, ? extends BackendCfg> getOrPromptForBackendType()
@@ -1612,7 +1596,6 @@
           INFO_INSTALLDS_CERT_OPTION_PKCS11.get()
       };
 
-
       final MenuBuilder<Integer> builder = new MenuBuilder<>(this);
       builder.setPrompt(INFO_INSTALLDS_HEADER_CERT_TYPE.get());
 
@@ -2555,5 +2538,4 @@
   {
     return argParser.getConnectTimeout();
   }
-
 }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/InstallDSArgumentParser.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/InstallDSArgumentParser.java
index a969cbb..6a08ca8 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/InstallDSArgumentParser.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/InstallDSArgumentParser.java
@@ -16,16 +16,17 @@
  */
 package org.opends.server.tools;
 
+import static com.forgerock.opendj.cli.ArgumentConstants.*;
 import static com.forgerock.opendj.cli.CliMessages.INFO_JMXPORT_PLACEHOLDER;
 import static com.forgerock.opendj.cli.CliMessages.INFO_KEYSTORE_PWD_FILE_PLACEHOLDER;
 import static com.forgerock.opendj.cli.CliMessages.INFO_NUM_ENTRIES_PLACEHOLDER;
 import static com.forgerock.opendj.cli.CliMessages.INFO_PORT_PLACEHOLDER;
 import static com.forgerock.opendj.cli.CliMessages.INFO_ROOT_USER_PWD_FILE_PLACEHOLDER;
-import static com.forgerock.opendj.cli.Utils.addErrorMessageIfArgumentsConflict;
-import static org.opends.messages.ToolMessages.*;
-import static com.forgerock.opendj.cli.ArgumentConstants.*;
-import static com.forgerock.opendj.util.OperatingSystem.*;
 import static com.forgerock.opendj.cli.CommonArguments.*;
+import static com.forgerock.opendj.cli.Utils.addErrorMessageIfArgumentsConflict;
+import static com.forgerock.opendj.util.OperatingSystem.*;
+
+import static org.opends.messages.ToolMessages.*;
 
 import java.util.Collection;
 import java.util.HashSet;
@@ -63,14 +64,14 @@
 {
   private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
 
-  BooleanArgument   cliArg;
+  private BooleanArgument cliArg;
   BooleanArgument   addBaseEntryArg;
-  BooleanArgument   showUsageArg;
+  private BooleanArgument showUsageArg;
   BooleanArgument   quietArg;
   BooleanArgument   noPromptArg;
   BooleanArgument   verboseArg;
-  StringArgument    propertiesFileArgument;
-  BooleanArgument   noPropertiesFileArgument;
+  private StringArgument propertiesFileArgument;
+  private BooleanArgument noPropertiesFileArgument;
   BooleanArgument   skipPortCheckArg;
   BooleanArgument   enableWindowsServiceArg;
   BooleanArgument   doNotStartArg;
@@ -78,8 +79,8 @@
   BooleanArgument   generateSelfSignedCertificateArg;
   StringArgument    hostNameArg;
   BooleanArgument   usePkcs11Arg;
-  FileBasedArgument directoryManagerPwdFileArg;
-  FileBasedArgument keyStorePasswordFileArg;
+  private FileBasedArgument directoryManagerPwdFileArg;
+  private FileBasedArgument keyStorePasswordFileArg;
   IntegerArgument   ldapPortArg;
   IntegerArgument   adminConnectorPortArg;
   IntegerArgument   ldapsPortArg;
@@ -90,14 +91,14 @@
   StringArgument    rejectedImportFileArg;
   StringArgument    skippedImportFileArg;
   StringArgument    directoryManagerDNArg;
-  StringArgument    directoryManagerPwdStringArg;
+  private StringArgument directoryManagerPwdStringArg;
   StringArgument    useJavaKeyStoreArg;
   StringArgument    useJCEKSArg;
   StringArgument    usePkcs12Arg;
-  StringArgument    keyStorePasswordArg;
+  private StringArgument keyStorePasswordArg;
   StringArgument    certNicknameArg;
-  StringArgument    progNameArg;
-  IntegerArgument   connectTimeoutArg;
+  private StringArgument progNameArg;
+  private IntegerArgument connectTimeoutArg;
   BooleanArgument   acceptLicense;
   StringArgument    backendTypeArg;
 
@@ -418,7 +419,6 @@
     return cliArg.isPresent();
   }
 
-  /** {@inheritDoc} */
   @Override
   public void parseArguments(String[] args) throws ArgumentException
   {
@@ -539,14 +539,10 @@
   private void checkPortAlreadyUsed(Set<Integer> ports, int port, Collection<LocalizableMessage> errorMessages,
       Arg1<Object> errorMsg)
   {
-    if (ports.contains(port))
+    if (!ports.add(port))
     {
       errorMessages.add(errorMsg.get(port));
     }
-    else
-    {
-      ports.add(port);
-    }
   }
 
   /**
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/JavaPropertiesTool.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/JavaPropertiesTool.java
index 228f317..ae50407 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/JavaPropertiesTool.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/JavaPropertiesTool.java
@@ -12,16 +12,16 @@
  * information: "Portions Copyright [year] [name of copyright owner]".
  *
  * Copyright 2008-2009 Sun Microsystems, Inc.
- * Portions Copyright 2011-2015 ForgeRock AS.
+ * Portions Copyright 2011-2016 ForgeRock AS.
  */
 package org.opends.server.tools;
 
-import static org.opends.messages.ToolMessages.*;
-import static org.opends.server.util.ServerConstants.*;
-
 import static com.forgerock.opendj.cli.Utils.*;
 import static com.forgerock.opendj.util.OperatingSystem.*;
 
+import static org.opends.messages.ToolMessages.*;
+import static org.opends.server.util.ServerConstants.*;
+
 import java.io.BufferedReader;
 import java.io.BufferedWriter;
 import java.io.File;
@@ -43,52 +43,34 @@
 import com.forgerock.opendj.cli.ArgumentException;
 import com.forgerock.opendj.cli.ConsoleApplication;
 
-
 /**
  * This class is used to update the scripts that are used to launch the command
  * lines.  We read the contents of a given properties file and we update the
  * scripts setting the arguments and JVM to be used by the different scripts.
- *
  */
 public class JavaPropertiesTool extends ConsoleApplication
 {
   /** The argument parser. */
   private JavaPropertiesToolArgumentParser argParser;
 
-  /**
-   * The enumeration containing the different return codes that the command-line
-   * can have.
-   *
-   */
+  /** The enumeration containing the different return codes that the command-line can have. */
   public enum ErrorReturnCode
   {
-    /**
-     * Successful setup.
-     */
+    /** Successful setup. */
     SUCCESSFUL(0),
-    /**
-     * We did no have an error but the setup was not executed (displayed version
-     * or usage).
-     */
+    /** We did no have an error but the setup was not executed (displayed version or usage). */
     SUCCESSFUL_NOP(0),
-    /**
-     * Unexpected error (potential bug).
-     */
+    /** Unexpected error (potential bug). */
     ERROR_UNEXPECTED(1),
-    /**
-     * Cannot parse arguments or data provided by user is not valid.
-     */
+    /** Cannot parse arguments or data provided by user is not valid. */
     ERROR_USER_DATA(2),
-    /**
-     * Error writing to destination file.
-     */
+    /** Error writing to destination file. */
     ERROR_WRITING_FILE(3),
-    /**
-     * Conflicting command line arguments.
-     */
+    /** Conflicting command line arguments. */
     CONFLICTING_ARGS(18);
 
-    private int returnCode;
+    private final int returnCode;
+
     private ErrorReturnCode(int returnCode)
     {
       this.returnCode = returnCode;
@@ -119,7 +101,7 @@
    * @param err the print stream to use for standard error.
    * @param in the input stream to use for standard input.
    */
-  public JavaPropertiesTool(PrintStream out, PrintStream err, InputStream in)
+  private JavaPropertiesTool(PrintStream out, PrintStream err, InputStream in)
   {
     super(out, err);
   }
@@ -341,7 +323,6 @@
     }
     println();
 
-
     return ErrorReturnCode.SUCCESSFUL.getReturnCode();
   }
 
@@ -422,40 +403,33 @@
     }
   }
 
-  /** {@inheritDoc} */
   @Override
   public boolean isQuiet()
   {
     return argParser.quietArg.isPresent();
   }
 
-  /** {@inheritDoc} */
   @Override
   public boolean isInteractive()
   {
     return false;
   }
 
-  /** {@inheritDoc} */
   @Override
   public boolean isMenuDrivenMode() {
     return true;
   }
 
-  /** {@inheritDoc} */
   @Override
   public boolean isScriptFriendly() {
     return false;
   }
 
-  /** {@inheritDoc} */
   @Override
   public boolean isAdvancedMode() {
     return false;
   }
 
-
-  /** {@inheritDoc} */
   @Override
   public boolean isVerbose() {
     return true;
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/JavaPropertiesToolArgumentParser.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/JavaPropertiesToolArgumentParser.java
index 3ebf831..8789022 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/JavaPropertiesToolArgumentParser.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/JavaPropertiesToolArgumentParser.java
@@ -16,9 +16,9 @@
  */
 package org.opends.server.tools;
 
+import static com.forgerock.opendj.cli.CommonArguments.*;
 import static com.forgerock.opendj.cli.Utils.*;
 import static com.forgerock.opendj.util.OperatingSystem.*;
-import static com.forgerock.opendj.cli.CommonArguments.*;
 
 import static org.opends.messages.ToolMessages.*;
 
@@ -42,7 +42,7 @@
 public class JavaPropertiesToolArgumentParser extends ArgumentParser
 {
   /** Usage argument. */
-  BooleanArgument   showUsageArg;
+  private BooleanArgument showUsageArg;
   /** Quiet argument. */
   BooleanArgument   quietArg;
   /** The file containing the properties. */
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/LDAPPasswordModify.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/LDAPPasswordModify.java
index d42a00b..243f0f8 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/LDAPPasswordModify.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/LDAPPasswordModify.java
@@ -78,15 +78,10 @@
  */
 public class LDAPPasswordModify
 {
-  /**
-   * The fully-qualified name of this class.
-   */
+  /** The fully-qualified name of this class. */
   private static final String CLASS_NAME =
        "org.opends.server.tools.LDAPPasswordModify";
 
-
-
-
   /**
    * Parses the command-line arguments, establishes a connection to the
    * Directory Server, sends the password modify request, and reads the
@@ -103,25 +98,6 @@
     }
   }
 
-
-
-  /**
-   * Parses the command-line arguments, establishes a connection to the
-   * Directory Server, sends the password modify request, and reads the
-   * response.
-   *
-   * @param  args  The command-line arguments provided to this program.
-   *
-   * @return  An integer value of zero if everything completed successfully, or
-   *          a nonzero value if an error occurred.
-   */
-  public static int mainPasswordModify(String[] args)
-  {
-    return mainPasswordModify(args, true, System.out, System.err);
-  }
-
-
-
   /**
    * Parses the command-line arguments, establishes a connection to the
    * Directory Server, sends the password modify request, and reads the
@@ -143,7 +119,6 @@
     PrintStream out = NullOutputStream.wrapOrNullStream(outStream);
     PrintStream err = NullOutputStream.wrapOrNullStream(errStream);
 
-
     // Create the arguments that will be used by this program.
     BooleanArgument   provideDNForAuthzID;
     BooleanArgument   showUsage;
@@ -172,7 +147,6 @@
     StringArgument    propertiesFileArgument;
     BooleanArgument   noPropertiesFileArgument;
 
-
     // Initialize the argument parser.
     LocalizableMessage toolDescription = INFO_LDAPPWMOD_TOOL_DESCRIPTION.get();
     ArgumentParser argParser = new ArgumentParser(CLASS_NAME, toolDescription,
@@ -342,7 +316,6 @@
       return CLIENT_SIDE_PARAM_ERROR;
     }
 
-
     // Parse the command-line arguments provided to this program.
     try
     {
@@ -354,7 +327,6 @@
       return CLIENT_SIDE_PARAM_ERROR;
     }
 
-
     // If the usage or version argument was provided,
     // then we don't need to do anything else.
     if (argParser.usageOrVersionDisplayed())
@@ -362,7 +334,6 @@
       return 0;
     }
 
-
     // Make sure that the user didn't specify any conflicting arguments.
     try
     {
@@ -412,7 +383,6 @@
       }
     }
 
-
     // Get the host and port.
     String host = ldapHost.getValue();
     int    port;
@@ -427,7 +397,6 @@
       return CLIENT_SIDE_PARAM_ERROR;
     }
 
-
     // If a control string was provided, then decode the requested controls.
     ArrayList<Control> controls = new ArrayList<>();
     if(controlStr.isPresent())
@@ -444,14 +413,12 @@
       }
     }
 
-
     // Perform a basic Directory Server bootstrap if appropriate.
     if (initializeServer)
     {
       EmbeddedUtils.initializeForClientUse();
     }
 
-
     // Establish a connection to the Directory Server.
     AtomicInteger nextMessageID = new AtomicInteger(1);
     LDAPConnectionOptions connectionOptions = new LDAPConnectionOptions();
@@ -512,7 +479,7 @@
     {
       dn = bindDN.getValue();
       pw = bindPW.getValue();
-      if(pw != null && pw.equals("-"))
+      if ("-".equals(pw))
       {
         // read the password from the stdin.
         try
@@ -567,7 +534,6 @@
     LDAPReader reader = connection.getLDAPReader();
     LDAPWriter writer = connection.getLDAPWriter();
 
-
     // Construct the password modify request.
     ByteStringBuilder builder = new ByteStringBuilder();
     ASN1Writer asn1Writer = ASN1.getWriter(builder);
@@ -625,7 +591,6 @@
          new LDAPMessage(nextMessageID.getAndIncrement(), extendedRequest,
                          controls);
 
-
     // Send the request to the server and read the response.
     try
     {
@@ -639,7 +604,6 @@
       return 1;
     }
 
-
     // Read the response from the server.
     LDAPMessage responseMessage = null;
     try
@@ -654,7 +618,6 @@
       return 1;
     }
 
-
     // Make sure that the response was acceptable.
     ExtendedResponseProtocolOp extendedResponse =
          responseMessage.getExtendedResponseProtocolOp();
@@ -689,7 +652,6 @@
       }
     }
 
-
     // See if the response included any controls that we recognize, and if so
     // then handle them.
     List<Control> responseControls = responseMessage.getControls();
@@ -728,7 +690,6 @@
       }
     }
 
-
     // See if the response included a generated password.
     ByteString responseValue = extendedResponse.getValue();
     if (responseValue != null)
@@ -759,7 +720,6 @@
       }
     }
 
-
     // Unbind from the server and close the connection.
     unbind(nextMessageID, writer);
     close(reader, writer);
@@ -777,4 +737,3 @@
     catch (Exception e) {}
   }
 }
-
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/ManageTasks.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/ManageTasks.java
index 2c8b75c..1c12462 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/ManageTasks.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/ManageTasks.java
@@ -43,7 +43,6 @@
 import com.forgerock.opendj.cli.TextTablePrinter;
 
 import java.io.IOException;
-import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.PrintStream;
 import java.io.StringWriter;
@@ -55,8 +54,8 @@
 import static org.opends.messages.ToolMessages.*;
 
 import static com.forgerock.opendj.cli.ArgumentConstants.*;
-import static com.forgerock.opendj.cli.Utils.*;
 import static com.forgerock.opendj.cli.CommonArguments.*;
+import static com.forgerock.opendj.cli.Utils.*;
 
 /** Tool for getting information and managing tasks in the Directory Server. */
 public class ManageTasks extends ConsoleApplication {
@@ -69,29 +68,16 @@
    * @param args The command-line arguments provided to this program.
    */
   public static void main(String[] args) {
-    int retCode = mainTaskInfo(args, System.in, System.out, System.err);
-
+    int retCode = mainTaskInfo(args, System.out, System.err);
     if (retCode != 0) {
       System.exit(filterExitCode(retCode));
     }
   }
 
   /**
-   * Processes the command-line arguments and invokes the process for
-   * displaying task information.
-   *
-   * @param args The command-line arguments provided to this program.
-   * @return int return code
-   */
-  public static int mainTaskInfo(String[] args) {
-    return mainTaskInfo(args, System.in, System.out, System.err);
-  }
-
-  /**
    * Processes the command-line arguments and invokes the export process.
    *
    * @param args             The command-line arguments provided to this
-   * @param in               Input stream from which to solicit user input.
    * @param out              The output stream to use for standard output, or
    *                         {@code null} if standard output is not needed.
    * @param err              The output stream to use for standard error, or
@@ -100,11 +86,10 @@
    * @return int return code
    */
   public static int mainTaskInfo(String[] args,
-                                 InputStream in,
                                  OutputStream out,
                                  OutputStream err,
                                  boolean initializeServer) {
-    ManageTasks tool = new ManageTasks(in, out, err);
+    ManageTasks tool = new ManageTasks(out, err);
     return tool.process(args, initializeServer);
   }
 
@@ -112,18 +97,16 @@
    * Processes the command-line arguments and invokes the export process.
    *
    * @param args             The command-line arguments provided to this
-   * @param in               Input stream from which to solicit user input.
    * @param out              The output stream to use for standard output, or
    *                         {@code null} if standard output is not needed.
    * @param err              The output stream to use for standard error, or
    *                         {@code null} if standard error is not needed.
    * @return int return code
    */
-  public static int mainTaskInfo(String[] args,
-                                 InputStream in,
+  private static int mainTaskInfo(String[] args,
                                  OutputStream out,
                                  OutputStream err) {
-    return mainTaskInfo(args, in, out, err, true);
+    return mainTaskInfo(args, out, err, true);
   }
 
   private static final int INDENT = 2;
@@ -142,14 +125,12 @@
 
   /**
    * Constructs a parameterized instance.
-   *
-   * @param in               Input stream from which to solicit user input.
    * @param out              The output stream to use for standard output, or
    *                         {@code null} if standard output is not needed.
    * @param err              The output stream to use for standard error, or
    *                         {@code null} if standard error is not needed.
    */
-  public ManageTasks(InputStream in, OutputStream out, OutputStream err)
+  private ManageTasks(OutputStream out, OutputStream err)
   {
     super(new PrintStream(out), new PrintStream(err));
   }
@@ -159,22 +140,10 @@
    *
    * @param args       The command-line arguments provided to this
    *                   program.
-   * @return The error code.
-   */
-  public int process(String[] args)
-  {
-    return process(args, true);
-  }
-
-  /**
-   * Processes the command-line arguments and invokes the export process.
-   *
-   * @param args       The command-line arguments provided to this
-   *                   program.
    * @param initializeServer  Indicates whether to initialize the server.
    * @return The error code.
    */
-  public int process(String[] args, boolean initializeServer)
+  private int process(String[] args, boolean initializeServer)
   {
     if (initializeServer)
     {
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/StopWindowsService.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/StopWindowsService.java
index d385e07..6a1b783 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/StopWindowsService.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/StopWindowsService.java
@@ -12,14 +12,15 @@
  * information: "Portions Copyright [year] [name of copyright owner]".
  *
  * Copyright 2008-2009 Sun Microsystems, Inc.
- * Portions Copyright 2012-2014 ForgeRock AS.
+ * Portions Copyright 2012-2016 ForgeRock AS.
  */
 package org.opends.server.tools;
-import static org.opends.messages.ToolMessages.*;
 
 import static com.forgerock.opendj.cli.Utils.*;
 import static com.forgerock.opendj.util.OperatingSystem.*;
 
+import static org.opends.messages.ToolMessages.*;
+
 import java.io.OutputStream;
 import java.io.PrintStream;
 
@@ -34,11 +35,11 @@
 public class StopWindowsService
 {
   /** The service was successfully stopped. */
-  public static final int SERVICE_STOP_SUCCESSFUL = 0;
+  private static final int SERVICE_STOP_SUCCESSFUL = 0;
   /** The service could not be found. */
-  public static final int SERVICE_NOT_FOUND = 1;
+  private static final int SERVICE_NOT_FOUND = 1;
   /** The service could not be stopped. */
-  public static final int SERVICE_STOP_ERROR = 3;
+  private static final int SERVICE_STOP_ERROR = 3;
 
   /**
    * Invokes the net stop on the service corresponding to this server.
@@ -62,7 +63,7 @@
    * @param errStream
    *          The stream to write error messages.
    */
-  public static int stopWindowsService(OutputStream outStream, OutputStream errStream)
+  private static int stopWindowsService(OutputStream outStream, OutputStream errStream)
   {
     NullOutputStream.wrapOrNullStream(outStream);
     PrintStream err = NullOutputStream.wrapOrNullStream(errStream);
@@ -116,4 +117,3 @@
     }
   }
 }
-
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/MonoServerReplicationUserData.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/MonoServerReplicationUserData.java
index 952b9fc..558b271 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/MonoServerReplicationUserData.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/MonoServerReplicationUserData.java
@@ -22,8 +22,6 @@
 abstract class MonoServerReplicationUserData extends ReplicationUserData
 {
   private HostPort hostPort = new HostPort(null, 0);
-  private boolean useStartTLS;
-  private boolean useSSL;
 
   /**
    * Returns the host name and port of the server.
@@ -42,44 +40,4 @@
   {
     this.hostPort = hostPort;
   }
-
-  /**
-   * Returns <CODE>true</CODE> if we must use SSL to connect to the server and
-   * <CODE>false</CODE> otherwise.
-   * @return <CODE>true</CODE> if we must use SSL to connect to the server and
-   * <CODE>false</CODE> otherwise.
-   */
-  boolean useSSL()
-  {
-    return useSSL;
-  }
-
-  /**
-   * Sets whether we must use SSL to connect to the server or not.
-   * @param useSSL whether we must use SSL to connect to the server or not.
-   */
-  void setUseSSL(boolean useSSL)
-  {
-    this.useSSL = useSSL;
-  }
-
-  /**
-   * Returns <CODE>true</CODE> if we must use StartTLS to connect to the server
-   * and <CODE>false</CODE> otherwise.
-   * @return <CODE>true</CODE> if we must use StartTLS to connect to the server
-   * and <CODE>false</CODE> otherwise.
-   */
-  boolean useStartTLS()
-  {
-    return useStartTLS;
-  }
-
-  /**
-   * Sets whether we must use StartTLS to connect to the server or not.
-   * @param useStartTLS whether we must use SSL to connect to the server or not.
-   */
-  void setUseStartTLS(boolean useStartTLS)
-  {
-    this.useStartTLS = useStartTLS;
-  }
 }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java
index ba87add..03b84a3 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java
@@ -19,8 +19,8 @@
 import static com.forgerock.opendj.cli.ArgumentConstants.*;
 import static com.forgerock.opendj.cli.CliMessages.INFO_BINDPWD_FILE_PLACEHOLDER;
 import static com.forgerock.opendj.cli.CliMessages.INFO_PORT_PLACEHOLDER;
-import static com.forgerock.opendj.cli.Utils.*;
 import static com.forgerock.opendj.cli.CommonArguments.*;
+import static com.forgerock.opendj.cli.Utils.*;
 
 import static org.opends.messages.AdminToolMessages.*;
 import static org.opends.messages.ToolMessages.*;
@@ -82,7 +82,6 @@
     /** The 'secureReplication' argument for the first server. */
     BooleanArgument secureReplicationArg;
 
-
     /**
      * Get the password which has to be used for the command to connect to this server without
      * prompting the user in the enable replication subcommand. If no password was specified return
@@ -149,23 +148,17 @@
   private IntegerArgument portDestinationArg;
   /** The 'suffixes' global argument. */
   StringArgument baseDNsArg;
-  /**The 'quiet' argument.   */
+  /** The 'quiet' argument. */
   private BooleanArgument quietArg;
-  /**The 'scriptFriendly' argument.   */
+  /** The 'scriptFriendly' argument. */
   BooleanArgument scriptFriendlyArg;
-  /**Properties file argument.   */
+  /** Properties file argument. */
   StringArgument propertiesFileArgument;
-  /**No-properties file argument.   */
+  /** No-properties file argument. */
   BooleanArgument noPropertiesFileArgument;
-  /**
-   * The argument that the user must set to display the equivalent
-   * non-interactive mode argument.
-   */
+  /** The argument that the user must set to display the equivalent non-interactive mode argument. */
   BooleanArgument displayEquivalentArgument;
-  /**
-   * The argument that allows the user to dump the equivalent non-interactive
-   * command to a file.
-   */
+  /** The argument that allows the user to dump the equivalent non-interactive command to a file. */
   StringArgument equivalentCommandFileArgument;
   /** The argument that the user must set to have advanced options in interactive mode. */
   BooleanArgument advancedArg;
@@ -181,7 +174,7 @@
   /** The 'maximumDuration' argument for the purge of historical. */
   IntegerArgument maximumDurationArg;
 
-  /** the 'change-number' argument for task reset-changenumber. */
+  /** The 'change-number' argument for task reset-changenumber. */
   IntegerArgument resetChangeNumber;
 
   /** The text of the enable replication subcommand. */
@@ -272,7 +265,6 @@
     validateSubcommandOptions(buf);
   }
 
-  /** {@inheritDoc} */
   @Override
   public int validateGlobalOptions(LocalizableMessageBuilder buf)
   {
@@ -331,7 +323,7 @@
         {
           errors.add(ERR_REPLICATION_NOT_A_VALID_BASEDN.get(dn));
         }
-        if (dn.equalsIgnoreCase(Constants.REPLICATION_CHANGES_DN))
+        if (Constants.REPLICATION_CHANGES_DN.equalsIgnoreCase(dn))
         {
           errors.add(ERR_REPLICATION_NOT_A_USER_SUFFIX.get(Constants.REPLICATION_CHANGES_DN));
         }
@@ -466,7 +458,6 @@
           ArgumentGroup argGroup)
   throws ArgumentException
   {
-
     for (Argument arg : args)
     {
       if (arg == advancedArg)
@@ -485,10 +476,7 @@
     setFilePropertiesArgument(propertiesFileArg);
   }
 
-  /**
-   * Creates the enable replication subcommand and all the specific options
-   * for the subcommand.
-   */
+  /** Creates the enable replication subcommand and all the specific options for the subcommand. */
   private void createEnableReplicationSubCommand() throws ArgumentException
   {
     createServerArgs1();
@@ -796,7 +784,7 @@
             hostNameSourceArg, portSourceArg, hostNameDestinationArg, portDestinationArg, resetChangeNumber);
   }
 
-  IntegerArgument newChangeNumberArgument() throws ArgumentException
+  private IntegerArgument newChangeNumberArgument() throws ArgumentException
   {
     return IntegerArgument.builder("change-number")
             .description(INFO_DESCRIPTION_START_CHANGE_NUMBER.get())
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/Branch.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/Branch.java
index 1333fcf..ed28d1c 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/Branch.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/Branch.java
@@ -26,10 +26,10 @@
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.schema.AttributeType;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.types.Attribute;
-import org.forgerock.opendj.ldap.schema.AttributeType;
-import org.forgerock.opendj.ldap.DN;
 import org.opends.server.types.Entry;
 
 /**
@@ -39,23 +39,18 @@
 public class Branch
 {
   /** The DN for this branch entry. */
-  private DN branchDN;
-
+  private final DN branchDN;
   /**
    * The number of entries that should be created below this branch for each
    * subordinate template.
    */
   private int[] numEntriesPerTemplate;
-
   /** The names of the subordinate templates for this branch. */
   private String[] subordinateTemplateNames;
-
   /** The set of subordinate templates for this branch. */
   private Template[] subordinateTemplates;
-
   /** The set of template lines that correspond to the RDN components. */
-  private TemplateLine[] rdnLines;
-
+  private final TemplateLine[] rdnLines;
   /** The set of extra lines that should be included in this branch entry. */
   private TemplateLine[] extraLines;
 
@@ -90,7 +85,7 @@
    * @param  extraLines                The set of extra lines that should be
    *                                   included in this branch entry.
    */
-  public Branch(TemplateFile templateFile, DN branchDN,
+  private Branch(TemplateFile templateFile, DN branchDN,
                 String[] subordinateTemplateNames, int[] numEntriesPerTemplate,
                 TemplateLine[] extraLines)
   {
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/RandomTag.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/RandomTag.java
index e4a8642..b0f22ca 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/RandomTag.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/RandomTag.java
@@ -15,22 +15,17 @@
  * Portions Copyright 2014-2016 ForgeRock AS.
  */
 package org.opends.server.tools.makeldif;
-import org.forgerock.i18n.LocalizableMessage;
 
-
+import static org.opends.messages.ToolMessages.*;
+import static org.opends.server.util.StaticUtils.*;
 
 import java.text.DecimalFormat;
 import java.util.List;
 import java.util.Random;
 
+import org.forgerock.i18n.LocalizableMessage;
 import org.opends.server.types.InitializationException;
 
-import static org.opends.messages.ToolMessages.*;
-
-import static org.opends.server.util.StaticUtils.*;
-
-
-
 /**
  * This class defines a tag that may be used to generate random values.  It has
  * a number of subtypes based on the type of information that should be
@@ -61,64 +56,36 @@
    * The value that indicates that the value is to be generated from a fixed
    * number of characters from a given character set.
    */
-  public static final int RANDOM_TYPE_CHARS_FIXED = 1;
-
-
-
+  private static final int RANDOM_TYPE_CHARS_FIXED = 1;
   /**
    * The value that indicates that the value is to be generated from a variable
    * number of characters from a given character set.
    */
-  public static final int RANDOM_TYPE_CHARS_VARIABLE = 2;
-
-
-
+  private static final int RANDOM_TYPE_CHARS_VARIABLE = 2;
   /** The value that indicates that the value should be a random number. */
-  public static final int RANDOM_TYPE_NUMERIC = 3;
-
-
-
+  private static final int RANDOM_TYPE_NUMERIC = 3;
   /** The value that indicates that the value should be a random month. */
-  public static final int RANDOM_TYPE_MONTH = 4;
-
-
-
+  private static final int RANDOM_TYPE_MONTH = 4;
   /** The value that indicates that the value should be a telephone number. */
-  public static final int RANDOM_TYPE_TELEPHONE = 5;
-
-
+  private static final int RANDOM_TYPE_TELEPHONE = 5;
 
   /** The character set that will be used for alphabetic characters. */
-  public static final char[] ALPHA_CHARS =
+  private static final char[] ALPHA_CHARS =
        "abcdefghijklmnopqrstuvwxyz".toCharArray();
-
-
-
   /** The character set that will be used for numeric characters. */
-  public static final char[] NUMERIC_CHARS = "01234567890".toCharArray();
-
-
-
+  private static final char[] NUMERIC_CHARS = "01234567890".toCharArray();
   /** The character set that will be used for alphanumeric characters. */
-  public static final char[] ALPHANUMERIC_CHARS =
+  private static final char[] ALPHANUMERIC_CHARS =
        "abcdefghijklmnopqrstuvwxyz0123456789".toCharArray();
-
-
-
   /** The character set that will be used for hexadecimal characters. */
-  public static final char[] HEX_CHARS = "01234567890abcdef".toCharArray();
-
-
-
+  private static final char[] HEX_CHARS = "01234567890abcdef".toCharArray();
   /** The character set that will be used for base64 characters. */
-  public static final char[] BASE64_CHARS =
+  private static final char[] BASE64_CHARS =
        ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" +
         "01234567890+/").toCharArray();
 
-
-
   /** The set of month names that will be used. */
-  public static final String[] MONTHS =
+  private static final String[] MONTHS =
   {
     "January",
     "February",
@@ -144,22 +111,17 @@
 
   /** The number of characters between the minimum and maximum length (inclusive). */
   private int lengthRange;
-
   /** The maximum number of characters to include in the value. */
   private int maxLength;
-
   /** The minimum number of characters to include in the value. */
   private int minLength;
-
   /** The type of random value that should be generated. */
   private int randomType;
 
   /** The maximum numeric value that should be generated. */
   private long maxValue;
-
   /** The minimum numeric value that should be generated. */
   private long minValue;
-
   /** The number of values between the minimum and maximum value (inclusive). */
   private long valueRange;
 
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/TagResult.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/TagResult.java
index f6ea633..0faba1d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/TagResult.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/TagResult.java
@@ -12,56 +12,34 @@
  * information: "Portions Copyright [year] [name of copyright owner]".
  *
  * Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2015 ForgeRock AS.
+ * Portions Copyright 2015-2016 ForgeRock AS.
  */
 package org.opends.server.tools.makeldif;
 
-
-
 /**
  * This class defines a data structure that provides information about the
  * result of tag processing.
  */
 public class TagResult
 {
-  /**
-   * A tag result in which all components have a value of <CODE>true</CODE>.
-   */
-  public static final TagResult SUCCESS_RESULT =
-       new TagResult(true, true, true, true);
-
-
-
+  /** A tag result in which all components have a value of <CODE>true</CODE>. */
+  public static final TagResult SUCCESS_RESULT = new TagResult(true, true, true, true);
   /**
    * A tag result that indicates the value should not be included in the entry,
    * but all other processing should continue.
    */
-  public static final TagResult OMIT_FROM_ENTRY =
-       new TagResult(false, true, true, true);
-
-
-
-  /**
-   * A tag result in whihc all components have a value of <CODE>false</CODE>.
-   */
-  public static final TagResult STOP_PROCESSING =
-       new TagResult(false, false, false, false);
-
-
+  public static final TagResult OMIT_FROM_ENTRY = new TagResult(false, true, true, true);
+  /** A tag result in which all components have a value of <CODE>false</CODE>. */
+  public static final TagResult STOP_PROCESSING = new TagResult(false, false, false, false);
 
   /** Indicates whether to keep processing the associated line. */
-  private boolean keepProcessingLine;
-
+  private final boolean keepProcessingLine;
   /** Indicates whether to keep processing the associated entry. */
-  private boolean keepProcessingEntry;
-
+  private final boolean keepProcessingEntry;
   /** Indicates whether to keep processing entries below the associated parent. */
-  private boolean keepProcessingParent;
-
+  private final boolean keepProcessingParent;
   /** Indicates whether to keep processing entries for the template file. */
-  private boolean keepProcessingTemplateFile;
-
-
+  private final boolean keepProcessingTemplateFile;
 
   /**
    * Creates a new tag result object with the provided information.
@@ -81,7 +59,7 @@
    *                                     processing entries for the template
    *                                     file.
    */
-  public TagResult(boolean keepProcessingLine, boolean keepProcessingEntry,
+  private TagResult(boolean keepProcessingLine, boolean keepProcessingEntry,
                    boolean keepProcessingParent,
                    boolean keepProcessingTemplateFile)
   {
@@ -91,12 +69,10 @@
     this.keepProcessingTemplateFile = keepProcessingTemplateFile;
   }
 
-
-
   /**
    * Indicates whether to continue processing for the current line.  If this is
    * <CODE>false</CODE>, then the current line will not be included in the
-   * entry.  It will have no impact on whehter the entry itself is included in
+   * entry.  It will have no impact on whether the entry itself is included in
    * the generated LDIF.
    *
    * @return  <CODE>true</CODE> if the line should be included in the entry, or
@@ -107,8 +83,6 @@
     return keepProcessingLine;
   }
 
-
-
   /**
    * Indicates whether to continue processing for the current entry.  If this is
    * <CODE>false</CODE>, then the current entry will not be included in the
@@ -123,8 +97,6 @@
     return keepProcessingEntry;
   }
 
-
-
   /**
    * Indicates whether to continue processing entries below the current parent.
    * If this is <CODE>false</CODE>, then the current entry will not be included,
@@ -138,8 +110,6 @@
     return keepProcessingParent;
   }
 
-
-
   /**
    * Indicates whether to keep processing entries for the template file.  If
    * this is <CODE>false</CODE>, then LDIF processing will end immediately (and
@@ -153,4 +123,3 @@
     return keepProcessingTemplateFile;
   }
 }
-
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/Template.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/Template.java
index 4b37ba4..d9a3f3a 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/Template.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/Template.java
@@ -16,18 +16,17 @@
  */
 package org.opends.server.tools.makeldif;
 
-import org.forgerock.i18n.LocalizableMessage;
+import static org.opends.messages.ToolMessages.*;
+import static org.opends.server.util.StaticUtils.*;
 
 import java.io.IOException;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Map;
 
-import org.forgerock.opendj.ldap.schema.AttributeType;
+import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.opendj.ldap.DN;
-
-import static org.opends.messages.ToolMessages.*;
-import static org.opends.server.util.StaticUtils.*;
+import org.forgerock.opendj.ldap.schema.AttributeType;
 
 /**
  * This class defines a template, which is a pattern that may be used to
@@ -40,58 +39,23 @@
    * The attribute types that are used in the RDN for entries generated using
    * this template.
    */
-  private AttributeType[] rdnAttributes;
-
+  private final AttributeType[] rdnAttributes;
   /** The number of entries to create for each subordinate template. */
-  private int[] numEntriesPerTemplate;
-
+  private final int[] numEntriesPerTemplate;
   /** The name for this template. */
-  private String name;
+  private final String name;
 
   /** The names of the subordinate templates below this template. */
   private String[] subordinateTemplateNames;
-
   /** The subordinate templates below this template. */
   private Template[] subordinateTemplates;
-
   /** The template file that contains this template. */
-  private TemplateFile templateFile;
-
+  private final TemplateFile templateFile;
   /** The set of template lines for this template. */
   private TemplateLine[] templateLines;
 
 
 
-  /**
-   * Creates a new template with the provided information.
-   *
-   * @param  templateFile              The template file that contains this
-   *                                   template.
-   * @param  name                      The name for this template.
-   * @param  rdnAttributes             The set of attribute types that are used
-   *                                   in the RDN for entries generated using
-   *                                   this template.
-   * @param  subordinateTemplateNames  The names of the subordinate templates
-   *                                   below this template.
-   * @param  numEntriesPerTemplate     The number of entries to create below
-   *                                   each subordinate template.
-   */
-  public Template(TemplateFile templateFile, String name,
-                  AttributeType[] rdnAttributes,
-                  String[] subordinateTemplateNames,
-                  int[] numEntriesPerTemplate)
-  {
-    this.templateFile             = templateFile;
-    this.name                     = name;
-    this.rdnAttributes            = rdnAttributes;
-    this.subordinateTemplateNames = subordinateTemplateNames;
-    this.numEntriesPerTemplate    = numEntriesPerTemplate;
-
-    templateLines        = new TemplateLine[0];
-    subordinateTemplates = null;
-  }
-
-
 
   /**
    * Creates a new template with the provided information.
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/TemplateEntry.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/TemplateEntry.java
index cd2c7f5..a030a66 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/TemplateEntry.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/TemplateEntry.java
@@ -44,11 +44,11 @@
 public class TemplateEntry
 {
   /** The branch used to generate this entry (if it is associated with a branch). */
-  private Branch branch;
+  private final Branch branch;
   /** The DN for this template entry, if it is known. */
   private DN dn;
   /** The DN of the parent entry for this template entry, if it is available. */
-  private DN parentDN;
+  private final DN parentDN;
 
   /**
    * The set of attributes associated with this template entry, mapped from the
@@ -57,7 +57,7 @@
   private final LinkedHashMap<AttributeType, ArrayList<TemplateValue>> attributes = new LinkedHashMap<>();
 
   /** The template used to generate this entry (if it is associated with a template). */
-  private Template template;
+  private final Template template;
 
 
   /**
@@ -69,8 +69,9 @@
   public TemplateEntry(Branch branch)
   {
     this.branch = branch;
-
     dn         = branch.getBranchDN();
+    template = null;
+    parentDN = null;
   }
 
 
@@ -84,6 +85,8 @@
    */
   public TemplateEntry(Template template, DN parentDN)
   {
+    this.branch = null;
+    dn = null;
     this.template = template;
     this.parentDN = parentDN;
   }
@@ -158,25 +161,6 @@
     return dn;
   }
 
-
-
-  /**
-   * Indicates whether this entry contains one or more values for the specified
-   * attribute type.
-   *
-   * @param  attributeType  The attribute type for which to make the
-   *                        determination.
-   *
-   * @return  <CODE>true</CODE> if this entry contains one or more values for
-   *          the specified attribute type, or <CODE>false</CODE> if not.
-   */
-  public boolean hasAttribute(AttributeType attributeType)
-  {
-    return attributes.containsKey(attributeType);
-  }
-
-
-
   /**
    * Retrieves the value for the specified attribute, if defined.  If the
    * specified attribute has multiple values, then the first will be returned.
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/TemplateFile.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/TemplateFile.java
index 3ce1f61..cd4b389 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/TemplateFile.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/TemplateFile.java
@@ -16,13 +16,12 @@
  */
 package org.opends.server.tools.makeldif;
 
-import org.forgerock.i18n.LocalizableMessage;
+import static org.opends.messages.ToolMessages.*;
+import static org.opends.server.util.StaticUtils.*;
 
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -32,14 +31,12 @@
 import java.util.Random;
 import java.util.StringTokenizer;
 
-import org.opends.server.core.DirectoryServer;
-import org.forgerock.opendj.ldap.schema.AttributeType;
+import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.schema.AttributeType;
+import org.opends.server.core.DirectoryServer;
 import org.opends.server.types.InitializationException;
 
-import static org.opends.messages.ToolMessages.*;
-import static org.opends.server.util.StaticUtils.*;
-
 /**
  * This class defines a template file, which is a collection of constant
  * definitions, branches, and templates.
@@ -47,16 +44,15 @@
 public class TemplateFile
 {
   /** The name of the file holding the list of first names. */
-  public static final String FIRST_NAME_FILE = "first.names";
+  private static final String FIRST_NAME_FILE = "first.names";
   /** The name of the file holding the list of last names. */
-  public static final String LAST_NAME_FILE = "last.names";
-
+  private static final String LAST_NAME_FILE = "last.names";
 
   /**
    * A map of the contents of various text files used during the parsing
    * process, mapped from absolute path to the array of lines in the file.
    */
-  private final HashMap<String, String[]> fileLines = new HashMap<>();
+  private final Map<String, String[]> fileLines = new HashMap<>();
 
   /** The index of the next first name value that should be used. */
   private int firstNameIndex;
@@ -84,18 +80,15 @@
   private final LinkedHashMap<String, Template> templates = new LinkedHashMap<>();
 
   /** The random number generator for this template file. */
-  private Random random;
+  private final Random random;
 
   /** The next first name that should be used. */
   private String firstName;
   /** The next last name that should be used. */
   private String lastName;
 
-  /**
-   * The resource path to use for filesystem elements that cannot be found
-   * anywhere else.
-   */
-  private String resourcePath;
+  /** The resource path to use for filesystem elements that cannot be found anywhere else. */
+  private final String resourcePath;
   /** The path to the directory containing the template file, if available. */
   private String templatePath;
 
@@ -104,22 +97,6 @@
   /** The set of last names to use when generating the LDIF. */
   private String[] lastNames;
 
-
-
-  /**
-   * Creates a new, empty template file structure.
-   *
-   * @param  resourcePath  The path to the directory that may contain additional
-   *                       resource files needed during the LDIF generation
-   *                       process.
-   */
-  public TemplateFile(String resourcePath)
-  {
-    this(resourcePath, new Random());
-  }
-
-
-
   /**
    * Creates a new, empty template file structure.
    *
@@ -153,8 +130,6 @@
     }
   }
 
-
-
   /**
    * Retrieves the set of tags that have been registered.  They will be in the
    * form of a mapping between the name of the tag (in all lowercase characters)
@@ -167,8 +142,6 @@
     return registeredTags;
   }
 
-
-
   /**
    * Retrieves the tag with the specified name.
    *
@@ -178,69 +151,15 @@
    * @return  The requested tag, or <CODE>null</CODE> if no such tag has been
    *          registered.
    */
-  public Tag getTag(String lowerName)
+  private Tag getTag(String lowerName)
   {
     return registeredTags.get(lowerName);
   }
 
-
-
-  /**
-   * Registers the specified class as a tag that may be used in templates.
-   *
-   * @param  tagClass  The fully-qualified name of the class to register as a
-   *                   tag.
-   *
-   * @throws  MakeLDIFException  If a problem occurs while attempting to
-   *                             register the specified tag.
-   */
-  public void registerTag(String tagClass)
-         throws MakeLDIFException
-  {
-    Class c;
-    try
-    {
-      c = Class.forName(tagClass);
-    }
-    catch (Exception e)
-    {
-      LocalizableMessage message = ERR_MAKELDIF_CANNOT_LOAD_TAG_CLASS.get(tagClass);
-      throw new MakeLDIFException(message, e);
-    }
-
-    Tag t;
-    try
-    {
-      t = (Tag) c.newInstance();
-    }
-    catch (Exception e)
-    {
-      LocalizableMessage message = ERR_MAKELDIF_CANNOT_INSTANTIATE_TAG.get(tagClass);
-      throw new MakeLDIFException(message, e);
-    }
-
-    String lowerName = toLowerCase(t.getName());
-    if (registeredTags.containsKey(lowerName))
-    {
-      LocalizableMessage message =
-          ERR_MAKELDIF_CONFLICTING_TAG_NAME.get(tagClass, t.getName());
-      throw new MakeLDIFException(message);
-    }
-    else
-    {
-      registeredTags.put(lowerName, t);
-    }
-  }
-
-
-
-  /**
-   * Registers the set of tags that will always be available for use in
-   * templates.
-   */
+  /** Registers the set of tags that will always be available for use in templates. */
   private void registerDefaultTags()
   {
-    Class[] defaultTagClasses = new Class[]
+    Class<?>[] defaultTagClasses =
     {
       AttributeValueTag.class,
       DNTag.class,
@@ -261,7 +180,7 @@
       UnderscoreParentDNTag.class
     };
 
-    for (Class c : defaultTagClasses)
+    for (Class<?> c : defaultTagClasses)
     {
       try
       {
@@ -276,8 +195,6 @@
     }
   }
 
-
-
   /**
    * Retrieves the set of constants defined for this template file.
    *
@@ -288,37 +205,6 @@
     return constants;
   }
 
-
-
-  /**
-   * Retrieves the value of the constant with the specified name.
-   *
-   * @param  lowerName  The name of the constant to retrieve, in all lowercase
-   *                    characters.
-   *
-   * @return  The value of the constant with the specified name, or
-   *          <CODE>null</CODE> if there is no such constant.
-   */
-  public String getConstant(String lowerName)
-  {
-    return constants.get(lowerName);
-  }
-
-
-
-  /**
-   * Registers the provided constant for use in the template.
-   *
-   * @param  name   The name for the constant.
-   * @param  value  The value for the constant.
-   */
-  public void registerConstant(String name, String value)
-  {
-    constants.put(toLowerCase(name), value);
-  }
-
-
-
   /**
    * Retrieves the set of branches defined in this template file.
    *
@@ -329,35 +215,6 @@
     return branches;
   }
 
-
-
-  /**
-   * Retrieves the branch registered with the specified DN.
-   *
-   * @param  branchDN  The DN for which to retrieve the corresponding branch.
-   *
-   * @return  The requested branch, or <CODE>null</CODE> if no such branch has
-   *          been registered.
-   */
-  public Branch getBranch(DN branchDN)
-  {
-    return branches.get(branchDN);
-  }
-
-
-
-  /**
-   * Registers the provided branch in this template file.
-   *
-   * @param  branch  The branch to be registered.
-   */
-  public void registerBranch(Branch branch)
-  {
-    branches.put(branch.getBranchDN(), branch);
-  }
-
-
-
   /**
    * Retrieves the set of templates defined in this template file.
    *
@@ -368,36 +225,6 @@
     return templates;
   }
 
-
-
-  /**
-   * Retrieves the template with the specified name.
-   *
-   * @param  lowerName  The name of the template to retrieve, in all lowercase
-   *                    characters.
-   *
-   * @return  The requested template, or <CODE>null</CODE> if there is no such
-   *          template.
-   */
-  public Template getTemplate(String lowerName)
-  {
-    return templates.get(lowerName);
-  }
-
-
-
-  /**
-   * Registers the provided template for use in this template file.
-   *
-   * @param  template  The template to be registered.
-   */
-  public void registerTemplate(Template template)
-  {
-    templates.put(toLowerCase(template.getName()), template);
-  }
-
-
-
   /**
    * Retrieves the random number generator for this template file.
    *
@@ -408,8 +235,6 @@
     return random;
   }
 
-
-
   /**
    * Reads the contents of the first and last name files into the appropriate
    * arrays and sets up the associated index pointers.
@@ -449,8 +274,6 @@
     }
   }
 
-
-
   /**
    * Updates the first and last name indexes to choose new values.  The
    * algorithm used is designed to ensure that the combination of first and last
@@ -463,7 +286,6 @@
     firstName = firstNames[firstNameIndex++];
     lastName  = lastNames[lastNameIndex++];
 
-
     // If we've already exhausted every possible combination, then append an
     // integer to the last name.
     if (nameUniquenessCounter > 1)
@@ -506,8 +328,6 @@
     }
   }
 
-
-
   /**
    * Retrieves the first name value that should be used for the current entry.
    *
@@ -518,8 +338,6 @@
     return firstName;
   }
 
-
-
   /**
    * Retrieves the last name value that should be used for the current entry.
    *
@@ -530,8 +348,6 @@
     return lastName;
   }
 
-
-
   /**
    * Parses the contents of the specified file as a MakeLDIF template file
    * definition.
@@ -561,56 +377,10 @@
     templatePath = f.getParentFile().getAbsolutePath();
 
     List<String> fileLines = readLines(f);
-    String[] lines = new String[fileLines.size()];
-    fileLines.toArray(lines);
+    String[] lines = fileLines.toArray(new String[fileLines.size()]);
     parse(lines, warnings);
   }
 
-
-
-  /**
-   * Parses the data read from the provided input stream as a MakeLDIF template
-   * file definition.
-   *
-   * @param  inputStream  The input stream from which to read the template file
-   *                      data.
-   * @param  warnings     A list into which any warnings identified may be
-   *                      placed.
-   *
-   * @throws  IOException  If a problem occurs while attempting to read data
-   *                       from the provided input stream.
-   *
-   * @throws  InitializationException  If a problem occurs while initializing
-   *                                   any of the MakeLDIF components.
-   *
-   * @throws  MakeLDIFException  If any other problem occurs while parsing the
-   *                             template file.
-   */
-  public void parse(InputStream inputStream, List<LocalizableMessage> warnings)
-         throws IOException, InitializationException, MakeLDIFException
-  {
-    ArrayList<String> fileLines = new ArrayList<>();
-
-    try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)))
-    {
-      while (true)
-      {
-        String line = reader.readLine();
-        if (line == null)
-        {
-          break;
-        }
-        fileLines.add(line);
-      }
-    }
-
-    String[] lines = new String[fileLines.size()];
-    fileLines.toArray(lines);
-    parse(lines, warnings);
-  }
-
-
-
   /**
    * Parses the provided data as a MakeLDIF template file definition.
    *
@@ -652,7 +422,7 @@
         // no conflicts.
         String className = line.substring(8).trim();
 
-        Class tagClass;
+        Class<?> tagClass;
         try
         {
           tagClass = Class.forName(className);
@@ -755,10 +525,7 @@
           LocalizableMessage message = ERR_MAKELDIF_CONFLICTING_BRANCH_DN.get(branchDN, startLineNumber);
           throw new MakeLDIFException(message);
         }
-        else
-        {
-          templateFileBranches.put(branchDN, b);
-        }
+        templateFileBranches.put(branchDN, b);
       }
       else if (lowerLine.startsWith("template: "))
       {
@@ -804,7 +571,6 @@
       }
     }
 
-
     // If we've gotten here, then we're almost done.  We just need to finalize
     // the branch and template definitions and then update the template file
     // variables.
@@ -824,7 +590,6 @@
     templates.putAll(templateFileTemplates);
   }
 
-
   /**
    * Parse a line and replace all constants within [ ] with their
    * values.
@@ -925,7 +690,6 @@
       throw new MakeLDIFException(message);
     }
 
-
     // Create a new branch that will be used for the verification process.
     Branch branch = new Branch(this, branchDN);
 
@@ -995,8 +759,6 @@
     return branch;
   }
 
-
-
   /**
    * Parses the information contained in the provided set of lines as a MakeLDIF
    * template definition.
@@ -1032,7 +794,6 @@
     // The first line must be "template: " followed by the template name.
     String templateName = templateLines[0].substring(10).trim();
 
-
     // The next line may start with either "extends: ", "rdnAttr: ", or
     // "subordinateTemplate: ".  Keep reading until we find something that's
     // not one of those.
@@ -1165,20 +926,12 @@
         // It's a comment, so we should ignore it.
         continue;
       }
-      else
-      {
-        TemplateLine templateLine = parseTemplateLine(line, lowerLine,
-                                                      lineNumber, null,
-                                                      template, tags, warnings);
-        template.addTemplateLine(templateLine);
-      }
+      template.addTemplateLine(parseTemplateLine(line, lowerLine, lineNumber, null, template, tags, warnings));
     }
 
     return template;
   }
 
-
-
   /**
    * Parses the provided line as a template line.  Note that exactly one of the
    * branch or template arguments must be non-null and the other must be null.
@@ -1286,7 +1039,6 @@
       }
     }
 
-
     // Define constants that specify what we're currently parsing.
     final int PARSING_STATIC_TEXT     = 0;
     final int PARSING_REPLACEMENT_TAG = 1;
@@ -1413,8 +1165,6 @@
         valueIsBase64);
   }
 
-
-
   /**
    * Parses the provided string as a replacement tag.  Exactly one of the branch
    * or template must be null, and the other must be non-null.
@@ -1469,7 +1219,6 @@
     String[] args = new String[argList.size()];
     argList.toArray(args);
 
-
     Tag newTag;
     try
     {
@@ -1480,30 +1229,22 @@
       throw new MakeLDIFException(ERR_MAKELDIF_CANNOT_INSTANTIATE_NEW_TAG.get(tagName, lineNumber, e), e);
     }
 
-
     if (branch == null)
     {
       newTag.initializeForTemplate(this, template, args, lineNumber, warnings);
     }
+    else if (newTag.allowedInBranch())
+    {
+      newTag.initializeForBranch(this, branch, args, lineNumber, warnings);
+    }
     else
     {
-      if (newTag.allowedInBranch())
-      {
-        newTag.initializeForBranch(this, branch, args, lineNumber, warnings);
-      }
-      else
-      {
-        LocalizableMessage message = ERR_MAKELDIF_TAG_NOT_ALLOWED_IN_BRANCH.get(
-            newTag.getName(), lineNumber);
-        throw new MakeLDIFException(message);
-      }
+      throw new MakeLDIFException(ERR_MAKELDIF_TAG_NOT_ALLOWED_IN_BRANCH.get(newTag.getName(), lineNumber));
     }
 
     return newTag;
   }
 
-
-
   /**
    * Parses the provided string as an attribute tag.  Exactly one of the branch
    * or template must be null, and the other must be non-null.
@@ -1543,20 +1284,18 @@
     argList.toArray(args);
 
     AttributeValueTag tag = new AttributeValueTag();
-    if (branch == null)
+    if (branch != null)
     {
-      tag.initializeForTemplate(this, template, args, lineNumber, warnings);
+      tag.initializeForBranch(this, branch, args, lineNumber, warnings);
     }
     else
     {
-      tag.initializeForBranch(this, branch, args, lineNumber, warnings);
+      tag.initializeForTemplate(this, template, args, lineNumber, warnings);
     }
 
     return tag;
   }
 
-
-
   /**
    * Retrieves a File object based on the provided path.  If the given path is
    * absolute, then that absolute path will be used.  If it is relative, then it
@@ -1580,7 +1319,6 @@
       return f;
     }
 
-
     // If the provided path was absolute, then use it anyway, even though we
     // couldn't find the file.
     if (f.isAbsolute())
@@ -1588,7 +1326,6 @@
       return f;
     }
 
-
     // Try a path relative to the resource directory.
     String newPath = resourcePath + File.separator + path;
     f = new File(newPath);
@@ -1597,7 +1334,6 @@
       return f;
     }
 
-
     // Try a path relative to the template directory, if it's available.
     if (templatePath != null)
     {
@@ -1612,8 +1348,6 @@
     return null;
   }
 
-
-
   /**
    * Retrieves the lines of the specified file as a string array.  If the result
    * is already cached, then it will be used.  If the result is not cached, then
@@ -1643,8 +1377,6 @@
     return lines;
   }
 
-
-
   /**
    * Generates the LDIF content and writes it to the provided LDIF writer.
    *
@@ -1673,4 +1405,3 @@
     return TagResult.SUCCESS_RESULT;
   }
 }
-
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/status/StatusCli.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/status/StatusCli.java
index 9a62d3d..2dc0f76 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/status/StatusCli.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/status/StatusCli.java
@@ -18,15 +18,16 @@
 
 import static com.forgerock.opendj.cli.ArgumentConstants.*;
 import static com.forgerock.opendj.cli.Utils.*;
+
 import static org.forgerock.opendj.ldap.LDAPConnectionFactory.*;
 import static org.forgerock.util.Utils.*;
-import static org.opends.messages.ToolMessages.*;
 import static org.opends.messages.AdminToolMessages.*;
 import static org.opends.messages.QuickSetupMessages.INFO_ERROR_READING_SERVER_CONFIGURATION;
 import static org.opends.messages.QuickSetupMessages.INFO_NOT_AVAILABLE_LABEL;
+import static org.opends.messages.ToolMessages.*;
 
 import java.io.File;
-import java.io.InputStream;
+import java.io.IOException;
 import java.io.OutputStream;
 import java.io.PrintStream;
 import java.net.URI;
@@ -106,9 +107,9 @@
   private boolean displayMustStartLegend;
 
   /** Prefix for log files. */
-  public static final String LOG_FILE_PREFIX = "opendj-status-";
+  private static final String LOG_FILE_PREFIX = "opendj-status-";
   /** Suffix for log files. */
-  public static final String LOG_FILE_SUFFIX = ".log";
+  private static final String LOG_FILE_SUFFIX = ".log";
 
   private ApplicationTrustManager interactiveTrustManager;
   private boolean useInteractiveTrustManager;
@@ -123,10 +124,8 @@
    *          The print stream to use for standard output.
    * @param err
    *          The print stream to use for standard error.
-   * @param in
-   *          The input stream to use for standard input.
    */
-  public StatusCli(PrintStream out, PrintStream err, InputStream in)
+  private StatusCli(PrintStream out, PrintStream err)
   {
     super(out, err);
   }
@@ -138,7 +137,7 @@
    */
   public static void main(String[] args)
   {
-    int retCode = mainCLI(args, true, System.out, System.err, System.in);
+    int retCode = mainCLI(args, System.out, System.err);
     if(retCode != 0)
     {
       System.exit(retCode);
@@ -146,39 +145,20 @@
   }
 
   /**
-   * Parses the provided command-line arguments and uses that information to
-   * run the status tool.
-   *
-   * @param args the command-line arguments provided to this program.
-   *
-   * @return The return code.
-   */
-
-  public static int mainCLI(String[] args)
-  {
-    return mainCLI(args, true, System.out, System.err, System.in);
-  }
-
-  /**
    * Parses the provided command-line arguments and uses that information to run
    * the status tool.
    *
    * @param args
    *          The command-line arguments provided to this program.
-   * @param initializeServer
-   *          Indicates whether to initialize the server.
    * @param outStream
    *          The output stream to use for standard output, or {@code null}
    *          if standard output is not needed.
    * @param errStream
    *          The output stream to use for standard error, or {@code null}
    *          if standard error is not needed.
-   * @param inStream
-   *          The input stream to use for standard input.
    * @return The return code.
    */
-  public static int mainCLI(String[] args, boolean initializeServer,
-      OutputStream outStream, OutputStream errStream, InputStream inStream)
+  public static int mainCLI(String[] args, OutputStream outStream, OutputStream errStream)
   {
     PrintStream out = NullOutputStream.wrapOrNullStream(outStream);
     PrintStream err = NullOutputStream.wrapOrNullStream(errStream);
@@ -192,7 +172,7 @@
       t.printStackTrace();
     }
 
-    final StatusCli statusCli = new StatusCli(out, err, inStream);
+    final StatusCli statusCli = new StatusCli(out, err);
     int retCode = statusCli.execute(args);
     if (retCode == 0)
     {
@@ -209,7 +189,7 @@
    *          The command-line arguments provided to this program.
    * @return The return code of the process.
    */
-  public int execute(String[] args) {
+  private int execute(String[] args) {
     argParser = new StatusCliArgumentParser(StatusCli.class.getName());
     try {
       argParser.initializeGlobalArguments(getOutputStream());
@@ -261,8 +241,6 @@
       String bindDn = null;
       String bindPwd = null;
 
-      ManagementContext mContext = null;
-
       // This is done because we do not need to ask the user about these
       // parameters. We force their presence in the
       // LDAPConnectionConsoleInteraction, this done, it will not prompt
@@ -301,6 +279,8 @@
         argParser.displayMessageAndUsageReference(getErrStream(), e.getMessageObject());
         return ReturnCode.CLIENT_SIDE_PARAM_ERROR.get();
       }
+
+      boolean managementContextOpened = false;
       try
       {
         if (argParser.isInteractive())
@@ -315,19 +295,24 @@
         }
         if (bindPwd != null && !bindPwd.isEmpty())
         {
-          mContext = getManagementContextFromConnection(ci);
-          interactiveTrustManager = ci.getTrustManager();
-          controlInfo.setTrustManager(interactiveTrustManager);
-          useInteractiveTrustManager = true;
+          try (ManagementContext mContext = getManagementContextFromConnection(ci))
+          {
+            managementContextOpened = true;
+            interactiveTrustManager = ci.getTrustManager();
+            controlInfo.setTrustManager(interactiveTrustManager);
+            useInteractiveTrustManager = true;
+          }
+          catch (IOException e)
+          {
+            logger.traceException(e);
+          }
         }
       } catch (ClientException e) {
         println(e.getMessageObject());
         return ReturnCode.CLIENT_SIDE_PARAM_ERROR.get();
-      } finally {
-        closeSilently(mContext);
       }
 
-      if (mContext != null)
+      if (managementContextOpened)
       {
         try (ConnectionWrapper conn = Utilities.getAdminDirContext(controlInfo, bindDn, bindPwd))
         {
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/tasks/TaskClient.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/tasks/TaskClient.java
index c41a177..2a8a0c2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/tasks/TaskClient.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/tasks/TaskClient.java
@@ -12,7 +12,7 @@
  * information: "Portions Copyright [year] [name of copyright owner]".
  *
  * Copyright 2009-2010 Sun Microsystems, Inc.
- * Portions Copyright 2014-2015 ForgeRock AS.
+ * Portions Copyright 2014-2016 ForgeRock AS.
  */
 package org.opends.server.tools.tasks;
 
@@ -70,14 +70,9 @@
  */
 public class TaskClient {
 
-  /**
-   * Connection through which task scheduling will take place.
-   */
-  protected LDAPConnection connection;
-
-  /**
-   * Keeps track of message IDs.
-   */
+  /** Connection through which task scheduling will take place. */
+  private LDAPConnection connection;
+  /** Keeps track of message IDs. */
   private final AtomicInteger nextMessageID = new AtomicInteger(0);
 
   /**
@@ -95,20 +90,12 @@
    */
   public static String getTaskID(List<RawAttribute> taskAttributes)
   {
-    String taskID = null;
-
-    RawAttribute recurringIDAttr = getAttribute(ATTR_RECURRING_TASK_ID,
-        taskAttributes);
-
+    RawAttribute recurringIDAttr = getAttribute(ATTR_RECURRING_TASK_ID, taskAttributes);
     if (recurringIDAttr != null) {
-      taskID = recurringIDAttr.getValues().get(0).toString();
-    } else {
-      RawAttribute taskIDAttr = getAttribute(ATTR_TASK_ID,
-          taskAttributes);
-      taskID = taskIDAttr.getValues().get(0).toString();
+      return recurringIDAttr.getValues().get(0).toString();
     }
-
-    return taskID;
+    RawAttribute taskIDAttr = getAttribute(ATTR_TASK_ID, taskAttributes);
+    return taskIDAttr.getValues().get(0).toString();
   }
 
   private static RawAttribute getAttribute(String attrName,
@@ -323,17 +310,17 @@
         throw new LDAPException(
                 LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
                 ERR_TASK_CLIENT_UNEXPECTED_CONNECTION_CLOSURE.get());
-      } else {
-        opType = responseMessage.getProtocolOpType();
-        if (opType == LDAPConstants.OP_TYPE_SEARCH_RESULT_ENTRY) {
-          SearchResultEntryProtocolOp searchEntryOp =
-                  responseMessage.getSearchResultEntryProtocolOp();
-          SearchResultEntry entry = searchEntryOp.toSearchResultEntry();
-          entries.add(entry);
-        }
+      }
+      opType = responseMessage.getProtocolOpType();
+      if (opType == LDAPConstants.OP_TYPE_SEARCH_RESULT_ENTRY)
+      {
+        SearchResultEntryProtocolOp searchEntryOp = responseMessage.getSearchResultEntryProtocolOp();
+        SearchResultEntry entry = searchEntryOp.toSearchResultEntry();
+        entries.add(entry);
       }
     }
     while (opType != LDAPConstants.OP_TYPE_SEARCH_RESULT_DONE);
+
     List<TaskEntry> taskEntries = new ArrayList<>(entries.size());
     for (Entry entry : entries) {
       taskEntries.add(new TaskEntry(entry));
@@ -374,13 +361,12 @@
       if (responseMessage == null) {
         LocalizableMessage message = ERR_TASK_CLIENT_UNEXPECTED_CONNECTION_CLOSURE.get();
         throw new LDAPException(UNAVAILABLE.intValue(), message);
-      } else {
-        opType = responseMessage.getProtocolOpType();
-        if (opType == LDAPConstants.OP_TYPE_SEARCH_RESULT_ENTRY) {
-          SearchResultEntryProtocolOp searchEntryOp =
-                  responseMessage.getSearchResultEntryProtocolOp();
-          entry = searchEntryOp.toSearchResultEntry();
-        }
+      }
+      opType = responseMessage.getProtocolOpType();
+      if (opType == LDAPConstants.OP_TYPE_SEARCH_RESULT_ENTRY)
+      {
+        SearchResultEntryProtocolOp searchEntryOp = responseMessage.getSearchResultEntryProtocolOp();
+        entry = searchEntryOp.toSearchResultEntry();
       }
     }
     while (opType != LDAPConstants.OP_TYPE_SEARCH_RESULT_DONE);
@@ -390,7 +376,6 @@
     return new TaskEntry(entry);
   }
 
-
   /**
    * Changes that the state of the task in the backend to a canceled state.
    *
@@ -409,98 +394,95 @@
 
     TaskEntry entry = getTaskEntry(id);
     TaskState state = entry.getTaskState();
-    if (state != null) {
-      if (!TaskState.isDone(state)) {
-
-        ByteString dn = ByteString.valueOfUtf8(entry.getDN().toString());
-
-        ArrayList<RawModification> mods = new ArrayList<>();
-
-        String newState;
-        if (TaskState.isPending(state)) {
-          newState = TaskState.CANCELED_BEFORE_STARTING.name();
-        } else {
-          newState = TaskState.STOPPED_BY_ADMINISTRATOR.name();
-        }
-        LDAPAttribute attr = new LDAPAttribute(ATTR_TASK_STATE, newState);
-        mods.add(new LDAPModification(ModificationType.REPLACE, attr));
-
-        ModifyRequestProtocolOp modRequest =
-                new ModifyRequestProtocolOp(dn, mods);
-        LDAPMessage requestMessage =
-             new LDAPMessage(nextMessageID.getAndIncrement(), modRequest, null);
-
-        writer.writeMessage(requestMessage);
-
-        LDAPMessage responseMessage = reader.readMessage();
-
-        if (responseMessage == null) {
-          LocalizableMessage message = ERR_TASK_CLIENT_UNEXPECTED_CONNECTION_CLOSURE.get();
-          throw new LDAPException(UNAVAILABLE.intValue(), message);
-        }
-
-        if (responseMessage.getProtocolOpType() !=
-                LDAPConstants.OP_TYPE_MODIFY_RESPONSE)
-        {
-          throw new LDAPException(
-                  LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR,
-                  ERR_TASK_CLIENT_INVALID_RESPONSE_TYPE.get(
-                    responseMessage.getProtocolOpName()));
-        }
-
-        ModifyResponseProtocolOp modResponse =
-                responseMessage.getModifyResponseProtocolOp();
-        LocalizableMessage errorMessage = modResponse.getErrorMessage();
-        if (errorMessage != null) {
-          throw new LDAPException(
-                  LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR,
-                  errorMessage);
-        }
-      } else if (TaskState.isRecurring(state)) {
-
-        ByteString dn = ByteString.valueOfUtf8(entry.getDN().toString());
-        DeleteRequestProtocolOp deleteRequest =
-          new DeleteRequestProtocolOp(dn);
-
-        LDAPMessage requestMessage = new LDAPMessage(
-          nextMessageID.getAndIncrement(), deleteRequest, null);
-
-        writer.writeMessage(requestMessage);
-
-        LDAPMessage responseMessage = reader.readMessage();
-
-        if (responseMessage == null) {
-          LocalizableMessage message = ERR_TASK_CLIENT_UNEXPECTED_CONNECTION_CLOSURE.get();
-          throw new LDAPException(UNAVAILABLE.intValue(), message);
-        }
-
-        if (responseMessage.getProtocolOpType() !=
-                LDAPConstants.OP_TYPE_DELETE_RESPONSE)
-        {
-          throw new LDAPException(
-                  LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR,
-                  ERR_TASK_CLIENT_INVALID_RESPONSE_TYPE.get(
-                    responseMessage.getProtocolOpName()));
-        }
-
-        DeleteResponseProtocolOp deleteResponse =
-                responseMessage.getDeleteResponseProtocolOp();
-        LocalizableMessage errorMessage = deleteResponse.getErrorMessage();
-        if (errorMessage != null) {
-          throw new LDAPException(
-                  LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR,
-                  errorMessage);
-        }
-      } else {
-        throw new TaskClientException(
-                ERR_TASK_CLIENT_UNCANCELABLE_TASK.get(id));
-      }
-    } else {
-      throw new TaskClientException(
-              ERR_TASK_CLIENT_TASK_STATE_UNKNOWN.get(id));
+    if (state == null)
+    {
+      throw new TaskClientException(ERR_TASK_CLIENT_TASK_STATE_UNKNOWN.get(id));
+    }
+    if (!TaskState.isDone(state))
+    {
+      cancelNotDoneTask(entry, state, writer, reader);
+    }
+    else if (TaskState.isRecurring(state))
+    {
+      cancelRecurringTask(entry, writer, reader);
+    }
+    else
+    {
+      throw new TaskClientException(ERR_TASK_CLIENT_UNCANCELABLE_TASK.get(id));
     }
   }
 
+  private void cancelNotDoneTask(TaskEntry entry, TaskState state, LDAPWriter writer, LDAPReader reader)
+      throws IOException, LDAPException
+  {
+    ByteString dn = ByteString.valueOfUtf8(entry.getDN().toString());
+
+    ArrayList<RawModification> mods = new ArrayList<>();
+
+    String newState;
+    if (TaskState.isPending(state))
+    {
+      newState = TaskState.CANCELED_BEFORE_STARTING.name();
+    }
+    else
+    {
+      newState = TaskState.STOPPED_BY_ADMINISTRATOR.name();
+    }
+    LDAPAttribute attr = new LDAPAttribute(ATTR_TASK_STATE, newState);
+    mods.add(new LDAPModification(ModificationType.REPLACE, attr));
+
+    ModifyRequestProtocolOp modRequest = new ModifyRequestProtocolOp(dn, mods);
+    LDAPMessage requestMessage = new LDAPMessage(nextMessageID.getAndIncrement(), modRequest, null);
+
+    writer.writeMessage(requestMessage);
+
+    LDAPMessage responseMessage = reader.readMessage();
+    if (responseMessage == null)
+    {
+      LocalizableMessage message = ERR_TASK_CLIENT_UNEXPECTED_CONNECTION_CLOSURE.get();
+      throw new LDAPException(UNAVAILABLE.intValue(), message);
+    }
+    if (responseMessage.getProtocolOpType() != LDAPConstants.OP_TYPE_MODIFY_RESPONSE)
+    {
+      throw new LDAPException(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, ERR_TASK_CLIENT_INVALID_RESPONSE_TYPE
+          .get(responseMessage.getProtocolOpName()));
+    }
+
+    ModifyResponseProtocolOp modResponse = responseMessage.getModifyResponseProtocolOp();
+    LocalizableMessage errorMessage = modResponse.getErrorMessage();
+    if (errorMessage != null)
+    {
+      throw new LDAPException(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, errorMessage);
+    }
+  }
+
+  private void cancelRecurringTask(TaskEntry entry, LDAPWriter writer, LDAPReader reader)
+      throws IOException, LDAPException
+  {
+    ByteString dn = ByteString.valueOfUtf8(entry.getDN().toString());
+    DeleteRequestProtocolOp deleteRequest = new DeleteRequestProtocolOp(dn);
+    LDAPMessage requestMessage = new LDAPMessage(nextMessageID.getAndIncrement(), deleteRequest, null);
+    writer.writeMessage(requestMessage);
+
+    LDAPMessage responseMessage = reader.readMessage();
+    if (responseMessage == null)
+    {
+      LocalizableMessage message = ERR_TASK_CLIENT_UNEXPECTED_CONNECTION_CLOSURE.get();
+      throw new LDAPException(UNAVAILABLE.intValue(), message);
+    }
+    if (responseMessage.getProtocolOpType() != LDAPConstants.OP_TYPE_DELETE_RESPONSE)
+    {
+      LocalizableMessage msg = ERR_TASK_CLIENT_INVALID_RESPONSE_TYPE.get(responseMessage.getProtocolOpName());
+      throw new LDAPException(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, msg);
+    }
+
+    DeleteResponseProtocolOp deleteResponse = responseMessage.getDeleteResponseProtocolOp();
+    LocalizableMessage errorMessage = deleteResponse.getErrorMessage();
+    if (errorMessage != null)
+    {
+      throw new LDAPException(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, errorMessage);
+    }
+  }
 
   /**
    * Writes a search to the directory writer.
@@ -518,5 +500,4 @@
     // Send the request to the server and read the response.
     writer.writeMessage(requestMessage);
   }
-
 }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/FileManager.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/FileManager.java
index 4ff1300..9f5f6ba 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/FileManager.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/FileManager.java
@@ -40,7 +40,7 @@
 class FileManager
 {
   /** Describes the approach taken to deleting a file or directory. */
-  public static enum DeletionPolicy
+  private static enum DeletionPolicy
   {
     /** Delete the file or directory immediately. */
     DELETE_IMMEDIATELY,
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/LicenseFile.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/LicenseFile.java
index fdede85..1cd2940 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/LicenseFile.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/LicenseFile.java
@@ -12,7 +12,7 @@
  * information: "Portions Copyright [year] [name of copyright owner]".
  *
  * Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions Copyright 2013-2015 ForgeRock AS.
+ * Portions Copyright 2013-2016 ForgeRock AS.
  */
 
 package org.opends.server.tools.upgrade;
@@ -174,7 +174,7 @@
    * @return <CODE>true</CODE> if the license has been accepted by the user
    *         <CODE>false</CODE> otherwise.
    */
-  static boolean getApproval()
+  private static boolean getApproval()
   {
     return approved;
   }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeContext.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeContext.java
index 7dbe8f5..c0706a0 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeContext.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeContext.java
@@ -78,7 +78,7 @@
    *          The call-back handler for interacting with the upgrade
    *          application.
    */
-  public UpgradeContext(final BuildVersion fromVersion,
+  private UpgradeContext(final BuildVersion fromVersion,
       final BuildVersion toVersion, CallbackHandler handler)
   {
     this.fromVersion = fromVersion;
@@ -153,16 +153,6 @@
   }
 
   /**
-   * Returns the callback handler.
-   *
-   * @return The actual callback handler.
-   */
-  CallbackHandler getHandler()
-  {
-    return handler;
-  }
-
-  /**
    * Returns the status of the interactive mode.
    *
    * @return {@code true} if interactive mode is activated.
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeTasks.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeTasks.java
index c00e92d..3cd36b9 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeTasks.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeTasks.java
@@ -74,13 +74,12 @@
   static int countErrors;
 
   /** Contains all the indexes to rebuild. */
-  static Set<String> indexesToRebuild = new HashSet<>();
+  private static final Set<String> indexesToRebuild = new HashSet<>();
 
   /** A flag to avoid rebuild single indexes if 'rebuild all' is selected. */
-  static boolean isRebuildAllIndexesIsPresent;
-
+  private static boolean isRebuildAllIndexesIsPresent;
   /** A flag for marking 'rebuild all' task accepted by user. */
-  static boolean isRebuildAllIndexesTaskAccepted;
+  private static boolean isRebuildAllIndexesTaskAccepted;
 
   private static final List<String> SUPPORTED_LOCALES_FOR_3_0_0 = Arrays.asList(
       "ca_ES", "de", "es", "fr", "ja", "ko", "pl", "zh_CN", "zh_TW");
@@ -1102,14 +1101,14 @@
   }
 
   /** This inner classes causes JE to be lazily linked and prevents runtime errors if JE is not in the classpath. */
-  static final class JEHelper {
+  private static final class JEHelper {
     private static ClientException clientException(final File backendDirectory, final DatabaseException e) {
       logger.error(LocalizableMessage.raw(StaticUtils.stackTraceToString(e)));
       return new ClientException(ReturnCode.CONSTRAINT_VIOLATION,
                                  INFO_UPGRADE_TASK_MIGRATE_JE_ENV_UNREADABLE.get(backendDirectory), e);
     }
 
-    static Set<String> listDatabases(final File backendDirectory) throws ClientException {
+    private static Set<String> listDatabases(final File backendDirectory) throws ClientException {
       try (Environment je = new Environment(backendDirectory, null)) {
         Set<String> databases = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
         databases.addAll(je.getDatabaseNames());
@@ -1119,7 +1118,8 @@
       }
     }
 
-    static void migrateDatabases(final File envDir, final Map<String, String> renamedDbs) throws ClientException {
+    private static void migrateDatabases(final File envDir, final Map<String, String> renamedDbs)
+          throws ClientException {
       EnvironmentConfig config = new EnvironmentConfig().setTransactional(true);
       try (Environment je = new Environment(envDir, config)) {
         final Transaction txn = je.beginTransaction(null, new TransactionConfig());
@@ -1366,7 +1366,6 @@
         }
       }
     };
-
   }
 
   /** Prevent instantiation. */
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeUtils.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeUtils.java
index 92e6c0d..2d34d8e 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeUtils.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeUtils.java
@@ -69,12 +69,9 @@
 import static org.opends.server.tools.upgrade.Installation.*;
 import static org.opends.server.util.ChangeOperationType.*;
 
-/**
- * Common utility methods needed by the upgrade.
- */
+/** Common utility methods needed by the upgrade. */
 final class UpgradeUtils
 {
-
   private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
 
   /** The config folder of the current instance. */
@@ -82,7 +79,7 @@
   /** The config/schema folder of the current instance. */
   static final File configSchemaDirectory = new File(configDirectory, SCHEMA_PATH_RELATIVE);
   /** The template folder of the current installation. */
-  static final File templateDirectory = new File(getInstallationPath(), TEMPLATE_RELATIVE_PATH);
+  private static final File templateDirectory = new File(getInstallationPath(), TEMPLATE_RELATIVE_PATH);
   /** The template/config folder of the current installation. */
   static final File templateConfigDirectory = new File(templateDirectory, CONFIG_PATH_RELATIVE);
   /** The template/config/schema folder of the current installation. */
@@ -96,7 +93,7 @@
   static final File binDirectory = new File(getInstallationPath(), UNIX_BINARIES_PATH_RELATIVE);
   /** The bat folder of the current installation. */
   static final File batDirectory = new File(getInstallationPath(), WINDOWS_BINARIES_PATH_RELATIVE);
-  /** The server configuration file path */
+  /** The server configuration file path. */
   static final String CONFIG_FILE_PATH =
       Paths.get(configDirectory.getAbsolutePath(), CURRENT_CONFIG_FILE_NAME).toString();
 
@@ -106,7 +103,7 @@
    *
    * @return the path of the installation of the directory server.
    */
-  static String getInstallPathFromClasspath()
+  private static String getInstallPathFromClasspath()
   {
     String installPath = DirectoryServer.getServerRoot();
     if (installPath != null)
@@ -226,20 +223,6 @@
     }
   }
 
-  /**
-   * Returns the absolute path for the given parentPath and relativePath.
-   *
-   * @param parentPath
-   *          the parent path.
-   * @param relativePath
-   *          the relative path.
-   * @return the absolute path for the given parentPath and relativePath.
-   */
-  static String getPath(final String parentPath, final String relativePath)
-  {
-    return getPath(new File(new File(parentPath), relativePath));
-  }
-
   static File getFileForPath(String path)
   {
     final File f = new File(path);
@@ -247,53 +230,6 @@
   }
 
   /**
-   * Determines whether one file is the parent of another.
-   *
-   * @param ancestor
-   *          possible parent of <code>descendant</code>
-   * @param descendant
-   *          possible child 0f <code>ancestor</code>
-   * @return return true if ancestor is a parent of descendant
-   */
-  static boolean isParentOf(final File ancestor, File descendant)
-  {
-    if (ancestor != null)
-    {
-      if (ancestor.equals(descendant))
-      {
-        return false;
-      }
-      while (descendant != null && !ancestor.equals(descendant))
-      {
-        descendant = descendant.getParentFile();
-      }
-    }
-    return ancestor != null && descendant != null;
-  }
-
-  /**
-   * Returns <CODE>true</CODE> if the first provided path is under the second
-   * path in the file system.
-   * @param descendant the descendant candidate path.
-   * @param path the path.
-   * @return <CODE>true</CODE> if the first provided path is under the second
-   * path in the file system; <code>false</code> otherwise or if
-   * either of the files are null
-   */
-  static boolean isDescendant(File descendant, File path) {
-    if (descendant != null && path != null) {
-      File parent = descendant.getParentFile();
-      while (parent != null) {
-        if (path.equals(parent)) {
-          return true;
-        }
-        parent = parent.getParentFile();
-      }
-    }
-    return false;
-  }
-
-  /**
    * Returns the instance root directory (the path where the instance is
    * installed).
    *
@@ -763,7 +699,8 @@
    *
    * @return A schema which may used in the upgrade context.
    */
-  static Schema getUpgradeSchema() {
+  private static Schema getUpgradeSchema()
+  {
     final SchemaBuilder sb = new SchemaBuilder(Schema.getCoreSchema())
         .setOption(DEFAULT_MATCHING_RULE_OID, getCaseExactMatchingRule().getOID())
         .setOption(DEFAULT_SYNTAX_OID, getDirectoryStringSyntax().getOID());
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/AuthenticationInfo.java b/opendj-server-legacy/src/main/java/org/opends/server/types/AuthenticationInfo.java
index b25d829..a295b18 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/AuthenticationInfo.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/AuthenticationInfo.java
@@ -35,13 +35,10 @@
      mayInvoke=true)
 public final class AuthenticationInfo
 {
-
   /** Indicates whether this connection is currently authenticated. */
   private boolean isAuthenticated;
-
   /** Indicates whether this connection is authenticated as a root user. */
   private boolean isRoot;
-
   /**
    * Indicates whether the user's password must be changed before any other
    * operation will be allowed.
@@ -50,26 +47,16 @@
 
   /** The entry of the user that is currently authenticated. */
   private Entry authenticationEntry;
-
-  /**
-   * The entry of the user that will be used as the default authorization
-   * identity.
-   */
+  /** The entry of the user that will be used as the default authorization identity. */
   private Entry authorizationEntry;
-
   /** The type of authentication performed on this connection. */
   private AuthenticationType authenticationType;
-
   /** The SASL mechanism used to authenticate. */
   private String saslMechanism;
-
   /** The bind DN used to authenticate using simple authentication. */
-  private DN simpleBindDN;
+  private final DN simpleBindDN;
 
-  /**
-   * Creates a new set of authentication information to be used for
-   * unauthenticated clients.
-   */
+  /** Creates a new set of authentication information to be used for unauthenticated clients. */
   public AuthenticationInfo()
   {
     isAuthenticated     = false;
@@ -82,8 +69,6 @@
     saslMechanism       = null;
   }
 
-
-
   /**
    * Creates a new set of authentication information to be used for
    * clients that are authenticated internally.
@@ -135,8 +120,6 @@
     this.authenticationType  = AuthenticationType.SIMPLE;
   }
 
-
-
   /**
    * Creates a new set of authentication information to be used for
    * clients that have authenticated using a SASL mechanism.
@@ -168,8 +151,6 @@
     this.saslMechanism      = saslMechanism;
   }
 
-
-
   /**
    * Creates a new set of authentication information to be used for
    * clients that have authenticated using a SASL mechanism.
@@ -212,8 +193,6 @@
     this.saslMechanism      = saslMechanism;
   }
 
-
-
   /**
    * Indicates whether this client has successfully authenticated to
    * the server.
@@ -226,8 +205,6 @@
     return isAuthenticated;
   }
 
-
-
   /**
    * Indicates whether this client should be considered a root user.
    *
@@ -239,8 +216,6 @@
     return isRoot;
   }
 
-
-
   /**
    * Indicates whether the authenticated user must change his/her
    * password before any other operation will be allowed.
@@ -254,8 +229,6 @@
     return mustChangePassword;
   }
 
-
-
   /**
    * Specifies whether the authenticated user must change his/her
    * password before any other operation will be allowed.
@@ -270,8 +243,6 @@
     this.mustChangePassword = mustChangePassword;
   }
 
-
-
   /**
    * Indicates whether this client has authenticated using the
    * specified authentication type.
@@ -288,8 +259,6 @@
     return this.authenticationType == authenticationType;
   }
 
-
-
   /**
    * Retrieves the entry for the user as whom the client is
    * authenticated.
@@ -303,8 +272,6 @@
     return authenticationEntry;
   }
 
-
-
   /**
    * Retrieves the DN of the user as whom the client is authenticated.
    *
@@ -320,8 +287,6 @@
     return null;
   }
 
-
-
   /**
    * Sets the DN of the user as whom the client is authenticated,
    * does nothing if the client is unauthenticated.
@@ -336,8 +301,6 @@
     }
   }
 
-
-
   /**
    * Retrieves the entry for the user that should be used as the
    * default authorization identity.
@@ -352,8 +315,6 @@
     return authorizationEntry;
   }
 
-
-
   /**
    * Retrieves the DN for the user that should be used as the default
    * authorization identity.
@@ -372,8 +333,6 @@
     return null;
   }
 
-
-
   /**
    * Sets the DN for the user that should be used as the default
    * authorization identity, does nothing if the client is
@@ -389,8 +348,6 @@
     }
   }
 
-
-
   /**
    * Retrieves the bind DN that the client used for simple
    * authentication.
@@ -404,8 +361,6 @@
     return simpleBindDN;
   }
 
-
-
   /**
    * Indicates whether the client is currently authenticated using the
    * specified SASL mechanism.
@@ -438,8 +393,6 @@
     return buffer.toString();
   }
 
-
-
   /**
    * Appends a string representation of this authentication info
    * structure to the provided buffer.
@@ -447,7 +400,7 @@
    * @param  buffer  The buffer to which the information is to be
    *                 appended.
    */
-  public void toString(StringBuilder buffer)
+  private void toString(StringBuilder buffer)
   {
     buffer.append("AuthenticationInfo(isAuthenticated=");
     buffer.append(isAuthenticated);
@@ -488,8 +441,6 @@
     buffer.append(")");
   }
 
-
-
   /**
    * Creates a duplicate of this {@code AuthenticationInfo} object
    * with the new authentication and authorization entries.
@@ -522,4 +473,3 @@
     return authInfo;
   }
 }
-
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/BackupDirectory.java b/opendj-server-legacy/src/main/java/org/opends/server/types/BackupDirectory.java
index acf5486..5c505e3 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/BackupDirectory.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/BackupDirectory.java
@@ -16,9 +16,6 @@
  */
 package org.opends.server.types;
 
-import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.i18n.LocalizedIllegalArgumentException;
-
 import java.io.BufferedReader;
 import java.io.BufferedWriter;
 import java.io.File;
@@ -30,9 +27,11 @@
 import java.util.List;
 import java.util.Map;
 
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.i18n.LocalizedIllegalArgumentException;
+import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.forgerock.opendj.ldap.DN;
-import org.forgerock.i18n.slf4j.LocalizedLogger;
 
 import static org.opends.messages.CoreMessages.*;
 import static org.opends.server.util.ServerConstants.*;
@@ -58,7 +57,7 @@
    * the configuration entry for the backend associated with the
    * backups in this directory.
    */
-  public static final String PROPERTY_BACKEND_CONFIG_DN = "backend_dn";
+  private static final String PROPERTY_BACKEND_CONFIG_DN = "backend_dn";
 
   /**
    * The DN of the configuration entry for the backend with which this
@@ -101,7 +100,7 @@
    *          Information about the set of backups available within the
    *          specified directory.
    */
-  public BackupDirectory(String path, DN configEntryDN, LinkedHashMap<String, BackupInfo> backups)
+  private BackupDirectory(String path, DN configEntryDN, LinkedHashMap<String, BackupInfo> backups)
   {
     this.path = path;
     this.configEntryDN = configEntryDN;
@@ -269,8 +268,7 @@
       // Iterate through all of the backups and add them to the file.
       for (BackupInfo backup : backups.values())
       {
-        List<String> backupLines = backup.encode();
-        for (String line : backupLines)
+        for (String line : backup.encode())
         {
           writer.write(line);
           writer.newLine();
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/BackupInfo.java b/opendj-server-legacy/src/main/java/org/opends/server/types/BackupInfo.java
index a58d4f8..e663235 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/BackupInfo.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/BackupInfo.java
@@ -26,6 +26,8 @@
 import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
 import java.util.TimeZone;
 
 import org.forgerock.i18n.LocalizableMessage;
@@ -47,51 +49,51 @@
   private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
 
   /** The name of the property that holds the date that the backup was created. */
-  public static final String PROPERTY_BACKUP_DATE = "backup_date";
+  private static final String PROPERTY_BACKUP_DATE = "backup_date";
   /** The name of the property that holds the backup ID in encoded representations. */
-  public static final String PROPERTY_BACKUP_ID = "backup_id";
+  private static final String PROPERTY_BACKUP_ID = "backup_id";
 
   /** The name of the property that holds the incremental flag in encoded representations. */
-  public static final String PROPERTY_IS_INCREMENTAL = "incremental";
+  private static final String PROPERTY_IS_INCREMENTAL = "incremental";
   /** The name of the property that holds the compressed flag in encoded representations. */
-  public static final String PROPERTY_IS_COMPRESSED = "compressed";
+  private static final String PROPERTY_IS_COMPRESSED = "compressed";
   /** The name of the property that holds the encrypted flag in encoded representations. */
-  public static final String PROPERTY_IS_ENCRYPTED = "encrypted";
+  private static final String PROPERTY_IS_ENCRYPTED = "encrypted";
   /** The name of the property that holds the unsigned hash in encoded representations. */
-  public static final String PROPERTY_UNSIGNED_HASH = "hash";
+  private static final String PROPERTY_UNSIGNED_HASH = "hash";
   /** The name of the property that holds the signed hash in encoded representations. */
-  public static final String PROPERTY_SIGNED_HASH = "signed_hash";
+  private static final String PROPERTY_SIGNED_HASH = "signed_hash";
   /**
    * The name of the property that holds the set of dependencies in
    * encoded representations (one dependency per instance).
    */
-  public static final String PROPERTY_DEPENDENCY = "dependency";
+  private static final String PROPERTY_DEPENDENCY = "dependency";
   /**
    * The prefix to use with custom backup properties.  The name of the
    * property will be appended to this prefix.
    */
-  public static final String PROPERTY_CUSTOM_PREFIX = "property.";
+  private static final String PROPERTY_CUSTOM_PREFIX = "property.";
 
   /** The backup directory with which this backup info structure is associated. */
-  private BackupDirectory backupDirectory;
+  private final BackupDirectory backupDirectory;
 
   /** Indicates whether this backup is compressed. */
-  private boolean isCompressed;
+  private final boolean isCompressed;
   /** Indicates whether this backup is encrypted. */
-  private boolean isEncrypted;
+  private final boolean isEncrypted;
   /** Indicates whether this is an incremental backup. */
-  private boolean isIncremental;
+  private final boolean isIncremental;
 
   /** The signed hash for this backup, if appropriate. */
-  private byte[] signedHash;
+  private final byte[] signedHash;
   /** The unsigned hash for this backup, if appropriate. */
-  private byte[] unsignedHash;
+  private final byte[] unsignedHash;
 
   /** The time that this backup was created. */
-  private Date backupDate;
+  private final Date backupDate;
 
   /** The set of backup ID(s) on which this backup is dependent. */
-  private HashSet<String> dependencies;
+  private final Set<String> dependencies;
 
   /**
    * The set of additional properties associated with this backup.
@@ -101,10 +103,10 @@
    * the name must not contain an equal sign and neither the name nor
    * the value may contain line breaks;
    */
-  private HashMap<String,String> backupProperties;
+  private final Map<String, String> backupProperties;
 
   /** The unique ID for this backup. */
-  private String backupID;
+  private final String backupID;
 
   /**
    * Creates a new backup info structure with the provided
@@ -269,7 +271,7 @@
    * @return  The set of the backup IDs for the backups on which this
    *          backup is dependent.
    */
-  public HashSet<String> getDependencies()
+  public Set<String> getDependencies()
   {
     return dependencies;
   }
@@ -303,26 +305,12 @@
    * @return  A set of additional properties that should be associated
    *          with this backup.
    */
-  public HashMap<String,String> getBackupProperties()
+  public Map<String, String> getBackupProperties()
   {
     return backupProperties;
   }
 
   /**
-   * Retrieves the value of the backup property with the specified
-   * name.
-   *
-   * @param  name  The name of the backup property to retrieve.
-   *
-   * @return  The value of the backup property with the specified
-   *          name, or <CODE>null</CODE> if there is no such property.
-   */
-  public String getBackupProperty(String name)
-  {
-    return backupProperties.get(name);
-  }
-
-  /**
    * Encodes this backup info structure to a multi-line string
    * representation.  This representation may be parsed by the
    * <CODE>decode</CODE> method to reconstruct the structure.
@@ -330,7 +318,7 @@
    * @return  A multi-line string representation of this backup info
    *          structure.
    */
-  public LinkedList<String> encode()
+  public List<String> encode()
   {
     LinkedList<String> list = new LinkedList<>();
     SimpleDateFormat   dateFormat =
@@ -545,10 +533,9 @@
    * @param  buffer  The buffer to which the information should be
    *                 written.
    */
-  public void toString(StringBuilder buffer)
+  private void toString(StringBuilder buffer)
   {
-    LinkedList<String> lines = encode();
-    for (String line : lines)
+    for (String line : encode())
     {
       buffer.append(line);
       buffer.append(EOL);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/DITContentRule.java b/opendj-server-legacy/src/main/java/org/opends/server/types/DITContentRule.java
index db13c49..d2059ea 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/DITContentRule.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/DITContentRule.java
@@ -16,6 +16,7 @@
  */
 package org.opends.server.types;
 
+import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.forgerock.opendj.ldap.schema.AttributeType;
 import org.forgerock.opendj.ldap.schema.SchemaElement;
 
@@ -26,8 +27,6 @@
 import java.util.Map;
 import java.util.Set;
 
-import org.forgerock.i18n.slf4j.LocalizedLogger;
-
 import static org.forgerock.util.Reject.*;
 import static org.opends.server.util.ServerConstants.*;
 
@@ -70,24 +69,17 @@
    * user-defined name for that class.
    */
   private final Set<ObjectClass> auxiliaryClasses;
-
   /** The set of optional attribute types for this DIT content rule. */
   private final Set<AttributeType> optionalAttributes;
-
   /** The set of prohibited attribute types for this DIT content rule. */
   private final Set<AttributeType> prohibitedAttributes;
-
   /** The set of required attribute types for this DIT content rule. */
   private final Set<AttributeType> requiredAttributes;
-
   /** The definition string used to create this DIT content rule. */
   private final String definition;
-
   /** The description for this DIT content rule. */
   private final String description;
 
-
-
   /**
    * Creates a new DIT content rule definition with the provided
    * information.
@@ -128,7 +120,7 @@
     ifNull(definition, structuralClass);
 
     this.structuralClass = structuralClass;
-    this.description     = description;
+    this.description = description;
     this.isObsolete      = isObsolete;
 
     int schemaFilePos = definition.indexOf(SCHEMA_PROPERTY_FILENAME);
@@ -252,14 +244,7 @@
    */
   public String getNameOrOID()
   {
-    if (names.isEmpty())
-    {
-      return null;
-    }
-    else
-    {
-      return names.values().iterator().next();
-    }
+    return !names.isEmpty() ? names.values().iterator().next() : null;
   }
 
 
@@ -308,25 +293,6 @@
     return requiredAttributes;
   }
 
-
-
-  /**
-   * Indicates whether the provided attribute type is included in the
-   * required attribute list for this DIT content rule.
-   *
-   * @param  attributeType  The attribute type for which to make the
-   *                        determination.
-   *
-   * @return  {@code true} if the provided attribute type is required
-   *          by this DIT content rule, or {@code false} if not.
-   */
-  public boolean isRequired(AttributeType attributeType)
-  {
-    return requiredAttributes.contains(attributeType);
-  }
-
-
-
   /**
    * Retrieves the set of optional attributes for this DIT content
    * rule.
@@ -342,23 +308,6 @@
 
 
   /**
-   * Indicates whether the provided attribute type is included in the
-   * optional attribute list for this DIT content rule.
-   *
-   * @param  attributeType  The attribute type for which to make the
-   *                        determination.
-   *
-   * @return  {@code true} if the provided attribute type is optional
-   *          for this DIT content rule, or {@code false} if not.
-   */
-  public boolean isOptional(AttributeType attributeType)
-  {
-    return optionalAttributes.contains(attributeType);
-  }
-
-
-
-  /**
    * Indicates whether the provided attribute type is in the list of
    * required or optional attributes for this DIT content rule.
    *
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/DirectoryEnvironmentConfig.java b/opendj-server-legacy/src/main/java/org/opends/server/types/DirectoryEnvironmentConfig.java
index 8f2be52..7d8cf29 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/DirectoryEnvironmentConfig.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/DirectoryEnvironmentConfig.java
@@ -86,7 +86,7 @@
    * @param checkIfServerIsRunning
    *            If {@code true}, prevent any change when server is running.
    */
-  public DirectoryEnvironmentConfig(Properties properties, boolean checkIfServerIsRunning)
+  private DirectoryEnvironmentConfig(Properties properties, boolean checkIfServerIsRunning)
   {
     this.checkIfServerIsRunning = checkIfServerIsRunning;
     configProperties = new HashMap<>();
@@ -102,33 +102,6 @@
     }
   }
 
-
-
-  /**
-   * Creates a new directory environment configuration initialized
-   * with a copy of the provided set of properties.
-   *
-   * @param  properties  The properties to use when initializing this
-   *                     environment configuration, or {@code null}
-   *                     to use an empty set of properties.
-   * @param checkIfServerIsRunning
-   *            If {@code true}, prevent any change when server is running.
-   */
-  public DirectoryEnvironmentConfig(Map<String,String> properties, boolean checkIfServerIsRunning)
-  {
-    this.checkIfServerIsRunning = checkIfServerIsRunning;
-    if (properties == null)
-    {
-      configProperties = new HashMap<>();
-    }
-    else
-    {
-      configProperties = new HashMap<>(properties);
-    }
-  }
-
-
-
   /**
    * Retrieves the property with the specified name.  The check will
    * first be made in the local config properties, but if no value is
@@ -139,14 +112,13 @@
    * @return  The property with the specified name, or {@code null} if
    *          no such property is defined.
    */
-  public String getProperty(String name)
+  private String getProperty(String name)
   {
     String value = configProperties.get(name);
     if (value == null)
     {
       value = System.getProperty(name);
     }
-
     return value;
   }
 
@@ -328,7 +300,7 @@
    * @return  The directory that should be considered the instance
    *          root, or {@code null} if it is not defined.
    */
-  public static File getInstanceRootFromServerRoot(File serverRoot)
+  private static File getInstanceRootFromServerRoot(File serverRoot)
   {
     return new File(Utils.getInstancePathFromInstallPath(serverRoot.getAbsolutePath()));
   }
@@ -444,26 +416,23 @@
   public File getConfigFile()
   {
     String configFilePath = getProperty(PROPERTY_CONFIG_FILE);
-    if (configFilePath == null)
-    {
-      File serverRoot = getServerRoot();
-      if (serverRoot != null)
-      {
-        File instanceRoot = getInstanceRootFromServerRoot(serverRoot);
-        File configDir = new File(instanceRoot, CONFIG_DIR_NAME);
-        File configFile = new File(configDir, CONFIG_FILE_NAME);
-        if (configFile.exists())
-        {
-          return configFile;
-        }
-      }
-
-      return null;
-    }
-    else
+    if (configFilePath != null)
     {
       return new File(configFilePath);
     }
+
+    File serverRoot = getServerRoot();
+    if (serverRoot != null)
+    {
+      File instanceRoot = getInstanceRootFromServerRoot(serverRoot);
+      File configDir = new File(instanceRoot, CONFIG_DIR_NAME);
+      File configFile = new File(configDir, CONFIG_FILE_NAME);
+      if (configFile.exists())
+      {
+        return configFile;
+      }
+    }
+    return null;
   }
 
 
@@ -533,34 +502,6 @@
   }
 
   /**
-   * Specifies whether the Directory Server should attempt to start
-   * using the last known good configuration rather than the
-   * current active configuration.
-   *
-   * @param  useLastKnownGoodConfiguration  Indicates whether the
-   *                                        Directory Server should
-   *                                        attempt to start using the
-   *                                        last known good
-   *                                        configuration.
-   *
-   * @return  The previous setting for this configuration option.  If
-   *          no previous value was specified, then {@code false} will
-   *          be returned.
-   *
-   * @throws  InitializationException  If the Directory Server is
-   *                                   already running.
-   */
-  public boolean setUseLastKnownGoodConfiguration(
-                      boolean useLastKnownGoodConfiguration)
-         throws InitializationException
-  {
-    return setBooleanProperty(PROPERTY_USE_LAST_KNOWN_GOOD_CONFIG,
-        useLastKnownGoodConfiguration);
-  }
-
-
-
-  /**
    * Indicates whether the Directory Server should maintain an archive
    * of previous configurations.  If no explicit value is defined,
    * then a default result of {@code true} will be returned.
@@ -629,14 +570,7 @@
     try
     {
       int maxSize = Integer.parseInt(maxSizeStr);
-      if (maxSize > 0)
-      {
-        return maxSize;
-      }
-      else
-      {
-        return 0;
-      }
+      return maxSize > 0 ? maxSize : 0;
     }
     catch (Exception e)
     {
@@ -644,65 +578,6 @@
     }
   }
 
-
-
-  /**
-   * Specifies the maximum number of archived configurations that the
-   * Directory Server should maintain.  A value that is less than or
-   * equal to zero may be used to indicate that there should not be
-   * any limit to the number of archived configurations.
-   *
-   * @param  maxConfigArchiveSize  The maximum number of archived
-   *                               configurations that the Directory
-   *                               Server should maintain.
-   *
-   * @return  The previous setting for this configuration option.  If
-   *          no previous value was specified, then zero will be
-   *          returned.
-   *
-   * @throws  InitializationException  If the Directory Server is
-   *                                   already running.
-   */
-  public int setMaxConfigArchiveSize(int maxConfigArchiveSize)
-         throws InitializationException
-  {
-    checkServerIsRunning();
-
-    if (maxConfigArchiveSize < 0)
-    {
-      maxConfigArchiveSize = 0;
-    }
-
-    String oldMaxSizeStr =
-         setProperty(PROPERTY_MAX_CONFIG_ARCHIVE_SIZE,
-                     String.valueOf(maxConfigArchiveSize));
-    if (oldMaxSizeStr == null)
-    {
-      return 0;
-    }
-    else
-    {
-      try
-      {
-        int oldMaxSize = Integer.parseInt(oldMaxSizeStr);
-        if (oldMaxSize > 0)
-        {
-          return oldMaxSize;
-        }
-        else
-        {
-          return 0;
-        }
-      }
-      catch (Exception e)
-      {
-        return 0;
-      }
-    }
-  }
-
-
-
   /**
    * Retrieves the directory that contains the server schema
    * configuration files.  If no value is defined, but a default
@@ -714,28 +589,23 @@
    */
   public File getSchemaDirectory()
   {
-    String schemaDirectoryPath =
-         getProperty(PROPERTY_SCHEMA_DIRECTORY);
-    if (schemaDirectoryPath == null)
-    {
-      File serverRoot = getServerRoot();
-      if (serverRoot != null)
-      {
-        File instanceRoot =
-          getInstanceRootFromServerRoot(serverRoot);
-        File schemaDir = new File(instanceRoot.getAbsolutePath()
-            + File.separator + PATH_SCHEMA_DIR);
-        if (schemaDir.exists() && schemaDir.isDirectory())
-        {
-          return schemaDir;
-        }
-      }
-      return null;
-    }
-    else
+    String schemaDirectoryPath = getProperty(PROPERTY_SCHEMA_DIRECTORY);
+    if (schemaDirectoryPath != null)
     {
       return new File(schemaDirectoryPath);
     }
+
+    File serverRoot = getServerRoot();
+    if (serverRoot != null)
+    {
+      File instanceRoot = getInstanceRootFromServerRoot(serverRoot);
+      File schemaDir = new File(instanceRoot.getAbsolutePath() + File.separator + PATH_SCHEMA_DIR);
+      if (schemaDir.exists() && schemaDir.isDirectory())
+      {
+        return schemaDir;
+      }
+    }
+    return null;
   }
 
 
@@ -783,76 +653,20 @@
   public File getLockDirectory()
   {
     String lockFilePath = getProperty(PROPERTY_LOCK_DIRECTORY);
-    if (lockFilePath == null)
-    {
-      File serverRoot = getServerRoot();
-      if (serverRoot == null)
-      {
-        return null;
-      }
-      else
-      {
-        File instanceRoot = getInstanceRootFromServerRoot(serverRoot);
-        return new File(instanceRoot, LOCKS_DIRECTORY);
-      }
-    }
-    else
+    if (lockFilePath != null)
     {
       return new File(lockFilePath);
     }
-  }
 
-
-
-  /**
-   * Specifies the directory that should be used to hold the server
-   * lock files.  If the specified path already exists, then it must
-   * be a directory and its contents must be writable by the server.
-   * If it does not exist, then its parent directory must exist and
-   * the server should have permission to create a new subdirectory in
-   * it.
-   *
-   * @param  lockDirectory  The directory that should be used to hold
-   *                        the server lock files.
-   *
-   * @return  The previously-defined lock directory, or {@code null}
-   *          if none was defined.
-   *
-   * @throws  InitializationException  If the Directory Server is
-   *                                   already running or there is a
-   *                                   problem with the provided lock
-   *                                   directory.
-   */
-  public File setLockDirectory(File lockDirectory)
-         throws InitializationException
-  {
-    checkServerIsRunning();
-
-    if (lockDirectory.exists())
+    File serverRoot = getServerRoot();
+    if (serverRoot != null)
     {
-      if (! lockDirectory.isDirectory())
-      {
-        throw new InitializationException(
-                ERR_DIRCFG_INVALID_LOCK_DIRECTORY.get(
-                        lockDirectory.getAbsolutePath()));
-      }
+      File instanceRoot = getInstanceRootFromServerRoot(serverRoot);
+      return new File(instanceRoot, LOCKS_DIRECTORY);
     }
-    else
-    {
-      File parentFile = lockDirectory.getParentFile();
-      if (!parentFile.exists() || !parentFile.isDirectory())
-      {
-        throw new InitializationException(
-                ERR_DIRCFG_INVALID_LOCK_DIRECTORY.get(
-                        lockDirectory.getAbsolutePath()));
-      }
-    }
-
-    return setPathProperty(PROPERTY_LOCK_DIRECTORY, lockDirectory);
+    return null;
   }
 
-
-
   /**
    * Indicates whether the Directory Server startup process should
    * skip the connection handler creation and initialization phases.
@@ -993,32 +807,6 @@
     return isPropertyTrue(PROPERTY_DISABLE_EXEC);
   }
 
-
-
-  /**
-   * Specifies whether the Directory Server should be allowed to use
-   * the {@code Runtime.exec()} method to be able to launch external
-   * commands on the underlying system.
-   *
-   * @param  disableExec  Indicates whether the Directory Server
-   *                      should be allowed to launch external
-   *                      commands on the underlying system.
-   *
-   * @return  The previous setting for this configuration option.  If
-   *          no previous value was specified, then {@code false} will
-   *          be returned.
-   *
-   * @throws  InitializationException  If the Directory Server is
-   *                                   already running.
-   */
-  public boolean setDisableExec(boolean disableExec)
-         throws InitializationException
-  {
-    return setBooleanProperty(PROPERTY_DISABLE_EXEC, disableExec);
-  }
-
-
-
   /** Throws an exception if server is running and it is not allowed. */
   private void checkServerIsRunning() throws InitializationException
   {
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/FilePermission.java b/opendj-server-legacy/src/main/java/org/opends/server/types/FilePermission.java
index 382ad2c..0f798b5 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/FilePermission.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/FilePermission.java
@@ -12,10 +12,12 @@
  * information: "Portions Copyright [year] [name of copyright owner]".
  *
  * Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2013-2015 ForgeRock AS.
+ * Portions Copyright 2013-2016 ForgeRock AS.
  */
 package org.opends.server.types;
 
+import static org.opends.messages.UtilityMessages.*;
+
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
@@ -30,8 +32,6 @@
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.opendj.ldap.ResultCode;
 
-import static org.opends.messages.UtilityMessages.*;
-
 /**
  * This class provides a mechanism for setting file permissions in a
  * more abstract manner than is provided by the underlying operating
@@ -48,83 +48,46 @@
      mayInvoke=true)
 public class FilePermission
 {
-  /**
-   * The bitmask that should be used for indicating whether a file is
-   * readable by its owner.
-   */
-  public static final int OWNER_READABLE = 0x0100;
-
-
-
-  /**
-   * The bitmask that should be used for indicating whether a file is
-   * writable by its owner.
-   */
-  public static final int OWNER_WRITABLE = 0x0080;
-
-
-
-  /**
-   * The bitmask that should be used for indicating whether a file is
-   * executable by its owner.
-   */
-  public static final int OWNER_EXECUTABLE = 0x0040;
-
-
-
+  /** The bitmask that should be used for indicating whether a file is readable by its owner. */
+  private static final int OWNER_READABLE = 0x0100;
+  /** The bitmask that should be used for indicating whether a file is writable by its owner. */
+  private static final int OWNER_WRITABLE = 0x0080;
+  /** The bitmask that should be used for indicating whether a file is executable by its owner. */
+  private static final int OWNER_EXECUTABLE = 0x0040;
   /**
    * The bitmask that should be used for indicating whether a file is
    * readable by members of its group.
    */
-  public static final int GROUP_READABLE = 0x0020;
-
-
-
+  private static final int GROUP_READABLE = 0x0020;
   /**
    * The bitmask that should be used for indicating whether a file is
    * writable by members of its group.
    */
-  public static final int GROUP_WRITABLE = 0x0010;
-
-
-
+  private static final int GROUP_WRITABLE = 0x0010;
   /**
    * The bitmask that should be used for indicating whether a file is
    * executable by members of its group.
    */
-  public static final int GROUP_EXECUTABLE = 0x0008;
-
-
-
+  private static final int GROUP_EXECUTABLE = 0x0008;
   /**
    * The bitmask that should be used for indicating whether a file is
    * readable by users other than the owner or group members.
    */
-  public static final int OTHER_READABLE = 0x0004;
-
-
-
+  private static final int OTHER_READABLE = 0x0004;
   /**
    * The bitmask that should be used for indicating whether a file is
    * writable by users other than the owner or group members.
    */
-  public static final int OTHER_WRITABLE = 0x0002;
-
-
-
+  private static final int OTHER_WRITABLE = 0x0002;
   /**
    * The bitmask that should be used for indicating whether a file is
    * executable by users other than the owner or group members.
    */
-  public static final int OTHER_EXECUTABLE = 0x0001;
-
-
+  private static final int OTHER_EXECUTABLE = 0x0001;
 
   /** The encoded representation for this file permission. */
   private int encodedPermission;
 
-
-
   /**
    * Creates a new file permission object with the provided encoded
    * representation.
@@ -137,123 +100,6 @@
     this.encodedPermission = encodedPermission;
   }
 
-
-
-  /**
-   * Creates a new file permission with the specified rights for the
-   * file owner.  Users other than the owner will not have any rights.
-   *
-   * @param  ownerReadable    Indicates whether the owner should have
-   *                          the read permission.
-   * @param  ownerWritable    Indicates whether the owner should have
-   *                          the write permission.
-   * @param  ownerExecutable  Indicates whether the owner should have
-   *                          the execute permission.
-   */
-  public FilePermission(boolean ownerReadable, boolean ownerWritable,
-                        boolean ownerExecutable)
-  {
-    encodedPermission = 0x0000;
-
-    if (ownerReadable)
-    {
-      encodedPermission |= OWNER_READABLE;
-    }
-
-    if (ownerWritable)
-    {
-      encodedPermission |= OWNER_WRITABLE;
-    }
-
-    if (ownerExecutable)
-    {
-      encodedPermission |= OWNER_EXECUTABLE;
-    }
-  }
-
-
-
-  /**
-   * Creates a new file permission with the specified rights for the
-   * file owner, group members, and other users.
-   *
-   * @param  ownerReadable    Indicates whether the owner should have
-   *                          the read permission.
-   * @param  ownerWritable    Indicates whether the owner should have
-   *                          the write permission.
-   * @param  ownerExecutable  Indicates whether the owner should have
-   *                          the execute permission.
-   * @param  groupReadable    Indicates whether members of the file's
-   *                          group should have the read permission.
-   * @param  groupWritable    Indicates whether members of the file's
-   *                          group should have the write permission.
-   * @param  groupExecutable  Indicates whether members of the file's
-   *                          group should have the execute
-   *                          permission.
-   * @param  otherReadable    Indicates whether other users should
-   *                          have the read permission.
-   * @param  otherWritable    Indicates whether other users should
-   *                          have the write permission.
-   * @param  otherExecutable  Indicates whether other users should
-   *                          have the execute permission.
-   */
-  public FilePermission(boolean ownerReadable, boolean ownerWritable,
-                        boolean ownerExecutable,
-                        boolean groupReadable, boolean groupWritable,
-                        boolean groupExecutable,
-                        boolean otherReadable, boolean otherWritable,
-                        boolean otherExecutable)
-  {
-    encodedPermission = 0x0000;
-
-    if (ownerReadable)
-    {
-      encodedPermission |= OWNER_READABLE;
-    }
-
-    if (ownerWritable)
-    {
-      encodedPermission |= OWNER_WRITABLE;
-    }
-
-    if (ownerExecutable)
-    {
-      encodedPermission |= OWNER_EXECUTABLE;
-    }
-
-    if (groupReadable)
-    {
-      encodedPermission |= GROUP_READABLE;
-    }
-
-    if (groupWritable)
-    {
-      encodedPermission |= GROUP_WRITABLE;
-    }
-
-    if (groupExecutable)
-    {
-      encodedPermission |= GROUP_EXECUTABLE;
-    }
-
-    if (otherReadable)
-    {
-      encodedPermission |= OTHER_READABLE;
-    }
-
-    if (otherWritable)
-    {
-      encodedPermission |= OTHER_WRITABLE;
-    }
-
-    if (otherExecutable)
-    {
-      encodedPermission |= OTHER_EXECUTABLE;
-    }
-  }
-
-
-
   /**
    * Indicates whether this file permission includes the owner read
    * permission.
@@ -266,8 +112,6 @@
     return is(encodedPermission, OWNER_READABLE);
   }
 
-
-
   /**
    * Indicates whether this file permission includes the owner write
    * permission.
@@ -280,8 +124,6 @@
     return is(encodedPermission, OWNER_WRITABLE);
   }
 
-
-
   /**
    * Indicates whether this file permission includes the owner execute
    * permission.
@@ -294,8 +136,6 @@
     return is(encodedPermission, OWNER_EXECUTABLE);
   }
 
-
-
   /**
    * Indicates whether this file permission includes the group read
    * permission.
@@ -308,8 +148,6 @@
     return is(encodedPermission, GROUP_READABLE);
   }
 
-
-
   /**
    * Indicates whether this file permission includes the group write
    * permission.
@@ -322,8 +160,6 @@
     return is(encodedPermission, GROUP_WRITABLE);
   }
 
-
-
   /**
    * Indicates whether this file permission includes the group execute
    * permission.
@@ -336,8 +172,6 @@
     return is(encodedPermission, GROUP_EXECUTABLE);
   }
 
-
-
   /**
    * Indicates whether this file permission includes the other read
    * permission.
@@ -350,8 +184,6 @@
     return is(encodedPermission, OTHER_READABLE);
   }
 
-
-
   /**
    * Indicates whether this file permission includes the other write
    * permission.
@@ -364,8 +196,6 @@
     return is(encodedPermission, OTHER_WRITABLE);
   }
 
-
-
   /**
    * Indicates whether this file permission includes the other execute
    * permission.
@@ -487,8 +317,6 @@
     return buffer.toString();
   }
 
-
-
   /**
    * Appends a three-character string that is the UNIX mode for the
    * provided file permission to the given buffer.  Each character of
@@ -498,7 +326,7 @@
    *                 appended.
    * @param  p       The permission to retrieve as a UNIX mode string.
    */
-  public static void toUNIXMode(StringBuilder buffer,
+  private static void toUNIXMode(StringBuilder buffer,
                                 FilePermission p)
   {
     byte modeByte = 0x00;
@@ -547,8 +375,6 @@
     buffer.append(modeByte);
   }
 
-
-
   /**
    * Decodes the provided string as a UNIX mode and retrieves the
    * corresponding file permission.  The mode string must contain
@@ -669,8 +495,6 @@
     return new FilePermission(encodedPermission);
   }
 
-
-
   /**
    * Build a file permissions string in the "rwx" form expected by NIO,
    * but with optional prefix strings before each three character block.
@@ -702,8 +526,6 @@
     buffer.append(p.isOtherExecutable() ? "x" : "-");
   }
 
-
-
   /**
    * Retrieves a string representation of this file permission.
    *
@@ -717,17 +539,14 @@
     return buffer.toString();
   }
 
-
-
   /**
    * Appends a string representation of this file permission to the
    * given buffer.
    *
    * @param  buffer  The buffer to which the data should be appended.
    */
-  public void toString(StringBuilder buffer)
+  private void toString(StringBuilder buffer)
   {
     toPOSIXString(this, buffer, "Owner=", ", Group=", ", Other=");
   }
 }
-
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/IntermediateResponse.java b/opendj-server-legacy/src/main/java/org/opends/server/types/IntermediateResponse.java
index 64861c9..920ed0d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/IntermediateResponse.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/IntermediateResponse.java
@@ -16,13 +16,11 @@
  */
 package org.opends.server.types;
 
-import org.forgerock.opendj.ldap.ByteString;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
-
-
+import org.forgerock.opendj.ldap.ByteString;
 
 /**
  * This class defines a data structure for holding information that
@@ -32,24 +30,18 @@
 @org.opends.server.types.PublicAPI(
      stability=org.opends.server.types.StabilityLevel.VOLATILE,
      mayInstantiate=true,
-     mayExtend=false,
      mayInvoke=true)
 public final class IntermediateResponse
 {
   /** The value for this intermediate response. */
   private ByteString value;
-
   /** The set of controls for this intermediate response. */
-  private List<Control> controls;
-
+  private final List<Control> controls;
   /** The operation with which this intermediate response is associated. */
-  private Operation operation;
-
+  private final Operation operation;
   /** The OID for this intermediate response. */
   private String oid;
 
-
-
   /**
    * Creates a new intermediate response with the provided
    * information.
@@ -69,18 +61,16 @@
     this.oid       = oid;
     this.value     = value;
 
-    if (controls == null)
-    {
-      this.controls = new ArrayList<>(0);
-    }
-    else
+    if (controls != null)
     {
       this.controls = controls;
     }
+    else
+    {
+      this.controls = new ArrayList<>(0);
+    }
   }
 
-
-
   /**
    * Retrieves the operation with which this intermediate response
    * message is associated.
@@ -93,8 +83,6 @@
     return operation;
   }
 
-
-
   /**
    * Retrieves the OID for this intermediate response.
    *
@@ -106,8 +94,6 @@
     return oid;
   }
 
-
-
   /**
    * Specifies the OID for this intermediate response.
    *
@@ -118,8 +104,6 @@
     this.oid = oid;
   }
 
-
-
   /**
    * Retrieves the value for this intermediate response.
    *
@@ -131,8 +115,6 @@
     return value;
   }
 
-
-
   /**
    * Specifies the value for this intermediate response.
    *
@@ -143,8 +125,6 @@
     this.value = value;
   }
 
-
-
   /**
    * Retrieves the set of controls for this intermediate response.
    * The contents of the list may be altered by intermediate response
@@ -157,8 +137,6 @@
     return controls;
   }
 
-
-
   /**
    * Retrieves a string representation of this intermediate response.
    *
@@ -172,8 +150,6 @@
     return buffer.toString();
   }
 
-
-
   /**
    * Appends a string representation of this intermediate response to
    * the provided buffer.
@@ -181,7 +157,7 @@
    * @param  buffer  The buffer to which the information should be
    *                 appended.
    */
-  public void toString(StringBuilder buffer)
+  private void toString(StringBuilder buffer)
   {
     buffer.append("IntermediateResponse(operation=");
     operation.toString(buffer);
@@ -207,4 +183,3 @@
     buffer.append(")");
   }
 }
-
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/LDAPURL.java b/opendj-server-legacy/src/main/java/org/opends/server/types/LDAPURL.java
index fe3ef60..84f95a0 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/LDAPURL.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/LDAPURL.java
@@ -54,11 +54,11 @@
   /** The default scheme that will be used if none is provided. */
   public static final String DEFAULT_SCHEME = "ldap";
   /** The default port value that will be used if none is provided. */
-  public static final int DEFAULT_PORT = 389;
+  private static final int DEFAULT_PORT = 389;
   /** The default base DN that will be used if none is provided. */
-  public static final DN DEFAULT_BASE_DN = DN.rootDN();
+  private static final DN DEFAULT_BASE_DN = DN.rootDN();
   /** The default search scope that will be used if none is provided. */
-  public static final SearchScope DEFAULT_SEARCH_SCOPE =
+  private static final SearchScope DEFAULT_SEARCH_SCOPE =
        SearchScope.BASE_OBJECT;
   /** The default search filter that will be used if none is provided. */
   public static final SearchFilter DEFAULT_SEARCH_FILTER =
@@ -82,9 +82,9 @@
   private String rawFilter;
 
   /** The set of attributes for this LDAP URL. */
-  private LinkedHashSet<String> attributes;
+  private final LinkedHashSet<String> attributes;
   /** The set of extensions for this LDAP URL. */
-  private LinkedList<String> extensions;
+  private final List<String> extensions;
 
 
   /** The scheme (i.e., protocol) for this LDAP URL. */
@@ -110,7 +110,7 @@
   public LDAPURL(String scheme, String host, int port,
                  String rawBaseDN, LinkedHashSet<String> attributes,
                  SearchScope scope, String rawFilter,
-                 LinkedList<String> extensions)
+                 List<String> extensions)
   {
     this.host = toLowerCase(host);
 
@@ -193,7 +193,7 @@
    */
   public LDAPURL(String scheme, String host, int port, DN baseDN,
                  LinkedHashSet<String> attributes, SearchScope scope,
-                 SearchFilter filter, LinkedList<String> extensions)
+                 SearchFilter filter, List<String> extensions)
   {
     this.host = toLowerCase(host);
 
@@ -377,10 +377,7 @@
                          DEFAULT_SEARCH_SCOPE, DEFAULT_SEARCH_FILTER,
                          null);
     }
-    else
-    {
-      startPos = pos;
-    }
+    startPos = pos;
 
 
     // The next delimiter should be a question mark.  If there isn't
@@ -1180,7 +1177,7 @@
    *
    * @return  The set of extensions for this LDAP URL.
    */
-  public LinkedList<String> getExtensions()
+  public List<String> getExtensions()
   {
     return extensions;
   }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/LDIFExportConfig.java b/opendj-server-legacy/src/main/java/org/opends/server/types/LDIFExportConfig.java
index 6c05fef..f7e4a61 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/LDIFExportConfig.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/LDIFExportConfig.java
@@ -16,10 +16,16 @@
  */
 package org.opends.server.types;
 
-import org.forgerock.opendj.ldap.DN;
-import org.forgerock.opendj.ldap.schema.AttributeType;
+import static org.opends.messages.UtilityMessages.*;
+import static org.opends.server.util.StaticUtils.*;
 
-import java.io.*;
+import java.io.BufferedWriter;
+import java.io.Closeable;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
@@ -27,12 +33,10 @@
 import java.util.zip.GZIPOutputStream;
 
 import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.i18n.slf4j.LocalizedLogger;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.schema.AttributeType;
 import org.opends.server.util.StaticUtils;
 
-import static org.opends.messages.UtilityMessages.*;
-import static org.opends.server.util.StaticUtils.*;
-
 /**
  * This class defines a data structure for holding configuration
  * information to use when performing an LDIF export.
@@ -45,37 +49,19 @@
 public final class LDIFExportConfig extends OperationConfig
   implements Closeable
 {
-  private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
-
   /** Indicates whether the data should be compressed as it is written. */
   private boolean compressData;
-
   /** Indicates whether the data should be encrypted as it is written. */
   private boolean encryptData;
-
-  /**
-   * Indicates whether to generate a cryptographic hash of the data as it is
-   * written.
-   */
+  /** Indicates whether to generate a cryptographic hash of the data as it is written. */
   private boolean hashData;
-
-  /**
-   * Indicates whether to include the objectclasses in the entries written in
-   * the export.
-   */
+  /** Indicates whether to include the objectclasses in the entries written in the export. */
   private boolean includeObjectClasses;
-
-  /**
-   * Indicates whether to include operational attributes in the export.
-   */
+  /** Indicates whether to include operational attributes in the export. */
   private boolean includeOperationalAttributes;
-
   /** Indicates whether to include virtual attributes in the export. */
   private boolean includeVirtualAttributes;
-
-  /**
-   * Indicates whether to invoke LDIF export plugins on entries being exported.
-   */
+  /** Indicates whether to invoke LDIF export plugins on entries being exported. */
   private boolean invokeExportPlugins;
 
   /**
@@ -83,52 +69,40 @@
    */
   private boolean signHash;
 
-  /**
-   * Indicates whether to include attribute types (i.e., names) only or both
-   * types and values.
-   */
+  /** Indicates whether to include attribute types (i.e., names) only or both types and values. */
   private boolean typesOnly;
 
+  /** The path to the LDIF file that should be written. */
+  private final String ldifFile;
   /** The buffered writer to which the LDIF data should be written. */
   private BufferedWriter writer;
+  /** The output stream to which the LDIF data should be written. */
+  private OutputStream ldifOutputStream;
 
   /**
    * The behavior that should be used when writing an LDIF file and a file with
    * the same name already exists.
    */
-  private ExistingFileBehavior existingFileBehavior;
+  private final ExistingFileBehavior existingFileBehavior;
 
   /** The column number at which long lines should be wrapped. */
   private int wrapColumn;
 
   /** The set of base DNs to exclude from the export. */
   private List<DN> excludeBranches;
-
   /** The set of base DNs to include from the export. */
   private List<DN> includeBranches;
 
   /** The set of search filters for entries to exclude from the export. */
   private List<SearchFilter> excludeFilters;
-
   /** The set of search filters for entries to include in the export. */
   private List<SearchFilter> includeFilters;
 
-  /** The output stream to which the LDIF data should be written. */
-  private OutputStream ldifOutputStream;
-
-  /**
-   * The set of attribute types that should be excluded from the export.
-   */
+  /** The set of attribute types that should be excluded from the export. */
   private Set<AttributeType> excludeAttributes;
-
   /** The set of attribute types that should be included in the export. */
   private Set<AttributeType> includeAttributes;
 
-  /** The path to the LDIF file that should be written. */
-  private String ldifFile;
-
-
-
   /**
    * Creates a new LDIF export configuration that will write to the
    * specified LDIF file.
@@ -164,8 +138,6 @@
     wrapColumn                   = -1;
   }
 
-
-
   /**
    * Creates a new LDIF export configuration that will write to the
    * provided output stream.
@@ -198,8 +170,6 @@
     wrapColumn                   = -1;
   }
 
-
-
   /**
    * Retrieves the writer that should be used to write the LDIF data.
    * If compression or encryption are to be used, then they must be
@@ -248,13 +218,10 @@
             LocalizableMessage message = ERR_LDIF_FILE_EXISTS.get(ldifFile);
             throw new IOException(message.toString());
           }
-          else
-          {
-            // Create new file ensuring that we can set its permissions.
-            f.createNewFile();
-            mustSetPermissions = true;
-            ldifOutputStream = new FileOutputStream(ldifFile);
-          }
+          // Create new file ensuring that we can set its permissions.
+          f.createNewFile();
+          mustSetPermissions = true;
+          ldifOutputStream = new FileOutputStream(ldifFile);
           break;
         }
 
@@ -275,7 +242,6 @@
         }
       }
 
-
       // See if we should compress the output.
       OutputStream outputStream;
       if (compressData)
@@ -291,7 +257,7 @@
       // See if we should encrypt the output.
       if (encryptData)
       {
-        // FIXME -- Implement this.
+        // FIXME -- To be implemented: See OPENDJ-448.
       }
 
 
@@ -302,8 +268,6 @@
     return writer;
   }
 
-
-
   /**
    * Indicates whether the LDIF export plugins should be invoked for
    * entries as they are exported.
@@ -317,8 +281,6 @@
     return invokeExportPlugins;
   }
 
-
-
   /**
    * Specifies whether the LDIF export plugins should be invoked for
    * entries as they are exported.
@@ -332,22 +294,6 @@
     this.invokeExportPlugins = invokeExportPlugins;
   }
 
-
-
-  /**
-   * Indicates whether the LDIF data should be compressed as it is
-   * written.
-   *
-   * @return  <CODE>true</CODE> if the LDIF data should be compressed
-   *          as it is written, or <CODE>false</CODE> if not.
-   */
-  public boolean compressData()
-  {
-    return compressData;
-  }
-
-
-
   /**
    * Specifies whether the LDIF data should be compressed as it is
    * written.  If compression should be used, then this must be set
@@ -467,8 +413,6 @@
     return typesOnly;
   }
 
-
-
   /**
    * Specifies whether the LDIF generated should include attribute
    * types (i.e., attribute names) only or both attribute types and
@@ -483,8 +427,6 @@
     this.typesOnly = typesOnly;
   }
 
-
-
   /**
    * Retrieves the column at which long lines should be wrapped.
    *
@@ -497,8 +439,6 @@
     return wrapColumn;
   }
 
-
-
   /**
    * Specifies the column at which long lines should be wrapped.  A
    * value less than or equal to zero indicates that no wrapping
@@ -512,8 +452,6 @@
     this.wrapColumn = wrapColumn;
   }
 
-
-
   /**
    * Retrieves the set of base DNs that specify the set of entries to
    * exclude from the export.  The list that is returned may be
@@ -527,8 +465,6 @@
     return excludeBranches;
   }
 
-
-
   /**
    * Specifies the set of base DNs that specify the set of entries to
    * exclude from the export.
@@ -538,18 +474,16 @@
    */
   public void setExcludeBranches(List<DN> excludeBranches)
   {
-    if (excludeBranches == null)
-    {
-      this.excludeBranches = new ArrayList<>(0);
-    }
-    else
+    if (excludeBranches != null)
     {
       this.excludeBranches = excludeBranches;
     }
+    else
+    {
+      this.excludeBranches = new ArrayList<>(0);
+    }
   }
 
-
-
   /**
    * Retrieves the set of base DNs that specify the set of entries to
    * include in the export.  The list that is returned may be altered
@@ -563,8 +497,6 @@
     return includeBranches;
   }
 
-
-
   /**
    * Specifies the set of base DNs that specify the set of entries to
    * include in the export.
@@ -574,18 +506,16 @@
    */
   public void setIncludeBranches(List<DN> includeBranches)
   {
-    if (includeBranches == null)
-    {
-      this.includeBranches = new ArrayList<>(0);
-    }
-    else
+    if (includeBranches != null)
     {
       this.includeBranches = includeBranches;
     }
+    else
+    {
+      this.includeBranches = new ArrayList<>(0);
+    }
   }
 
-
-
   /**
    * Indicates whether the set of objectclasses should be included in
    * the entries written to LDIF.
@@ -599,8 +529,6 @@
     return includeObjectClasses;
   }
 
-
-
   /**
    * Indicates whether the set of operational attributes should be
    * included in the export.
@@ -613,8 +541,6 @@
     return includeOperationalAttributes;
   }
 
-
-
   /**
    * Specifies whether the  objectclasss attribute should be
    * included in the export.
@@ -644,8 +570,6 @@
     this.includeOperationalAttributes = includeOperationalAttributes;
   }
 
-
-
   /**
    * Indicates whether virtual attributes should be included in the
    * export.
@@ -658,8 +582,6 @@
     return includeVirtualAttributes;
   }
 
-
-
   /**
    * Specifies whether virtual attributes should be included in the
    * export.
@@ -674,8 +596,6 @@
     this.includeVirtualAttributes = includeVirtualAttributes;
   }
 
-
-
   /**
    * Retrieves the set of attributes that should be excluded from the
    * entries written to LDIF.  The set that is returned may be altered
@@ -689,8 +609,6 @@
     return excludeAttributes;
   }
 
-
-
   /**
    * Specifies the set of attributes that should be excluded from the
    * entries written to LDIF.
@@ -702,18 +620,16 @@
   public void setExcludeAttributes(
                    Set<AttributeType> excludeAttributes)
   {
-    if (excludeAttributes == null)
-    {
-      this.excludeAttributes = new HashSet<>(0);
-    }
-    else
+    if (excludeAttributes != null)
     {
       this.excludeAttributes = excludeAttributes;
     }
+    else
+    {
+      this.excludeAttributes = new HashSet<>(0);
+    }
   }
 
-
-
   /**
    * Retrieves the set of attributes that should be included in the
    * entries written to LDIF.  The set that is returned may be altered
@@ -727,8 +643,6 @@
     return includeAttributes;
   }
 
-
-
   /**
    * Specifies the set of attributes that should be included in the
    * entries written to LDIF.
@@ -739,18 +653,16 @@
    */
   public void setIncludeAttributes(Set<AttributeType> includeAttributes)
   {
-    if (includeAttributes == null)
-    {
-      this.includeAttributes = new HashSet<>(0);
-    }
-    else
+    if (includeAttributes != null)
     {
       this.includeAttributes = includeAttributes;
     }
+    else
+    {
+      this.includeAttributes = new HashSet<>(0);
+    }
   }
 
-
-
   /**
    * Indicates whether the specified attribute should be included in
    * the entries written to LDIF.
@@ -770,8 +682,6 @@
               || includeAttributes.contains(attributeType));
   }
 
-
-
   /**
    * Retrieves the set of search filters that should be used to
    * determine which entries to exclude from the LDIF.  The list that
@@ -785,8 +695,6 @@
     return excludeFilters;
   }
 
-
-
   /**
    * Specifies the set of search filters that should be used to
    * determine which entries to exclude from the LDIF.
@@ -797,18 +705,16 @@
    */
   public void setExcludeFilters(List<SearchFilter> excludeFilters)
   {
-    if (excludeFilters == null)
-    {
-      this.excludeFilters = new ArrayList<>(0);
-    }
-    else
+    if (excludeFilters != null)
     {
       this.excludeFilters = excludeFilters;
     }
+    else
+    {
+      this.excludeFilters = new ArrayList<>(0);
+    }
   }
 
-
-
   /**
    * Retrieves the set of search filters that should be used to
    * determine which entries to include in the LDIF.  The list that is
@@ -822,8 +728,6 @@
     return includeFilters;
   }
 
-
-
   /**
    * Specifies the set of search filters that should be used to
    * determine which entries to include in the LDIF.
@@ -834,18 +738,16 @@
    */
   public void setIncludeFilters(List<SearchFilter> includeFilters)
   {
-    if (includeFilters == null)
-    {
-      this.includeFilters = new ArrayList<>(0);
-    }
-    else
+    if (includeFilters != null)
     {
       this.includeFilters = includeFilters;
     }
+    else
+    {
+      this.includeFilters = new ArrayList<>(0);
+    }
   }
 
-
-
   /**
    * Indicates whether the specified entry should be included in the
    * export based on the configured set of include and exclude
@@ -914,11 +816,7 @@
     return true;
   }
 
-
-
-  /**
-   * Closes any resources that this export config might have open.
-   */
+  /** Closes any resources that this export config might have open. */
   @Override
   public void close()
   {
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/LDIFImportConfig.java b/opendj-server-legacy/src/main/java/org/opends/server/types/LDIFImportConfig.java
index c40b25c..3605862 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/LDIFImportConfig.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/LDIFImportConfig.java
@@ -16,16 +16,31 @@
  */
 package org.opends.server.types;
 
-import org.forgerock.opendj.ldap.DN;
-import org.forgerock.opendj.ldap.schema.AttributeType;
-
 import static org.opends.messages.UtilityMessages.*;
 
-import java.io.*;
-import java.util.*;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.Closeable;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
 import java.util.zip.GZIPInputStream;
 
 import org.forgerock.i18n.LocalizableMessageDescriptor.Arg1;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.schema.AttributeType;
 import org.opends.server.tools.makeldif.MakeLDIFInputStream;
 import org.opends.server.tools.makeldif.TemplateFile;
 import org.opends.server.util.CollectionUtils;
@@ -77,7 +92,7 @@
   private int bufferSize = DEFAULT_BUFFER_SIZE;
 
   /** The iterator used to read through the set of LDIF files. */
-  private Iterator<String> ldifFileIterator;
+  private final Iterator<String> ldifFileIterator;
 
   /** The set of base DNs to exclude from the import. */
   private Set<DN> excludeBranches = new HashSet<>(0);
@@ -90,7 +105,7 @@
   private List<SearchFilter> includeFilters = new ArrayList<>(0);
 
   /** The set of LDIF files to be imported. */
-  private List<String> ldifFiles;
+  private final List<String> ldifFiles;
 
   /** The set of attribute types that should be excluded from the import. */
   private Set<AttributeType> excludeAttributes = new HashSet<>(0);
@@ -150,6 +165,7 @@
    */
   public LDIFImportConfig(InputStream ldifInputStream)
   {
+    this(Collections.<String> emptyList());
     this.ldifInputStream   = ldifInputStream;
   }
 
@@ -162,6 +178,7 @@
    */
   public LDIFImportConfig(Reader ldifInputReader)
   {
+    this(Collections.<String> emptyList());
     reader                 = getBufferedReader(ldifInputReader);
   }
 
@@ -422,26 +439,7 @@
     }
   }
 
-  /**
-   * Indicates that skipped entries should be written to the provided
-   * output stream.  Note that this does not apply to entries that are
-   * rejected because they are invalid (e.g., are malformed or don't
-   * conform to schema requirements), but only apply to entries that
-   * are skipped because they matched exclude criteria.
-   *
-   * @param  outputStream  The output stream to which skipped entries
-   *                       should be written.
-   */
-  public void writeSkippedEntries(OutputStream outputStream)
-  {
-    if (outputStream == null)
-    {
-      closeSkipWriter();
-      return;
-    }
-    skipWriter =
-         new BufferedWriter(new OutputStreamWriter(outputStream));
-  }
+
 
 
 
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/LDIFImportResult.java b/opendj-server-legacy/src/main/java/org/opends/server/types/LDIFImportResult.java
index 6ec5c4a..6037f2c 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/LDIFImportResult.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/LDIFImportResult.java
@@ -16,8 +16,6 @@
  */
 package org.opends.server.types;
 
-
-
 /**
  * This class defines a data structure for providing information about
  * the state of a completed LDIF import, including the total number of
@@ -32,10 +30,8 @@
 {
   /** The total number of entries read during the import. */
   private final long entriesRead;
-
   /** The total number of entries rejected during the import. */
   private final long entriesRejected;
-
   /** The total number of entries skipped during the import. */
   private final long entriesSkipped;
 
@@ -139,7 +135,7 @@
    * @param  buffer  The buffer to which the information should be
    *                 appended.
    */
-  public void toString(StringBuilder buffer)
+  private void toString(StringBuilder buffer)
   {
     buffer.append("LDIFImportResult(entriesRead=");
     buffer.append(entriesRead);
@@ -150,4 +146,3 @@
     buffer.append(")");
   }
 }
-
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/LockManager.java b/opendj-server-legacy/src/main/java/org/opends/server/types/LockManager.java
index 07b4e2c..3632615 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/LockManager.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/LockManager.java
@@ -103,9 +103,7 @@
     mayInstantiate = false, mayExtend = false, mayInvoke = true)
 public final class LockManager
 {
-  /**
-   * A lock on an entry or subtree. A lock can only be unlocked once.
-   */
+  /** A lock on an entry or subtree. A lock can only be unlocked once. */
   public final class DNLock
   {
     private final DNLockHolder lock;
@@ -145,16 +143,14 @@
       isLocked = false;
     }
 
-    // For unit testing.
+    /** For unit testing. */
     int refCount()
     {
       return lock.refCount.get();
     }
   }
 
-  /**
-   * Lock implementation
-   */
+  /** Lock implementation. */
   private final class DNLockHolder
   {
     private final AtomicInteger refCount = new AtomicInteger();
@@ -177,9 +173,7 @@
       return "\"" + dn + "\" : " + refCount;
     }
 
-    /**
-     * Unlocks the subtree read lock from the parent of this lock up to the root.
-     */
+    /** Unlocks the subtree read lock from the parent of this lock up to the root. */
     void releaseParentSubtreeReadLock()
     {
       for (DNLockHolder lock = parent; lock != null; lock = lock.parent)
@@ -203,9 +197,7 @@
       return tryLock(subtreeLock.writeLock(), entryLock.writeLock());
     }
 
-    /**
-     * Locks the subtree read lock from the root down to the parent of this lock.
-     */
+    /** Locks the subtree read lock from the root down to the parent of this lock. */
     private boolean tryAcquireParentSubtreeReadLock()
     {
       // First lock the parents of the parent.
@@ -274,7 +266,7 @@
   private final long lockTimeout;
   private final TimeUnit lockTimeoutUnits;
 
-  // Avoid sub-classing in order to workaround class leaks in app servers.
+  /** Avoid sub-classing in order to workaround class leaks in app servers. */
   private final ThreadLocal<LinkedList<DNLockHolder>> threadLocalCache = new ThreadLocal<>();
 
   /**
@@ -311,7 +303,7 @@
    *          The number of buckets to use in the lock table. The minimum number of buckets is 64.
    */
   @SuppressWarnings("unchecked")
-  public LockManager(final long lockTimeout, final TimeUnit lockTimeoutUnit, final int numberOfBuckets)
+  private LockManager(final long lockTimeout, final TimeUnit lockTimeoutUnit, final int numberOfBuckets)
   {
     Reject.ifFalse(lockTimeout >= 0, "lockTimeout must be a non-negative integer");
     Reject.ifNull(lockTimeoutUnit, "lockTimeoutUnit must be non-null");
@@ -386,7 +378,7 @@
     return acquireLockFromCache(subtree).tryWriteLockSubtree();
   }
 
-  // For unit testing.
+  /** For unit testing. */
   int getLockTableRefCountFor(final DN dn)
   {
     final int dnHashCode = dn.hashCode();
@@ -404,7 +396,7 @@
     }
   }
 
-  //For unit testing.
+  /** For unit testing. */
   int getThreadLocalCacheRefCountFor(final DN dn)
   {
     final LinkedList<DNLockHolder> cache = threadLocalCache.get();
@@ -522,7 +514,7 @@
     return lockTable[dnHashCode & numberOfBuckets - 1];
   }
 
-  /*
+  /**
    * Ensure that the number of buckets is a power of 2 in order to make it easier to map hash codes
    * to bucket indexes.
    */
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/Modification.java b/opendj-server-legacy/src/main/java/org/opends/server/types/Modification.java
index adab163..3cb727d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/Modification.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/Modification.java
@@ -12,7 +12,7 @@
  * information: "Portions Copyright [year] [name of copyright owner]".
  *
  * Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2014-2015 ForgeRock AS.
+ * Portions Copyright 2014-2016 ForgeRock AS.
  */
 package org.opends.server.types;
 
@@ -197,7 +197,7 @@
    *
    * @param  buffer  The buffer to which the information should be appended.
    */
-  public void toString(StringBuilder buffer)
+  private void toString(StringBuilder buffer)
   {
     buffer.append("Modification(").append(modificationType).append(", ").append(attribute);
   }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/NamedCharacterSet.java b/opendj-server-legacy/src/main/java/org/opends/server/types/NamedCharacterSet.java
index 58b4ec0..62eb191 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/NamedCharacterSet.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/NamedCharacterSet.java
@@ -12,24 +12,20 @@
  * information: "Portions Copyright [year] [name of copyright owner]".
  *
  * Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2014-2015 ForgeRock AS.
+ * Portions Copyright 2014-2016 ForgeRock AS.
  */
 package org.opends.server.types;
 
-import org.forgerock.i18n.LocalizableMessage;
-
-
 import java.security.SecureRandom;
 import java.util.Random;
 import java.util.SortedSet;
 
+import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.opendj.config.server.ConfigException;
 
 import static org.opends.messages.UtilityMessages.*;
 import static org.opends.server.util.StaticUtils.*;
 
-
-
 /**
  * This class provides a data structure that makes it possible to
  * associate a name with a given set of characters.  The name must
@@ -44,10 +40,8 @@
 {
   /** The characters contained in this character set. */
   private final char[] characters;
-
   /** The random number generator to use with this character set. */
   private final Random random;
-
   /** The name assigned to this character set. */
   private final String name;
 
@@ -63,7 +57,7 @@
    * @throws  ConfigException  If the provided name contains one or
    *                           more illegal characters.
    */
-  public NamedCharacterSet(String name, char[] characters)
+  private NamedCharacterSet(String name, char[] characters)
          throws ConfigException
   {
     this(name, characters, new SecureRandom());
@@ -83,7 +77,7 @@
    * @throws  ConfigException  If the provided name contains one or
    *                           more illegal characters.
    */
-  public NamedCharacterSet(String name, char[] characters,
+  private NamedCharacterSet(String name, char[] characters,
                            Random random)
          throws ConfigException
   {
@@ -172,22 +166,6 @@
     }
   }
 
-
-
-  /**
-   * Encodes this character set to a form suitable for use in the
-   * value of a configuration attribute.
-   *
-   * @return  The encoded character set in a form suitable for use in
-   *          the value of a configuration attribute.
-   */
-  public String encode()
-  {
-    return name + ":" + new String(characters);
-  }
-
-
-
   /**
    * Decodes the values of the provided configuration attribute as a
    * set of character set definitions.
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/SubEntry.java b/opendj-server-legacy/src/main/java/org/opends/server/types/SubEntry.java
index 193c256..d1bfb55 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/SubEntry.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/SubEntry.java
@@ -41,7 +41,7 @@
    * that already contain one or more real values for the associated
    * collective attribute.
    */
-  public static enum CollectiveConflictBehavior {
+  public enum CollectiveConflictBehavior {
     /**
      * Indicates that the virtual attribute provider is to preserve
      * any real values contained in the entry and merge them with the
@@ -83,34 +83,34 @@
   }
 
   /** The lowercased name of the "collectiveConflictBehavior" attribute type. */
-  public static final String ATTR_COLLECTIVE_CONFLICT_BEHAVIOR_LC = "collectiveconflictbehavior";
+  private static final String ATTR_COLLECTIVE_CONFLICT_BEHAVIOR_LC = "collectiveconflictbehavior";
   /** The lowercased name of the "inheritFromDNAttribute" attribute type. */
-  public static final String ATTR_INHERIT_COLLECTIVE_FROM_DN_LC = "inheritfromdnattribute";
+  private static final String ATTR_INHERIT_COLLECTIVE_FROM_DN_LC = "inheritfromdnattribute";
   /** The lowercased name of the "inheritFromRDNAttribute" attribute type. */
-  public static final String ATTR_INHERIT_COLLECTIVE_FROM_RDN_LC = "inheritfromrdnattribute";
+  private static final String ATTR_INHERIT_COLLECTIVE_FROM_RDN_LC = "inheritfromrdnattribute";
   /** The lowercased name of the "inheritFromRDNType" attribute type. */
-  public static final String ATTR_INHERIT_COLLECTIVE_FROM_RDN_TYPE_LC = "inheritfromrdntype";
+  private static final String ATTR_INHERIT_COLLECTIVE_FROM_RDN_TYPE_LC = "inheritfromrdntype";
   /** The lowercased name of the "inheritFromBaseRDN" attribute type. */
-  public static final String ATTR_INHERIT_COLLECTIVE_FROM_BASE_LC = "inheritfrombaserdn";
+  private static final String ATTR_INHERIT_COLLECTIVE_FROM_BASE_LC = "inheritfrombaserdn";
   /** The lowercased name of the "inheritAttribute" attribute type. */
-  public static final String ATTR_INHERIT_COLLECTIVE_ATTR_LC = "inheritattribute";
+  private static final String ATTR_INHERIT_COLLECTIVE_ATTR_LC = "inheritattribute";
   /** Attribute option to mark attributes collective. */
   private static final String ATTR_OPTION_COLLECTIVE = "collective";
 
   /** Entry object. */
-  private Entry entry;
+  private final Entry entry;
 
   /** Subtree specification. */
   private final SubtreeSpecification subTreeSpec;
 
   /** Collective subentry flag. */
-  private boolean isCollective;
+  private final boolean isCollective;
   /** Inherited collective subentry flag. */
-  private boolean isInheritedCollective;
+  private final boolean isInheritedCollective;
   /** Inherited collective from DN subentry flag. */
-  private boolean isInheritedFromDNCollective;
+  private final boolean isInheritedFromDNCollective;
   /** Inherited collective from RDN subentry flag. */
-  private boolean isInheritedFromRDNCollective;
+  private final boolean isInheritedFromRDNCollective;
 
   /** Inherited collective DN attribute type. */
   private AttributeType inheritFromDNType;
@@ -118,7 +118,6 @@
   private AttributeType inheritFromRDNAttrType;
   /** Inherited collective RDN type attribute type. */
   private AttributeType inheritFromRDNType;
-
   /** Inherited collective RDN attribute value. */
   private ByteString inheritFromRDNAttrValue;
   /** Inherited collective from DN value. */
@@ -152,6 +151,11 @@
       this.isInheritedFromDNCollective = entry.isInheritedFromDNCollectiveAttributeSubentry();
       this.isInheritedFromRDNCollective = entry.isInheritedFromRDNCollectiveAttributeSubentry();
     }
+    else
+    {
+      this.isInheritedFromDNCollective = false;
+      this.isInheritedFromRDNCollective = false;
+    }
 
     // Process collective attributes.
     if (this.isCollective)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/SubtreeSpecification.java b/opendj-server-legacy/src/main/java/org/opends/server/types/SubtreeSpecification.java
index 0ce5dad..4e41611 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/SubtreeSpecification.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/SubtreeSpecification.java
@@ -68,7 +68,7 @@
    * refinement filters entries based on all of the underlying
    * refinements being <code>true</code>.
    */
-  public static final class AndRefinement extends Refinement
+  private static final class AndRefinement extends Refinement
   {
     /** The set of refinements which must all be true. */
     private final Collection<Refinement> refinementSet;
@@ -80,7 +80,7 @@
      *          The set of refinements which must all be
      *          <code>true</code>.
      */
-    public AndRefinement(final Collection<Refinement> refinementSet)
+    private AndRefinement(final Collection<Refinement> refinementSet)
     {
       this.refinementSet = refinementSet;
     }
@@ -165,7 +165,7 @@
      * @param filter
      *          The search filter.
      */
-    public FilterRefinement(final SearchFilter filter)
+    private FilterRefinement(final SearchFilter filter)
     {
       this.filter = filter;
     }
@@ -221,7 +221,7 @@
    * refinement filters entries based on the presence of a specified
    * object class.
    */
-  public static final class ItemRefinement extends Refinement
+  private static final class ItemRefinement extends Refinement
   {
     /** The item's object class. */
     private final String objectClass;
@@ -235,7 +235,7 @@
      * @param objectClass
      *          The item's object class.
      */
-    public ItemRefinement(final String objectClass)
+    private ItemRefinement(final String objectClass)
     {
       this.objectClass = objectClass;
       this.normalizedObjectClass = StaticUtils
@@ -289,7 +289,7 @@
    * being <code>false</code>
    * .
    */
-  public static final class NotRefinement extends Refinement
+  private static final class NotRefinement extends Refinement
   {
     /** The inverted refinement. */
     private final Refinement refinement;
@@ -300,7 +300,7 @@
      * @param refinement
      *          The refinement which must be <code>false</code>.
      */
-    public NotRefinement(final Refinement refinement)
+    private NotRefinement(final Refinement refinement)
     {
       this.refinement = refinement;
     }
@@ -348,7 +348,7 @@
    * refinement filters entries based on at least one of the
    * underlying refinements being <code>true</code>.
    */
-  public static final class OrRefinement extends Refinement
+  private static final class OrRefinement extends Refinement
   {
     /** The set of refinements of which at least one must be true. */
     private final Collection<Refinement> refinementSet;
@@ -360,7 +360,7 @@
      *          The set of refinements of which at least one must be
      *          <code>true</code>.
      */
-    public OrRefinement(final Collection<Refinement> refinementSet)
+    private OrRefinement(final Collection<Refinement> refinementSet)
     {
       this.refinementSet = refinementSet;
     }
@@ -434,7 +434,7 @@
   }
 
   /** Abstract interface for RFC3672 specification filter refinements. */
-  public static abstract class Refinement
+  private static abstract class Refinement
   {
     /** Create a new RFC3672 specification filter refinement. */
     protected Refinement()
@@ -481,39 +481,39 @@
    * Internal utility class which can be used by sub-classes to help
    * parse string representations.
    */
-  protected static final class Parser
+  private static final class Parser
   {
     /** Text scanner used to parse the string value. */
     private final Scanner scanner;
 
     /** Pattern used to detect left braces. */
-    private static Pattern LBRACE = Pattern.compile("\\{.*");
+    private static final Pattern LBRACE = Pattern.compile("\\{.*");
     /** Pattern used to parse left braces. */
-    private static Pattern LBRACE_TOKEN = Pattern.compile("\\{");
+    private static final Pattern LBRACE_TOKEN = Pattern.compile("\\{");
     /** Pattern used to detect right braces. */
-    private static Pattern RBRACE = Pattern.compile("\\}.*");
+    private static final Pattern RBRACE = Pattern.compile("\\}.*");
     /** Pattern used to parse right braces. */
-    private static Pattern RBRACE_TOKEN = Pattern.compile("\\}");
+    private static final Pattern RBRACE_TOKEN = Pattern.compile("\\}");
     /** Pattern used to detect comma separators. */
-    private static Pattern SEP = Pattern.compile(",.*");
+    private static final Pattern SEP = Pattern.compile(",.*");
     /** Pattern used to parse comma separators. */
-    private static Pattern SEP_TOKEN = Pattern.compile(",");
+    private static final Pattern SEP_TOKEN = Pattern.compile(",");
     /** Pattern used to detect colon separators. */
-    private static Pattern COLON = Pattern.compile(":.*");
+    private static final Pattern COLON = Pattern.compile(":.*");
     /** Pattern used to parse colon separators. */
-    private static Pattern COLON_TOKEN = Pattern.compile(":");
+    private static final Pattern COLON_TOKEN = Pattern.compile(":");
     /** Pattern used to detect integer values. */
-    private static Pattern INT = Pattern.compile("\\d.*");
+    private static final Pattern INT = Pattern.compile("\\d.*");
     /** Pattern used to parse integer values. */
-    private static Pattern INT_TOKEN = Pattern.compile("\\d+");
+    private static final Pattern INT_TOKEN = Pattern.compile("\\d+");
     /** Pattern used to detect name values. */
-    private static Pattern NAME = Pattern.compile("[\\w_;-].*");
+    private static final Pattern NAME = Pattern.compile("[\\w_;-].*");
     /** Pattern used to parse name values. */
-    private static Pattern NAME_TOKEN = Pattern.compile("[\\w_;-]+");
+    private static final Pattern NAME_TOKEN = Pattern.compile("[\\w_;-]+");
     /** Pattern used to detect RFC3641 string values. */
-    private static Pattern STRING_VALUE = Pattern.compile("\".*");
+    private static final Pattern STRING_VALUE = Pattern.compile("\".*");
     /** Pattern used to parse RFC3641 string values. */
-    private static Pattern STRING_VALUE_TOKEN = Pattern
+    private static final Pattern STRING_VALUE_TOKEN = Pattern
         .compile("\"([^\"]|(\"\"))*\"");
 
     /**
@@ -522,7 +522,7 @@
      * @param value
      *          The subtree specification string value.
      */
-    public Parser(final String value)
+    private Parser(final String value)
     {
       this.scanner = new Scanner(value);
     }
@@ -533,7 +533,7 @@
      * @return <code>true</code> if and only if there are remaining
      *         tokens.
      */
-    public boolean hasNext()
+    private boolean hasNext()
     {
       return scanner.hasNext();
     }
@@ -544,7 +544,7 @@
      * @return <code>true</code> if and only if the next token is a
      *         valid right brace character.
      */
-    public boolean hasNextRightBrace()
+    private boolean hasNextRightBrace()
     {
       return scanner.hasNext(RBRACE);
     }
@@ -560,7 +560,7 @@
      * @throws NoSuchElementException
      *           If input is exhausted.
      */
-    public int nextInt() throws InputMismatchException,
+    private int nextInt() throws InputMismatchException,
         NoSuchElementException
     {
       final String s = nextValue(INT, INT_TOKEN);
@@ -576,7 +576,7 @@
      * @throws NoSuchElementException
      *           If input is exhausted.
      */
-    public String nextKey() throws InputMismatchException,
+    private String nextKey() throws InputMismatchException,
         NoSuchElementException
     {
       return StaticUtils.toLowerCase(scanner.next());
@@ -594,7 +594,7 @@
      * @throws NoSuchElementException
      *           If input is exhausted.
      */
-    public String nextName() throws InputMismatchException,
+    private String nextName() throws InputMismatchException,
         NoSuchElementException
     {
       return nextValue(NAME, NAME_TOKEN);
@@ -617,7 +617,7 @@
      *           If an error occurred when attempting to parse a
      *           DN value.
      */
-    public void nextSpecificExclusions(final Set<DN> chopBefore,
+    private void nextSpecificExclusions(final Set<DN> chopBefore,
         final Set<DN> chopAfter) throws InputMismatchException,
         NoSuchElementException, DirectoryException
     {
@@ -678,7 +678,7 @@
      * @throws NoSuchElementException
      *           If input is exhausted.
      */
-    public String nextStringValue() throws InputMismatchException,
+    private String nextStringValue() throws InputMismatchException,
         NoSuchElementException
     {
       final String s = nextValue(STRING_VALUE, STRING_VALUE_TOKEN);
@@ -693,7 +693,7 @@
      * @throws NoSuchElementException
      *           If input is exhausted.
      */
-    public void skipColon() throws InputMismatchException,
+    private void skipColon() throws InputMismatchException,
         NoSuchElementException
     {
       nextValue(COLON, COLON_TOKEN);
@@ -707,7 +707,7 @@
      * @throws NoSuchElementException
      *           If input is exhausted.
      */
-    public void skipLeftBrace() throws InputMismatchException,
+    private void skipLeftBrace() throws InputMismatchException,
         NoSuchElementException
     {
       nextValue(LBRACE, LBRACE_TOKEN);
@@ -721,7 +721,7 @@
      * @throws NoSuchElementException
      *           If input is exhausted.
      */
-    public void skipRightBrace() throws InputMismatchException,
+    private void skipRightBrace() throws InputMismatchException,
         NoSuchElementException
     {
       nextValue(RBRACE, RBRACE_TOKEN);
@@ -735,7 +735,7 @@
      * @throws NoSuchElementException
      *           If input is exhausted.
      */
-    public void skipSeparator() throws InputMismatchException,
+    private void skipSeparator() throws InputMismatchException,
         NoSuchElementException
     {
       nextValue(SEP, SEP_TOKEN);
@@ -1038,13 +1038,11 @@
 
   /** Optional set of chop before absolute DNs (mapping to their local-names). */
   private final Map<DN, DN> chopBefore;
-
   /** Optional set of chop after absolute DNs (mapping to their local-names). */
   private final Map<DN, DN> chopAfter;
 
   /** The root DN. */
   private final DN rootDN;
-
   /** The optional relative base DN. */
   private final DN relativeBaseDN;
 
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/VirtualAttributeRule.java b/opendj-server-legacy/src/main/java/org/opends/server/types/VirtualAttributeRule.java
index 59f7112..eb85b57 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/VirtualAttributeRule.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/VirtualAttributeRule.java
@@ -25,9 +25,9 @@
 import org.forgerock.opendj.ldap.DN;
 import org.forgerock.opendj.ldap.SearchScope;
 import org.forgerock.opendj.ldap.schema.AttributeType;
-import org.forgerock.util.Utils;
 import org.forgerock.opendj.server.config.meta.VirtualAttributeCfgDefn;
 import org.forgerock.opendj.server.config.server.VirtualAttributeCfg;
+import org.forgerock.util.Utils;
 import org.opends.server.api.Group;
 import org.opends.server.api.VirtualAttributeProvider;
 import org.opends.server.core.DirectoryServer;
@@ -208,34 +208,14 @@
     // potentially most expensive are done last.  First, check to see
     // if real values should override virtual ones and if so whether
     // the entry already has virtual values.
-    if (conflictBehavior == VirtualAttributeCfgDefn.ConflictBehavior.
-                                REAL_OVERRIDES_VIRTUAL
-        && entry.hasAttribute(attributeType))
-    {
-      return false;
-    }
-
-    // If there are any base DNs defined, then the entry must be below one of them.
-    if (!baseDNs.isEmpty() && !matchesAnyBaseDN(entry.getName()))
-    {
-      return false;
-    }
-
-    // If there are any search filters defined, then the entry must match one of them.
-    if (!filters.isEmpty() && !matchesAnyFilter(entry))
-    {
-      return false;
-    }
-
-    // If there are any group memberships defined, then the entry must
-    // be a member of one of them.
-    if (!groupDNs.isEmpty() && !isMemberOfAnyGroup(entry))
-    {
-      return false;
-    }
-
-    // If we've gotten here, then the rule is applicable.
-    return true;
+    return (conflictBehavior != VirtualAttributeCfgDefn.ConflictBehavior.REAL_OVERRIDES_VIRTUAL
+            || !entry.hasAttribute(attributeType))
+        // If there are any base DNs defined, then the entry must be below one of them.
+        && (baseDNs.isEmpty() || matchesAnyBaseDN(entry.getName()))
+        // If there are any search filters defined, then the entry must match one of them.
+        && (filters.isEmpty() || matchesAnyFilter(entry))
+        // If there are any group memberships defined, then the entry must be a member of one of them.
+        && (groupDNs.isEmpty() || isMemberOfAnyGroup(entry));
   }
 
   private boolean matchesAnyBaseDN(DN entryDN)
@@ -303,7 +283,7 @@
    *
    * @param  buffer  The buffer to which the information should be written.
    */
-  public void toString(StringBuilder buffer)
+  private void toString(StringBuilder buffer)
   {
     buffer.append("VirtualAttributeRule(attrType=");
     buffer.append(attributeType.getNameOrOID());
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/BackupManager.java b/opendj-server-legacy/src/main/java/org/opends/server/util/BackupManager.java
index 890ca68..86d9ac0 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/BackupManager.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/util/BackupManager.java
@@ -82,9 +82,7 @@
 {
   private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
 
-  /**
-   * The common prefix for archive files.
-   */
+  /** The common prefix for archive files. */
   private static final String BACKUP_BASE_FILENAME = "backup-";
 
   /**
@@ -99,7 +97,6 @@
    */
   private static final String PROPERTY_LAST_LOGFILE_SIZE = "last_logfile_size";
 
-
   /**
    * The name of the entry in an incremental backup archive file
    * containing a list of log files that are unchanged since the
@@ -113,10 +110,7 @@
    */
   private static final String ZIPENTRY_EMPTY_PLACEHOLDER = "empty.placeholder";
 
-
-  /**
-   * The backend ID.
-   */
+  /** The backend ID. */
   private final String backendID;
 
   /**
@@ -258,13 +252,11 @@
         throw new DirectoryException(DirectoryServer.getServerErrorResultCode(), message, e);
       }
     }
-
   }
 
   /** Represents the cryptographic engine with no hash used for a backup. */
   private static final class NoHashCryptoEngine extends CryptoEngine
   {
-
     NoHashCryptoEngine(boolean shouldEncrypt)
     {
       super(shouldEncrypt);
@@ -294,12 +286,9 @@
       // check never fails because bytes are always null
       return null;
     }
-
   }
 
-  /**
-   * Represents the cryptographic engine with signed hash.
-   */
+  /** Represents the cryptographic engine with signed hash. */
   private static final class MacCryptoEngine extends CryptoEngine
   {
     private Mac mac;
@@ -328,7 +317,7 @@
     private MacCryptoEngine(BackupInfo backupInfo) throws DirectoryException
     {
       super(backupInfo.isEncrypted());
-      HashMap<String,String> backupProperties = backupInfo.getBackupProperties();
+      Map<String, String> backupProperties = backupInfo.getBackupProperties();
       String macKeyID = backupProperties.get(BACKUP_PROPERTY_MAC_KEY_ID);
       retrieveMacEngine(macKeyID);
     }
@@ -346,14 +335,12 @@
       }
     }
 
-    /** {@inheritDoc} */
     @Override
     void updateHashWith(String s)
     {
       mac.update(getBytes(s));
     }
 
-    /** {@inheritDoc} */
     @Override
     void updateHashWith(byte[] buffer, int offset, int len)
     {
@@ -383,7 +370,6 @@
     {
       return "MacCryptoEngine [mac=" + mac + "]";
     }
-
   }
 
   /** Represents the cryptographic engine with unsigned hash used for a backup. */
@@ -404,7 +390,7 @@
     private DigestCryptoEngine(BackupInfo backupInfo) throws DirectoryException
     {
       super(backupInfo.isEncrypted());
-      HashMap<String, String> backupProperties = backupInfo.getBackupProperties();
+      Map<String, String> backupProperties = backupInfo.getBackupProperties();
       String digestAlgorithm = backupProperties.get(BACKUP_PROPERTY_DIGEST_ALGORITHM);
       digest = retrieveMessageDigest(digestAlgorithm);
     }
@@ -423,28 +409,24 @@
       }
     }
 
-    /** {@inheritDoc} */
     @Override
     public void updateHashWith(String s)
     {
       digest.update(getBytes(s));
     }
 
-    /** {@inheritDoc} */
     @Override
     public void updateHashWith(byte[] buffer, int offset, int len)
     {
       digest.update(buffer, offset, len);
     }
 
-    /** {@inheritDoc} */
     @Override
     public byte[] generateBytes()
     {
       return digest.digest();
     }
 
-    /** {@inheritDoc} */
     @Override
     LocalizableMessage getErrorMessageForCheck(String backupID)
     {
@@ -456,12 +438,9 @@
     {
       return "DigestCryptoEngine [digest=" + digest + "]";
     }
-
   }
 
-  /**
-   * Contains all parameters for creation of a new backup.
-   */
+  /** Contains all parameters for creation of a new backup. */
   private static final class NewBackupParams
   {
     final String backupID;
@@ -520,12 +499,10 @@
     {
       return "BackupCreationParams [backupID=" + backupID + ", backupDir=" + backupDir.getPath() + "]";
     }
-
   }
 
   /** Represents a new backup archive. */
   private static final class NewBackupArchive {
-
     private final String archiveFilename;
 
     private String latestFileName;
@@ -545,7 +522,7 @@
       dependencies = new HashSet<>();
       if (backupParams.isIncremental)
       {
-        HashMap<String,String> properties = backupParams.baseBackupInfo.getBackupProperties();
+        Map<String, String> properties = backupParams.baseBackupInfo.getBackupProperties();
         latestFileName = properties.get(PROPERTY_LAST_LOGFILE_NAME);
         latestFileSize = Long.parseLong(properties.get(PROPERTY_LAST_LOGFILE_SIZE));
       }
@@ -613,12 +590,10 @@
       return "NewArchive [archive file=" + archiveFilename + ", latestFileName=" + latestFileName
           + ", backendID=" + backendID + "]";
     }
-
   }
 
   /** Represents an existing backup archive. */
   private static final class ExistingBackupArchive {
-
     private final String backupID;
     private final BackupDirectory backupDir;
     private final BackupInfo backupInfo;
@@ -700,12 +675,10 @@
 
       return archiveFile.delete();
     }
-
   }
 
   /** Represents a writer of a backup archive. */
   private static final class BackupArchiveWriter implements Closeable {
-
     private final ZipOutputStream zipOutputStream;
     private final NewBackupArchive archive;
     private final CryptoEngine cryptoEngine;
@@ -745,10 +718,8 @@
 
       cryptoMethod.updateHashWith(relativePath);
 
-      InputStream inputStream = null;
       long totalBytesRead = 0;
-      try {
-        inputStream = new FileInputStream(file.toFile());
+      try (InputStream inputStream = new FileInputStream(file.toFile())) {
         byte[] buffer = new byte[8192];
         int bytesRead = inputStream.read(buffer);
         while (bytesRead > 0 && !backupConfig.isCancelled())
@@ -759,9 +730,6 @@
           bytesRead = inputStream.read(buffer);
         }
       }
-      finally {
-        StaticUtils.close(inputStream);
-      }
 
       zipOutputStream.closeEntry();
       logger.info(NOTE_BACKUP_ARCHIVED_FILE, zipEntry.getName());
@@ -824,7 +792,6 @@
      * <p>
      * The unchanged files names are listed in the "unchanged.txt" file, which
      * is put in the archive.
-     *
      */
     void writeUnchangedFiles(Path rootDirectory, ListIterator<Path> files, BackupConfig backupConfig)
         throws DirectoryException
@@ -869,9 +836,7 @@
       archive.addBaseBackupAsDependency();
     }
 
-    /**
-     * Writes the new files in the archive.
-     */
+    /** Writes the new files in the archive. */
     void writeChangedFiles(Path rootDirectory, ListIterator<Path> files, BackupConfig backupConfig)
         throws DirectoryException
     {
@@ -957,12 +922,10 @@
       return "BackupArchiveWriter [archive file=" + archive.getArchiveFilename() + ", backendId="
           + archive.getBackendID() + "]";
     }
-
   }
 
   /** Represents a reader of a backup archive. */
   private static final class BackupArchiveReader {
-
     private final CryptoEngine cryptoEngine;
     private final File archiveFile;
     private final String identifier;
@@ -998,10 +961,8 @@
     Set<String> readUnchangedDependentFiles() throws DirectoryException
     {
       Set<String> hashSet = new HashSet<>();
-      ZipInputStream zipStream = null;
-      try
+      try (ZipInputStream zipStream = openZipStream())
       {
-        zipStream = openZipStream();
 
         // Iterate through the entries in the zip file.
         ZipEntry zipEntry = zipStream.getNextEntry();
@@ -1023,9 +984,6 @@
         throw new DirectoryException(DirectoryServer.getServerErrorResultCode(), ERR_BACKUP_CANNOT_RESTORE.get(
             identifier, stackTraceToSingleLineString(e)), e);
       }
-      finally {
-        StaticUtils.close(zipStream);
-      }
     }
 
     /**
@@ -1046,7 +1004,7 @@
     {
       try
       {
-        restoreArchive0(restoreDir, filesToRestore, restoreConfig, backupable);
+        restoreArchive0(restoreDir, filesToRestore, restoreConfig);
       }
       catch (IOException e)
       {
@@ -1060,13 +1018,11 @@
       cryptoEngine.check(hash, backupInfo.getBackupID());
     }
 
-    private void restoreArchive0(Path restoreDir, Set<String> filesToRestore, RestoreConfig restoreConfig,
-        Backupable backupable) throws DirectoryException, IOException {
-
-      ZipInputStream zipStream = null;
-      try {
-          zipStream = openZipStream();
-
+    private void restoreArchive0(Path restoreDir, Set<String> filesToRestore, RestoreConfig restoreConfig)
+        throws DirectoryException, IOException
+    {
+      try (ZipInputStream zipStream = openZipStream())
+      {
           ZipEntry zipEntry = zipStream.getNextEntry();
           while (zipEntry != null && !restoreConfig.isCancelled())
           {
@@ -1093,9 +1049,6 @@
             zipEntry = zipStream.getNextEntry();
           }
       }
-      finally {
-        StaticUtils.close(zipStream);
-      }
     }
 
     /**
@@ -1127,9 +1080,7 @@
       return Pair.of(false, null);
     }
 
-    /**
-     * Restores a zip entry virtually (no actual write on disk).
-     */
+    /** Restores a zip entry virtually (no actual write on disk). */
     private void restoreZipEntryVirtual(String zipEntryName, ZipInputStream zipStream, RestoreConfig restoreConfig)
             throws FileNotFoundException, IOException
     {
@@ -1141,27 +1092,19 @@
       restoreFile(zipStream, null, restoreConfig);
     }
 
-    /**
-     * Restores a zip entry with actual write on disk.
-     */
+    /** Restores a zip entry with actual write on disk. */
     private void restoreZipEntry(String zipEntryName, ZipInputStream zipStream, Path restoreDir,
         RestoreConfig restoreConfig) throws IOException, DirectoryException
     {
-      OutputStream outputStream = null;
-      long totalBytesRead = 0;
-      try
+      Path fileToRestore = restoreDir.resolve(zipEntryName);
+      ensureFileCanBeRestored(fileToRestore);
+
+      try (OutputStream outputStream = new FileOutputStream(fileToRestore.toFile()))
       {
-        Path fileToRestore = restoreDir.resolve(zipEntryName);
-        ensureFileCanBeRestored(fileToRestore);
-        outputStream = new FileOutputStream(fileToRestore.toFile());
         cryptoEngine.updateHashWith(zipEntryName);
-        totalBytesRead = restoreFile(zipStream, outputStream, restoreConfig);
+        long totalBytesRead = restoreFile(zipStream, outputStream, restoreConfig);
         logger.info(NOTE_BACKUP_RESTORED_FILE, zipEntryName, totalBytesRead);
       }
-      finally
-      {
-        StaticUtils.close(outputStream);
-      }
     }
 
     private void ensureFileCanBeRestored(Path fileToRestore) throws DirectoryException
@@ -1265,13 +1208,10 @@
     final CryptoEngine cryptoEngine = CryptoEngine.forCreation(backupConfig, backupParams);
     final NewBackupArchive newArchive = new NewBackupArchive(backendID, backupParams, cryptoEngine);
 
-    BackupArchiveWriter archiveWriter = null;
-    try
+    final ListIterator<Path> files = backupable.getFilesToBackup();
+    final Path rootDirectory = backupable.getDirectory().toPath();
+    try (BackupArchiveWriter archiveWriter = new BackupArchiveWriter(newArchive))
     {
-      final ListIterator<Path> files = backupable.getFilesToBackup();
-      final Path rootDirectory = backupable.getDirectory().toPath();
-      archiveWriter = new BackupArchiveWriter(newArchive);
-
       if (files.hasNext())
       {
         if (backupParams.isIncremental) {
@@ -1283,9 +1223,11 @@
         archiveWriter.writeEmptyPlaceHolder();
       }
     }
-    finally
+    catch (IOException e)
     {
-      closeArchiveWriter(archiveWriter, newArchive.getArchiveFilename(), backupParams.backupDir.getPath());
+      logger.traceException(e);
+      throw new DirectoryException(DirectoryServer.getServerErrorResultCode(), ERR_BACKUP_CANNOT_CLOSE_ZIP_STREAM.get(
+          newArchive.getArchiveFilename(), backupParams.backupDir.getPath(), stackTraceToSingleLineString(e)), e);
     }
 
     newArchive.updateBackupDirectory();
@@ -1617,5 +1559,4 @@
     }
     return highestNumber;
   }
-
 }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/BuildVersion.java b/opendj-server-legacy/src/main/java/org/opends/server/util/BuildVersion.java
index 98f6424..2af94a1 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/BuildVersion.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/util/BuildVersion.java
@@ -152,7 +152,7 @@
    * @param point
    *          Point release version number.
    */
-  public BuildVersion(final int major, final int minor, final int point)
+  private BuildVersion(final int major, final int minor, final int point)
   {
     this(major, minor, point, "");
   }
@@ -169,7 +169,7 @@
    * @param rev
    *          VCS revision.
    */
-  public BuildVersion(final int major, final int minor, final int point, final String rev)
+  private BuildVersion(final int major, final int minor, final int point, final String rev)
   {
     this.major = major;
     this.minor = minor;
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/EMailMessage.java b/opendj-server-legacy/src/main/java/org/opends/server/util/EMailMessage.java
index c3eb19a..f907cbb 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/EMailMessage.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/util/EMailMessage.java
@@ -19,6 +19,13 @@
 
 
 
+import static com.forgerock.opendj.cli.CommonArguments.*;
+
+import static org.opends.messages.ToolMessages.*;
+import static org.opends.messages.UtilityMessages.*;
+import static org.opends.server.util.ServerConstants.*;
+import static org.opends.server.util.StaticUtils.*;
+
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileReader;
@@ -41,21 +48,14 @@
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizableMessageBuilder;
-import org.opends.server.core.DirectoryServer;
 import org.forgerock.i18n.slf4j.LocalizedLogger;
+import org.opends.server.core.DirectoryServer;
 
 import com.forgerock.opendj.cli.ArgumentException;
 import com.forgerock.opendj.cli.ArgumentParser;
 import com.forgerock.opendj.cli.BooleanArgument;
 import com.forgerock.opendj.cli.StringArgument;
 
-import static org.opends.messages.ToolMessages.*;
-import static org.opends.messages.UtilityMessages.*;
-import static org.opends.server.util.ServerConstants.*;
-import static org.opends.server.util.StaticUtils.*;
-
-import static com.forgerock.opendj.cli.CommonArguments.*;
-
 
 
 /**
@@ -77,7 +77,7 @@
   private List<String> recipients;
 
   /** The set of attachments to include in this message. */
-  private LinkedList<MimeBodyPart> attachments;
+  private final List<MimeBodyPart> attachments;
 
   /** The MIME type for the message body. */
   private String bodyMIMEType;
@@ -91,29 +91,6 @@
   /** The body for the mail message. */
   private LocalizableMessageBuilder body;
 
-
-
-  /**
-   * Creates a new e-mail message with the provided information.
-   *
-   * @param  sender     The address of the sender for the message.
-   * @param  recipient  The address of the recipient for the message.
-   * @param  subject    The subject to use for the message.
-   */
-  public EMailMessage(String sender, String recipient, String subject)
-  {
-    this.sender  = sender;
-    this.subject = subject;
-
-    recipients = CollectionUtils.newArrayList(recipient);
-
-    body         = new LocalizableMessageBuilder();
-    attachments  = new LinkedList<>();
-    bodyMIMEType = "text/plain";
-  }
-
-
-
   /**
    * Creates a new e-mail message with the provided information.
    *
@@ -294,7 +271,7 @@
    *
    * @return  The set of attachments for this message.
    */
-  public LinkedList<MimeBodyPart> getAttachments()
+  public List<MimeBodyPart> getAttachments()
   {
     return attachments;
   }
@@ -339,7 +316,7 @@
    * @throws  MessagingException  If there is a problem of some type with the
    *                              attachment.
    */
-  public void addAttachment(File attachmentFile)
+  private void addAttachment(File attachmentFile)
          throws MessagingException
   {
     MimeBodyPart attachment = new MimeBodyPart();
@@ -383,7 +360,7 @@
    * @throws  MessagingException  If a problem occurred while attempting to send
    *                              the message.
    */
-  public void send(List<Properties> mailServerPropertySets)
+  private void send(List<Properties> mailServerPropertySets)
          throws MessagingException
   {
     // Get information about the available mail servers that we can use.
@@ -490,15 +467,11 @@
     // If we've gotten here, then we've tried all of the servers in the list and
     // still failed.  If we captured an earlier exception, then throw it.
     // Otherwise, throw a generic exception.
-    if (sendException == null)
-    {
-      LocalizableMessage message = ERR_EMAILMSG_CANNOT_SEND.get();
-      throw new MessagingException(message.toString());
-    }
-    else
+    if (sendException != null)
     {
       throw sendException;
     }
+    throw new MessagingException(ERR_EMAILMSG_CANNOT_SEND.get().toString());
   }
 
 
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java b/opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java
index bb47ed2..30a1047 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java
@@ -75,49 +75,38 @@
 
   /** The reader that will be used to read the data. */
   private BufferedReader reader;
-
   /** The import configuration that specifies what should be imported. */
-  protected LDIFImportConfig importConfig;
+  protected final LDIFImportConfig importConfig;
 
   /** The lines that comprise the body of the last entry read. */
   protected List<StringBuilder> lastEntryBodyLines;
-
-  /**
-   * The lines that comprise the header (DN and any comments) for the last entry
-   * read.
-   */
+  /** The lines that comprise the header (DN and any comments) for the last entry read. */
   protected List<StringBuilder> lastEntryHeaderLines;
 
-
   /**
    * The number of entries that have been ignored by this LDIF reader because
    * they didn't match the criteria.
    */
   private final AtomicLong entriesIgnored = new AtomicLong();
-
   /**
    * The number of entries that have been read by this LDIF reader, including
    * those that were ignored because they didn't match the criteria, and
    * including those that were rejected because they were invalid in some way.
    */
   protected final AtomicLong entriesRead = new AtomicLong();
-
   /** The number of entries that have been rejected by this LDIF reader. */
   private final AtomicLong entriesRejected = new AtomicLong();
 
   /** The line number on which the last entry started. */
   protected long lastEntryLineNumber = -1;
-
-  /**
-   * The line number of the last line read from the LDIF file, starting with 1.
-   */
+  /** The line number of the last line read from the LDIF file, starting with 1. */
   private long lineNumber;
 
   /**
    * The plugin config manager that will be used if we are to invoke plugins on
    * the entries as they are read.
    */
-  protected PluginConfigManager pluginConfigManager;
+  protected final PluginConfigManager pluginConfigManager;
 
   /**
    * Creates a new LDIF reader that will read information from the specified
@@ -265,6 +254,7 @@
         logToSkipWriter(lines, ERR_LDIF_SKIP.get(entryDN));
         return false;
       }
+      return true;
     }
     catch (Exception e)
     {
@@ -274,7 +264,6 @@
           ERR_LDIF_COULD_NOT_EVALUATE_FILTERS_FOR_IMPORT.get(entry.getName(), lastEntryLineNumber, e);
       throw new LDIFException(message, lastEntryLineNumber, true, e);
     }
-    return true;
   }
 
   private boolean invokeImportPlugins(Entry entry, LinkedList<StringBuilder> lines)
@@ -286,16 +275,10 @@
       if (!pluginResult.continueProcessing())
       {
         final DN entryDN = entry.getName();
-        LocalizableMessage m;
         LocalizableMessage rejectMessage = pluginResult.getErrorMessage();
-        if (rejectMessage == null)
-        {
-          m = ERR_LDIF_REJECTED_BY_PLUGIN_NOMESSAGE.get(entryDN);
-        }
-        else
-        {
-          m = ERR_LDIF_REJECTED_BY_PLUGIN.get(entryDN, rejectMessage);
-        }
+        LocalizableMessage m = rejectMessage != null
+            ? ERR_LDIF_REJECTED_BY_PLUGIN.get(entryDN, rejectMessage)
+            : ERR_LDIF_REJECTED_BY_PLUGIN_NOMESSAGE.get(entryDN);
 
         logToRejectWriter(lines, m);
         return false;
@@ -348,7 +331,7 @@
    * @param builders the list of AttributeBuilders
    * @return a new list of Attributes
    */
-  protected List<Attribute> toAttributesList(List<AttributeBuilder> builders)
+  private List<Attribute> toAttributesList(List<AttributeBuilder> builders)
   {
     List<Attribute> results = new ArrayList<>(builders.size());
     for (AttributeBuilder builder : builders)
@@ -397,47 +380,37 @@
       }
 
       String changeType = readChangeType(lines);
-
-      ChangeRecordEntry entry;
-
       if(changeType != null)
       {
-        if(changeType.equals("add"))
+        switch (changeType)
         {
-          entry = parseAddChangeRecordEntry(entryDN, lines);
-        } else if (changeType.equals("delete"))
-        {
-          entry = parseDeleteChangeRecordEntry(entryDN, lines);
-        } else if (changeType.equals("modify"))
-        {
-          entry = parseModifyChangeRecordEntry(entryDN, lines);
-        } else if (changeType.equals("modrdn"))
-        {
-          entry = parseModifyDNChangeRecordEntry(entryDN, lines);
-        } else if (changeType.equals("moddn"))
-        {
-          entry = parseModifyDNChangeRecordEntry(entryDN, lines);
-        } else
-        {
+        case "add":
+          return parseAddChangeRecordEntry(entryDN, lines);
+        case "delete":
+          return parseDeleteChangeRecordEntry(entryDN, lines);
+        case "modify":
+          return parseModifyChangeRecordEntry(entryDN, lines);
+        case "modrdn":
+          return parseModifyDNChangeRecordEntry(entryDN, lines);
+        case "moddn":
+          return parseModifyDNChangeRecordEntry(entryDN, lines);
+        default:
           LocalizableMessage message = ERR_LDIF_INVALID_CHANGETYPE_ATTRIBUTE.get(
               changeType, "add, delete, modify, moddn, modrdn");
           throw new LDIFException(message, lastEntryLineNumber, false);
         }
-      } else
-      {
-        // default to "add"?
-        if(defaultAdd)
-        {
-          entry = parseAddChangeRecordEntry(entryDN, lines);
-        } else
-        {
-          LocalizableMessage message = ERR_LDIF_INVALID_CHANGETYPE_ATTRIBUTE.get(
-              null, "add, delete, modify, moddn, modrdn");
-          throw new LDIFException(message, lastEntryLineNumber, false);
-        }
       }
-
-      return entry;
+      else if (defaultAdd)
+      {
+        // default to "add"
+        return parseAddChangeRecordEntry(entryDN, lines);
+      }
+      else
+      {
+        LocalizableMessage message =
+            ERR_LDIF_INVALID_CHANGETYPE_ATTRIBUTE.get(null, "add, delete, modify, moddn, modrdn");
+        throw new LDIFException(message, lastEntryLineNumber, false);
+      }
     }
   }
 
@@ -455,15 +428,14 @@
    */
   protected LinkedList<StringBuilder> readEntryLines() throws IOException, LDIFException
   {
-    // Read the entry lines into a buffer.
-    LinkedList<StringBuilder> lines = new LinkedList<>();
-    int lastLine = -1;
-
     if(reader == null)
     {
       return null;
     }
 
+    // Read the entry lines into a buffer.
+    LinkedList<StringBuilder> lines = new LinkedList<>();
+    int lastLine = -1;
     while (true)
     {
       String line = reader.readLine();
@@ -479,11 +451,7 @@
           break;
         }
         reader = importConfig.nextReader();
-        if (reader != null)
-        {
-          return readEntryLines();
-        }
-        return null;
+        return reader != null ? readEntryLines() : null;
       }
       else if (line.length() == 0)
       {
@@ -1034,11 +1002,7 @@
     }
   }
 
-
-
-  /**
-   * Closes this LDIF reader and the underlying file or input stream.
-   */
+  /** Closes this LDIF reader and the underlying file or input stream. */
   @Override
   public void close()
   {
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/SetupUtils.java b/opendj-server-legacy/src/main/java/org/opends/server/util/SetupUtils.java
index 4fe8e28..10cdc68 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/SetupUtils.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/util/SetupUtils.java
@@ -12,13 +12,17 @@
  * information: "Portions Copyright [year] [name of copyright owner]".
  *
  * Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011-2015 ForgeRock AS.
+ * Portions Copyright 2011-2016 ForgeRock AS.
  */
 package org.opends.server.util;
 
-import static org.forgerock.util.Utils.closeSilently;
-
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.net.ServerSocket;
 import java.net.Socket;
@@ -55,22 +59,6 @@
   public static final String OPENDJ_JAVA_ARGS = "OPENDJ_JAVA_ARGS";
 
   /**
-   * Java property used to know which are the jar files that must be downloaded
-   * lazily.  The current code in WebStartDownloader that uses this property
-   * assumes that the URL are separated with an space.
-   */
-  public static final String LAZY_JAR_URLS =
-      "org.opends.quicksetup.lazyjarurls";
-
-  /**
-   * Java property used to know which is the name of the zip file that must
-   * be unzipped and whose contents must be extracted during the Web Start
-   * based setup.
-   */
-  public static final String ZIP_FILE_NAME =
-      "org.opends.quicksetup.zipfilename";
-
-  /**
    * The relative path where all the libraries (jar files) are.
    */
   public static final String LIBRARIES_PATH_RELATIVE = "lib";
@@ -102,8 +90,6 @@
   public static final String URL_REPOSITORY = "URL Repository";
   /** The version qualifier. */
   public static final String VERSION_QUALIFIER = "Version Qualifier";
-  /** Incompatibilities found between builds (used by the upgrade tool). */
-  public static final String INCOMPATIBILITY_EVENTS = "Upgrade Event IDs";
   /** Fix IDs associated with the build. */
   public static final String FIX_IDS = "Fix IDs";
   /** Debug build identifier. */
@@ -221,16 +207,14 @@
       lines.add("description: This is the description for {cn}.");
     }
 
-    BufferedWriter writer = new BufferedWriter(new FileWriter(templateFile));
-    for (String line : lines)
+    try (BufferedWriter writer = new BufferedWriter(new FileWriter(templateFile)))
     {
-      writer.write(line);
-      writer.newLine();
+      for (String line : lines)
+      {
+        writer.write(line);
+        writer.newLine();
+      }
     }
-
-    writer.flush();
-    writer.close();
-
     return templateFile;
   }
 
@@ -243,11 +227,9 @@
    * @return {@code true} if the provided port is free and we can use it,
    * {@code false} otherwise.
    */
-  public static boolean canUseAsPort(String hostname, int port)
+  private static boolean canUseAsPort(String hostname, int port)
   {
-    boolean canUseAsPort = false;
-    ServerSocket serverSocket = null;
-    try
+    try (ServerSocket serverSocket = new ServerSocket())
     {
       InetSocketAddress socketAddress;
       if (hostname != null)
@@ -258,59 +240,29 @@
       {
         socketAddress = new InetSocketAddress(port);
       }
-      serverSocket = new ServerSocket();
       if (!OperatingSystem.isWindows())
       {
         serverSocket.setReuseAddress(true);
       }
       serverSocket.bind(socketAddress);
-      canUseAsPort = true;
-
       serverSocket.close();
 
       /* Try to create a socket because sometimes even if we can create a server
        * socket there is already someone listening to the port (is the case
        * of products as Sun DS 6.0).
        */
-      Socket s = null;
-      try
+      try (Socket s = new Socket())
       {
-        s = new Socket();
         s.connect(socketAddress, 1000);
-        canUseAsPort = false;
+        return false;
       } catch (Throwable t)
       {
       }
-      finally
-      {
-        if (s != null)
-        {
-          try
-          {
-            s.close();
-          }
-          catch (Throwable t)
-          {
-          }
-        }
-      }
+      return true;
     } catch (IOException ex)
     {
-      canUseAsPort = false;
-    } finally
-    {
-      try
-      {
-        if (serverSocket != null)
-        {
-          serverSocket.close();
-        }
-      } catch (Exception ex)
-      {
-      }
+      return false;
     }
-
-    return canUseAsPort;
   }
 
   /**
@@ -399,15 +351,10 @@
         certManager.getCertificate(alias != null ? alias : certManager.getCertificateAliases()[0]);
     byte[] certificateBytes = certificate.getEncoded();
 
-    FileOutputStream outputStream = new FileOutputStream(path, false);
-    try
+    try (FileOutputStream outputStream = new FileOutputStream(path, false))
     {
       outputStream.write(certificateBytes);
     }
-    finally
-    {
-      closeSilently(outputStream);
-    }
   }
 
 
@@ -475,10 +422,8 @@
   {
     String hostName = null;
     File f = new File(installationRoot + File.separator + HOST_NAME_FILE);
-    BufferedReader br = null;
-    try
+    try (BufferedReader br = new BufferedReader(new FileReader(f)))
     {
-      br = new BufferedReader(new FileReader(f));
       String s = br.readLine();
       s = s.trim();
 
@@ -491,10 +436,6 @@
     catch (IOException ioe)
     {
     }
-    finally
-    {
-      closeSilently(br);
-    }
     if (hostName == null)
     {
       hostName = lastReadHostName;
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/StaticUtils.java b/opendj-server-legacy/src/main/java/org/opends/server/util/StaticUtils.java
index 12ddc0b..6eb35c8 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/StaticUtils.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/util/StaticUtils.java
@@ -19,23 +19,17 @@
 import static org.opends.messages.UtilityMessages.*;
 import static org.opends.server.util.ServerConstants.*;
 
-import java.io.BufferedReader;
 import java.io.Closeable;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
 import java.io.UnsupportedEncodingException;
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.net.ServerSocket;
 import java.net.Socket;
 import java.nio.ByteBuffer;
-import java.nio.channels.SelectionKey;
-import java.nio.channels.Selector;
-import java.nio.channels.SocketChannel;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
@@ -48,7 +42,6 @@
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.RandomAccess;
 import java.util.TimeZone;
 
 import javax.naming.InitialContext;
@@ -66,7 +59,6 @@
 import org.forgerock.opendj.ldap.schema.AttributeType;
 import org.forgerock.util.Reject;
 import org.opends.messages.ToolMessages;
-import org.opends.server.api.ClientConnection;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.core.ServerContext;
 import org.opends.server.types.Attribute;
@@ -478,109 +470,6 @@
   }
 
   /**
-   * Appends a string representation of the remaining unread data in the
-   * provided byte buffer to the given buffer using the specified indent.
-   * The data will be formatted with sixteen hex bytes in a row followed by
-   * the ASCII representation, then wrapping to a new line as necessary.
-   * The state of the byte buffer is not changed.
-   *
-   * @param  buffer  The buffer to which the information is to be appended.
-   * @param  b       The byte buffer containing the data to write.
-   *                 The data from the position to the limit is written.
-   * @param  indent  The number of spaces to indent the output.
-   */
-  public static void byteArrayToHexPlusAscii(StringBuilder buffer, ByteBuffer b,
-                                             int indent)
-  {
-    StringBuilder indentBuf = new StringBuilder(indent);
-    for (int i=0 ; i < indent; i++)
-    {
-      indentBuf.append(' ');
-    }
-
-
-    int position = b.position();
-    int limit    = b.limit();
-    int length   = limit - position;
-    int pos      = 0;
-    while (length - pos >= 16)
-    {
-      StringBuilder asciiBuf = new StringBuilder(17);
-
-      byte currentByte = b.get();
-      buffer.append(indentBuf);
-      buffer.append(byteToHex(currentByte));
-      asciiBuf.append(byteToASCII(currentByte));
-      pos++;
-
-      for (int i=1; i < 16; i++, pos++)
-      {
-        currentByte = b.get();
-        buffer.append(' ');
-        buffer.append(byteToHex(currentByte));
-        asciiBuf.append(byteToASCII(currentByte));
-
-        if (i == 7)
-        {
-          buffer.append("  ");
-          asciiBuf.append(' ');
-        }
-      }
-
-      buffer.append("  ");
-      buffer.append(asciiBuf);
-      buffer.append(EOL);
-    }
-
-
-    int remaining = length - pos;
-    if (remaining > 0)
-    {
-      StringBuilder asciiBuf = new StringBuilder(remaining+1);
-
-      byte currentByte = b.get();
-      buffer.append(indentBuf);
-      buffer.append(byteToHex(currentByte));
-      asciiBuf.append(byteToASCII(currentByte));
-
-      for (int i=1; i < 16; i++)
-      {
-        buffer.append(' ');
-
-        if (i < remaining)
-        {
-          currentByte = b.get();
-          buffer.append(byteToHex(currentByte));
-          asciiBuf.append(byteToASCII(currentByte));
-        }
-        else
-        {
-          buffer.append("  ");
-        }
-
-        if (i == 7)
-        {
-          buffer.append("  ");
-
-          if (i < remaining)
-          {
-            asciiBuf.append(' ');
-          }
-        }
-      }
-
-      buffer.append("  ");
-      buffer.append(asciiBuf);
-      buffer.append(EOL);
-    }
-
-    b.position(position);
-    b.limit(limit);
-  }
-
-
-
-  /**
    * Compare two byte arrays for order. Returns a negative integer,
    * zero, or a positive integer as the first argument is less than,
    * equal to, or greater than the second.
@@ -622,69 +511,6 @@
     return a.length - a2.length;
   }
 
-
-
-  /**
-   * Indicates whether the two array lists are equal. They will be
-   * considered equal if they have the same number of elements, and
-   * the corresponding elements between them are equal (in the same
-   * order).
-   *
-   * @param list1
-   *          The first list for which to make the determination.
-   * @param list2
-   *          The second list for which to make the determination.
-   * @return {@code true} if the two array lists are equal, or
-   *         {@code false} if they are not.
-   */
-  public static boolean listsAreEqual(List<?> list1, List<?> list2)
-  {
-    if (list1 == null)
-    {
-      return list2 == null;
-    }
-    else if (list2 == null)
-    {
-      return false;
-    }
-
-    int numElements = list1.size();
-    if (numElements != list2.size())
-    {
-      return false;
-    }
-
-    // If either of the lists doesn't support random access, then fall back
-    // on their equals methods and go ahead and create some garbage with the
-    // iterators.
-    if (!(list1 instanceof RandomAccess) ||
-        !(list2 instanceof RandomAccess))
-    {
-      return list1.equals(list2);
-    }
-
-    // Otherwise we can just retrieve the elements efficiently via their index.
-    for (int i=0; i < numElements; i++)
-    {
-      Object o1 = list1.get(i);
-      Object o2 = list2.get(i);
-
-      if (o1 == null)
-      {
-        if (o2 != null)
-        {
-          return false;
-        }
-      }
-      else if (! o1.equals(o2))
-      {
-        return false;
-      }
-    }
-
-    return true;
-  }
-
   /**
    * Retrieves the best human-readable message for the provided exception.  For
    * exceptions defined in the OpenDJ project, it will attempt to use the
@@ -736,23 +562,6 @@
     return com.forgerock.opendj.util.StaticUtils.stackTraceToSingleLineString(t, DynamicConstants.DEBUG_BUILD);
   }
 
-
-
-  /**
-   * Appends a single-line string representation of the provided exception to
-   * the given buffer.
-   *
-   * @param  buffer  The buffer to which the information is to be appended.
-   * @param  t       The exception for which to retrieve the stack trace.
-   */
-  public static void stackTraceToSingleLineString(StringBuilder buffer,
-                                                  Throwable t)
-  {
-    com.forgerock.opendj.util.StaticUtils.stackTraceToSingleLineString(buffer, t, DynamicConstants.DEBUG_BUILD);
-  }
-
-
-
   /**
    * Retrieves a string representation of the stack trace for the provided
    * exception.
@@ -801,7 +610,7 @@
    * @param  buffer  The buffer to which the information is to be appended.
    * @param  t       The exception for which to retrieve the stack trace.
    */
-  public static void stackTraceToString(StringBuilder buffer, Throwable t)
+  private static void stackTraceToString(StringBuilder buffer, Throwable t)
   {
     if (t == null)
     {
@@ -1296,127 +1105,11 @@
    * @return  {@code true} if the use of the exec method should be allowed,
    *          or {@code false} if it should not be allowed.
    */
-  public static boolean mayUseExec()
+  private static boolean mayUseExec()
   {
     return !DirectoryServer.getEnvironmentConfig().disableExec();
   }
 
-
-
-  /**
-   * Executes the specified command on the system and captures its output.  This
-   * will not return until the specified process has completed.
-   *
-   * @param  command           The command to execute.
-   * @param  args              The set of arguments to provide to the command.
-   * @param  workingDirectory  The working directory to use for the command, or
-   *                           {@code null} if the default directory
-   *                           should be used.
-   * @param  environment       The set of environment variables that should be
-   *                           set when executing the command, or
-   *                           {@code null} if none are needed.
-   * @param  output            The output generated by the command while it was
-   *                           running.  This will include both standard
-   *                           output and standard error.  It may be
-   *                           {@code null} if the output does not need to
-   *                           be captured.
-   *
-   * @return  The exit code for the command.
-   *
-   * @throws  IOException  If an I/O problem occurs while trying to execute the
-   *                       command.
-   *
-   * @throws  SecurityException  If the security policy will not allow the
-   *                             command to be executed.
-   *
-   * @throws InterruptedException If the current thread is interrupted by
-   *                              another thread while it is waiting, then
-   *                              the wait is ended and an InterruptedException
-   *                              is thrown.
-   */
-  public static int exec(String command, String[] args, File workingDirectory,
-                         Map<String,String> environment, List<String> output)
-         throws IOException, SecurityException, InterruptedException
-  {
-    // See whether we'll allow the use of exec on this system.  If not, then
-    // throw an exception.
-    if (! mayUseExec())
-    {
-      throw new SecurityException(ERR_EXEC_DISABLED.get(command).toString());
-    }
-
-
-    ArrayList<String> commandAndArgs = new ArrayList<>();
-    commandAndArgs.add(command);
-    if (args != null && args.length > 0)
-    {
-      Collections.addAll(commandAndArgs, args);
-    }
-
-    ProcessBuilder processBuilder = new ProcessBuilder(commandAndArgs);
-    processBuilder.redirectErrorStream(true);
-
-    if (workingDirectory != null && workingDirectory.isDirectory())
-    {
-      processBuilder.directory(workingDirectory);
-    }
-
-    if (environment != null && !environment.isEmpty())
-    {
-      processBuilder.environment().putAll(environment);
-    }
-
-    Process process = processBuilder.start();
-
-    // We must exhaust stdout and stderr before calling waitfor. Since we
-    // redirected the error stream, we just have to read from stdout.
-    InputStream processStream =  process.getInputStream();
-    BufferedReader reader =
-        new BufferedReader(new InputStreamReader(processStream));
-    String line = null;
-
-    try
-    {
-      while((line = reader.readLine()) != null)
-      {
-        if(output != null)
-        {
-          output.add(line);
-        }
-      }
-    }
-    catch(IOException ioe)
-    {
-      // If this happens, then we have no choice but to forcefully terminate
-      // the process.
-      try
-      {
-        process.destroy();
-      }
-      catch (Exception e)
-      {
-        logger.traceException(e);
-      }
-
-      throw ioe;
-    }
-    finally
-    {
-      try
-      {
-        reader.close();
-      }
-      catch(IOException e)
-      {
-        logger.traceException(e);
-      }
-    }
-
-    return process.waitFor();
-  }
-
-
-
   /**
    * Indicates whether the provided string contains a name or OID for a schema
    * element like an attribute type or objectclass.
@@ -1716,7 +1409,7 @@
    * @param  buffer  The buffer to which the uppercase form of the string should
    *                 be appended.
    */
-  public static void toUpperCase(String s, StringBuilder buffer)
+  private static void toUpperCase(String s, StringBuilder buffer)
   {
     if (s == null)
     {
@@ -2024,29 +1717,6 @@
     return builder;
   }
 
-
-
-  /**
-   * Retrieves a string array containing the contents of the provided
-   * list of strings.
-   *
-   * @param stringList
-   *          The string list to convert to an array.
-   * @return A string array containing the contents of the provided list
-   *         of strings.
-   */
-  public static String[] listToArray(List<String> stringList)
-  {
-    if (stringList == null)
-    {
-      return null;
-    }
-
-    String[] stringArray = new String[stringList.size()];
-    stringList.toArray(stringArray);
-    return stringArray;
-  }
-
   /**
    * Retrieves an array list containing the contents of the provided array.
    *
@@ -2203,24 +1873,6 @@
     }
   }
 
-
-  /**
-   * Indicates whether the provided path refers to a relative path rather than
-   * an absolute path.
-   *
-   * @param  path  The path string for which to make the determination.
-   *
-   * @return  {@code true} if the provided path is relative, or
-   *          {@code false} if it is absolute.
-   */
-  public static boolean isRelativePath(String path)
-  {
-    File f = new File(path);
-    return !f.isAbsolute();
-  }
-
-
-
   /**
    * Retrieves a {@code File} object corresponding to the specified path.
    * If the given path is an absolute path, then it will be used.  If the path
@@ -2531,132 +2183,6 @@
 
   }
 
-
-
-  /**
-   * Writes the contents of the provided buffer to the client,
-   * terminating the connection if the write is unsuccessful for too
-   * long (e.g., if the client is unresponsive or there is a network
-   * problem). If possible, it will attempt to use the selector returned
-   * by the {@code ClientConnection.getWriteSelector} method, but it is
-   * capable of working even if that method returns {@code null}. <BR>
-   *
-   * Note that the original position and limit values will not be
-   * preserved, so if that is important to the caller, then it should
-   * record them before calling this method and restore them after it
-   * returns.
-   *
-   * @param clientConnection
-   *          The client connection to which the data is to be written.
-   * @param buffer
-   *          The data to be written to the client.
-   * @return {@code true} if all the data in the provided buffer was
-   *         written to the client and the connection may remain
-   *         established, or {@code false} if a problem occurred
-   *         and the client connection is no longer valid. Note that if
-   *         this method does return {@code false}, then it must
-   *         have already disconnected the client.
-   * @throws IOException
-   *           If a problem occurs while attempting to write data to the
-   *           client. The caller will be responsible for catching this
-   *           and terminating the client connection.
-   */
-  public static boolean writeWithTimeout(ClientConnection clientConnection,
-      ByteBuffer buffer) throws IOException
-  {
-    SocketChannel socketChannel = clientConnection.getSocketChannel();
-    long startTime = System.currentTimeMillis();
-    long waitTime = clientConnection.getMaxBlockedWriteTimeLimit();
-    if (waitTime <= 0)
-    {
-      // We won't support an infinite time limit, so fall back to using
-      // five minutes, which is a very long timeout given that we're
-      // blocking a worker thread.
-      waitTime = 300000L;
-    }
-
-    long stopTime = startTime + waitTime;
-
-    Selector selector = clientConnection.getWriteSelector();
-    if (selector == null)
-    {
-      // The client connection does not provide a selector, so we'll
-      // fall back
-      // to a more inefficient way that will work without a selector.
-      while (buffer.hasRemaining()
-          && System.currentTimeMillis() < stopTime)
-      {
-        if (socketChannel.write(buffer) < 0)
-        {
-          // The client connection has been closed.
-          return false;
-        }
-      }
-
-      if (buffer.hasRemaining())
-      {
-        // If we've gotten here, then the write timed out.
-        return false;
-      }
-
-      return true;
-    }
-
-    // Register with the selector for handling write operations.
-    SelectionKey key =
-        socketChannel.register(selector, SelectionKey.OP_WRITE);
-
-    try
-    {
-      selector.select(waitTime);
-      while (buffer.hasRemaining())
-      {
-        long currentTime = System.currentTimeMillis();
-        if (currentTime >= stopTime)
-        {
-          // We've been blocked for too long.
-          return false;
-        }
-        waitTime = stopTime - currentTime;
-
-        Iterator<SelectionKey> iterator =
-            selector.selectedKeys().iterator();
-        while (iterator.hasNext())
-        {
-          SelectionKey k = iterator.next();
-          if (k.isWritable())
-          {
-            int bytesWritten = socketChannel.write(buffer);
-            if (bytesWritten < 0)
-            {
-              // The client connection has been closed.
-              return false;
-            }
-
-            iterator.remove();
-          }
-        }
-
-        if (buffer.hasRemaining())
-        {
-          selector.select(waitTime);
-        }
-      }
-
-      return true;
-    }
-    finally
-    {
-      if (key.isValid())
-      {
-        key.cancel();
-        selector.selectNow();
-      }
-    }
-  }
-
-
-
   /**
    * Add all of the superior objectclasses to the specified objectclass
    * map if they don't already exist. Used by add and import-ldif to
@@ -2845,22 +2371,6 @@
    * @return {@code true} if message corresponds to descriptor
    */
   public static boolean hasDescriptor(LocalizableMessage msg,
-      LocalizableMessageDescriptor.Arg2<?, ?> desc)
-  {
-    return msg.ordinal() == desc.ordinal()
-        && msg.resourceName().equals(desc.resourceName());
-  }
-
-  /**
-   * Test if the provided message corresponds to the provided descriptor.
-   *
-   * @param msg
-   *          The i18n message.
-   * @param desc
-   *          The message descriptor.
-   * @return {@code true} if message corresponds to descriptor
-   */
-  public static boolean hasDescriptor(LocalizableMessage msg,
       LocalizableMessageDescriptor.Arg3<?, ?, ?> desc)
   {
     return msg.ordinal() == desc.ordinal()
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/cli/LDAPConnectionArgumentParser.java b/opendj-server-legacy/src/main/java/org/opends/server/util/cli/LDAPConnectionArgumentParser.java
index 69ceff8..fd4aba3 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/cli/LDAPConnectionArgumentParser.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/util/cli/LDAPConnectionArgumentParser.java
@@ -16,10 +16,10 @@
  */
 package org.opends.server.util.cli;
 
-import static org.opends.messages.ToolMessages.*;
-
 import static com.forgerock.opendj.cli.Utils.*;
 
+import static org.opends.messages.ToolMessages.*;
+
 import java.io.PrintStream;
 import java.util.LinkedList;
 import java.util.Set;
@@ -52,7 +52,6 @@
  */
 public class LDAPConnectionArgumentParser extends ArgumentParser
 {
-
   private SecureConnectionCliArgs args;
 
   /**
@@ -305,34 +304,6 @@
    *          with which to connect
    * @param options
    *          with which to connect
-   * @param out
-   *          stream to write messages
-   * @param err
-   *          stream to write error messages
-   * @return LDAPConnection created by this class from parsed arguments
-   * @throws LDAPConnectionException
-   *           if there was a problem connecting to the server indicated by the
-   *           input arguments
-   */
-  public LDAPConnection connect(String host, int port, String bindDN, String bindPw, LDAPConnectionOptions options,
-      PrintStream out, PrintStream err) throws LDAPConnectionException
-  {
-    return connect(host, port, bindDN, bindPw, options, 0, out, err);
-  }
-
-  /**
-   * Creates a connection from information provided.
-   *
-   * @param host
-   *          of the server
-   * @param port
-   *          of the server
-   * @param bindDN
-   *          with which to connect
-   * @param bindPw
-   *          with which to connect
-   * @param options
-   *          with which to connect
    * @param timeout
    *          the timeout to establish the connection in milliseconds. Use
    *          {@code 0} to express no timeout
@@ -345,7 +316,7 @@
    *           if there was a problem connecting to the server indicated by the
    *           input arguments
    */
-  public LDAPConnection connect(String host, int port, String bindDN, String bindPw, LDAPConnectionOptions options,
+  private LDAPConnection connect(String host, int port, String bindDN, String bindPw, LDAPConnectionOptions options,
       int timeout, PrintStream out, PrintStream err) throws LDAPConnectionException
   {
     // Attempt to connect and authenticate to the Directory Server.
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/cli/PointAdder.java b/opendj-server-legacy/src/main/java/org/opends/server/util/cli/PointAdder.java
index aadad9b..ff10a47 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/cli/PointAdder.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/util/cli/PointAdder.java
@@ -29,11 +29,11 @@
   private Thread t;
   private boolean stopPointAdder;
   private boolean pointAdderStopped;
-  private long periodTime = DEFAULT_PERIOD_TIME;
+  private final long periodTime;
   private final ProgressMessageFormatter formatter;
 
   /** The default period time used to write points in the output. */
-  public static final long DEFAULT_PERIOD_TIME = 3000;
+  private static final long DEFAULT_PERIOD_TIME = 3000;
 
   /**
    * Default constructor.
@@ -57,7 +57,7 @@
    * @param formatter
    *          The text formatter.
    */
-  public PointAdder(ConsoleApplication app, long periodTime, ProgressMessageFormatter formatter)
+  private PointAdder(ConsoleApplication app, long periodTime, ProgressMessageFormatter formatter)
   {
     this.app = app;
     this.periodTime = periodTime;
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java b/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java
index 5699217..06f4435 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java
@@ -16,6 +16,15 @@
  */
 package org.opends.server.workflowelement.localbackend;
 
+import static org.opends.messages.CoreMessages.*;
+import static org.opends.server.config.ConfigConstants.*;
+import static org.opends.server.core.DirectoryServer.*;
+import static org.opends.server.types.AbstractOperation.*;
+import static org.opends.server.util.CollectionUtils.*;
+import static org.opends.server.util.ServerConstants.*;
+import static org.opends.server.util.StaticUtils.*;
+import static org.opends.server.workflowelement.localbackend.LocalBackendWorkflowElement.*;
+
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -66,15 +75,6 @@
 import org.opends.server.types.operation.PreOperationAddOperation;
 import org.opends.server.util.TimeThread;
 
-import static org.opends.messages.CoreMessages.*;
-import static org.opends.server.config.ConfigConstants.*;
-import static org.opends.server.core.DirectoryServer.*;
-import static org.opends.server.types.AbstractOperation.*;
-import static org.opends.server.util.CollectionUtils.*;
-import static org.opends.server.util.ServerConstants.*;
-import static org.opends.server.util.StaticUtils.*;
-import static org.opends.server.workflowelement.localbackend.LocalBackendWorkflowElement.*;
-
 /**
  * This class defines an operation used to add an entry in a local backend
  * of the Directory Server.
@@ -94,7 +94,6 @@
 
   /** The DN of the entry to be added. */
   private DN entryDN;
-
   /** The entry being added to the server. */
   private Entry entry;
 
@@ -103,10 +102,8 @@
 
   /** The set of object classes for the entry to add. */
   private Map<ObjectClass, String> objectClasses;
-
   /** The set of operational attributes for the entry to add. */
   private Map<AttributeType, List<Attribute>> operationalAttributes;
-
   /** The set of user attributes for the entry to add. */
   private Map<AttributeType, List<Attribute>> userAttributes;
 
@@ -243,8 +240,7 @@
         }
         else
         {
-          // The entry doesn't have a parent but isn't a suffix.  This is not
-          // allowed.
+          // The entry doesn't have a parent but isn't a suffix. This is not allowed.
           throw new DirectoryException(ResultCode.NO_SUCH_OBJECT, ERR_ADD_ENTRY_NOT_SUFFIX.get(entryDN));
         }
       }
@@ -609,35 +605,6 @@
     attrList.add(Attributes.create(t, n, v));
   }
 
-
-
-  /**
-   * Adds the provided objectClass to the entry, along with its superior classes
-   * if appropriate.
-   *
-   * @param  objectClass  The objectclass to add to the entry.
-   */
-  public final void addObjectClassChain(ObjectClass objectClass)
-  {
-    Map<ObjectClass, String> objectClasses = getObjectClasses();
-    if (objectClasses != null){
-      if (! objectClasses.containsKey(objectClass))
-      {
-        objectClasses.put(objectClass, objectClass.getNameOrOID());
-      }
-
-      for(ObjectClass superiorClass : objectClass.getSuperiorClasses())
-      {
-        if (!objectClasses.containsKey(superiorClass))
-        {
-          addObjectClassChain(superiorClass);
-        }
-      }
-    }
-  }
-
-
-
   /**
    * Performs all password policy processing necessary for the provided add
    * operation.
@@ -645,7 +612,7 @@
    * @throws  DirectoryException  If a problem occurs while performing password
    *                              policy processing for the add operation.
    */
-  public final void handlePasswordPolicy()
+  private final void handlePasswordPolicy()
          throws DirectoryException
   {
     // Construct any virtual/collective attributes which might
@@ -654,8 +621,7 @@
     AuthenticationPolicy policy = AuthenticationPolicy.forUser(copy, false);
     if (!policy.isPasswordPolicy())
     {
-      // The entry doesn't have a locally managed password, so no action is
-      // required.
+      // The entry doesn't have a locally managed password, so no action is required.
       return;
     }
     PasswordPolicy passwordPolicy = (PasswordPolicy) policy;
@@ -695,8 +661,7 @@
         && !passwordPolicy.isAllowMultiplePasswordValues()
         && passwordAttr.size() > 1)
     {
-      // FIXME -- What if they're pre-encoded and might all be the
-      // same?
+      // FIXME -- What if they're pre-encoded and might all be the same?
       addPWPolicyControl(PasswordPolicyErrorType.PASSWORD_MOD_NOT_ALLOWED);
 
       LocalizableMessage message = ERR_PWPOLICY_MULTIPLE_PW_VALUES_NOT_ALLOWED
@@ -710,29 +675,12 @@
     for (ByteString value : passwordAttr)
     {
       // See if the password is pre-encoded.
-      if (passwordPolicy.isAuthPasswordSyntax())
+      boolean isPreEncoded = passwordPolicy.isAuthPasswordSyntax()
+          ? AuthPasswordSyntax.isEncoded(value)
+          : UserPasswordSyntax.isEncoded(value);
+      if (isPreEncoded)
       {
-        if (AuthPasswordSyntax.isEncoded(value))
-        {
-          if (isInternalOperation()
-              || passwordPolicy.isAllowPreEncodedPasswords())
-          {
-            builder.add(value);
-            continue;
-          }
-          else
-          {
-            addPWPolicyControl(PasswordPolicyErrorType.INSUFFICIENT_PASSWORD_QUALITY);
-
-            throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
-                ERR_PWPOLICY_PREENCODED_NOT_ALLOWED.get(passwordAttribute.getNameOrOID()));
-          }
-        }
-      }
-      else if (UserPasswordSyntax.isEncoded(value))
-      {
-        if (isInternalOperation()
-            || passwordPolicy.isAllowPreEncodedPasswords())
+        if (isInternalOperation() || passwordPolicy.isAllowPreEncodedPasswords())
         {
           builder.add(value);
           continue;
@@ -741,8 +689,8 @@
         {
           addPWPolicyControl(PasswordPolicyErrorType.INSUFFICIENT_PASSWORD_QUALITY);
 
-          throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
-              ERR_PWPOLICY_PREENCODED_NOT_ALLOWED.get(passwordAttribute.getNameOrOID()));
+          LocalizableMessage msg = ERR_PWPOLICY_PREENCODED_NOT_ALLOWED.get(passwordAttribute.getNameOrOID());
+          throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, msg);
         }
       }
 
@@ -811,8 +759,6 @@
     }
   }
 
-
-
   /**
    * Adds a password policy response control if the corresponding request
    * control was included.
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyTestCase.java
index 676d6b7..1010ef7 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyTestCase.java
@@ -1989,10 +1989,8 @@
     // Test connect and close.
     final LDAPConnectionFactory factory = new LDAPConnectionFactory(
         "127.0.0.1", server.getPort(), cfg);
-    Connection connection = null;
-    try
+    try (Connection connection = factory.getConnection())
     {
-      connection = factory.getConnection();
       connection.simpleBind(ByteString.valueOfUtf8(searchBindDNString),
           ByteString.valueOfUtf8(userPassword));
       fail("Bind attempt should have failed");
@@ -2004,7 +2002,6 @@
     }
     finally
     {
-      StaticUtils.close(connection);
       server.unblock();
       server.stop();
     }
@@ -2031,10 +2028,8 @@
     // Test connect and close.
     final LDAPConnectionFactory factory = new LDAPConnectionFactory(
         "127.0.0.1", server.getPort(), cfg);
-    Connection connection = null;
-    try
+    try (Connection connection = factory.getConnection())
     {
-      connection = factory.getConnection();
       connection.simpleBind(ByteString.valueOfUtf8(searchBindDNString),
           ByteString.valueOfUtf8(userPassword));
       fail("Bind attempt should have failed");
@@ -2046,7 +2041,6 @@
     }
     finally
     {
-      StaticUtils.close(connection);
       server.stop();
     }
   }
@@ -2075,10 +2069,8 @@
     // Test connect and close.
     final LDAPConnectionFactory factory = new LDAPConnectionFactory(
         "127.0.0.1", server.getPort(), cfg);
-    Connection connection = null;
-    try
+    try (Connection connection = factory.getConnection())
     {
-      connection = factory.getConnection();
       connection.simpleBind(ByteString.valueOfUtf8(searchBindDNString),
           ByteString.valueOfUtf8(userPassword));
       fail("Bind attempt should have failed");
@@ -2090,7 +2082,6 @@
     }
     finally
     {
-      StaticUtils.close(connection);
       server.stop();
     }
   }
@@ -2117,10 +2108,8 @@
     // Test connect and close.
     final LDAPConnectionFactory factory = new LDAPConnectionFactory(
         "127.0.0.1", server.getPort(), cfg);
-    Connection connection = null;
-    try
+    try (Connection connection = factory.getConnection())
     {
-      connection = factory.getConnection();
       connection.simpleBind(ByteString.valueOfUtf8(searchBindDNString),
           ByteString.valueOfUtf8(userPassword));
       fail("Bind attempt should have failed");
@@ -2132,7 +2121,6 @@
     }
     finally
     {
-      StaticUtils.close(connection);
       server.stop();
     }
   }
@@ -2158,10 +2146,8 @@
     // Test connect and close.
     final LDAPConnectionFactory factory = new LDAPConnectionFactory(
         "127.0.0.1", server.getPort(), cfg);
-    Connection connection = null;
-    try
+    try (Connection connection = factory.getConnection())
     {
-      connection = factory.getConnection();
       connection.simpleBind(ByteString.valueOfUtf8(searchBindDNString),
           ByteString.valueOfUtf8(userPassword));
       fail("Bind attempt should have failed");
@@ -2172,7 +2158,6 @@
     }
     finally
     {
-      StaticUtils.close(connection);
       server.stop();
     }
   }
@@ -2197,16 +2182,13 @@
     // Test connect and close.
     final LDAPConnectionFactory factory = new LDAPConnectionFactory(
         "127.0.0.1", server.getPort(), cfg);
-    Connection connection = null;
-    try
+    try (Connection connection = factory.getConnection())
     {
-      connection = factory.getConnection();
       connection.simpleBind(ByteString.valueOfUtf8(searchBindDNString),
           ByteString.valueOfUtf8(userPassword));
     }
     finally
     {
-      StaticUtils.close(connection);
       server.stop();
     }
   }
@@ -2259,10 +2241,8 @@
     // Test connect and close.
     final LDAPConnectionFactory factory = new LDAPConnectionFactory(
         "127.0.0.1", port, cfg);
-    Connection connection = null;
-    try
+    try (Connection connection = factory.getConnection())
     {
-      connection = factory.getConnection();
       fail("Connect attempt should have failed");
     }
     catch (final DirectoryException e)
@@ -2270,10 +2250,6 @@
       assertEquals(e.getResultCode(), ResultCode.CLIENT_SIDE_CONNECT_ERROR,
           e.getMessage());
     }
-    finally
-    {
-      StaticUtils.close(connection);
-    }
   }
 
   /**
@@ -2292,10 +2268,8 @@
     // FIXME: can we guarantee that "unknownhost" does not exist?
     final LDAPConnectionFactory factory = new LDAPConnectionFactory(
         "unknownhost", 31415, cfg);
-    Connection connection = null;
-    try
+    try (Connection connection = factory.getConnection())
     {
-      connection = factory.getConnection();
       fail("Connect attempt should have failed");
     }
     catch (final DirectoryException e)
@@ -2303,10 +2277,6 @@
       assertEquals(e.getResultCode(), ResultCode.CLIENT_SIDE_CONNECT_ERROR,
           e.getMessage());
     }
-    finally
-    {
-      StaticUtils.close(connection);
-    }
   }
 
   /**
@@ -2329,10 +2299,8 @@
     // Test connect and close.
     final LDAPConnectionFactory factory = new LDAPConnectionFactory(
         "127.0.0.1", server.getPort(), cfg);
-    Connection connection = null;
-    try
+    try (Connection connection = factory.getConnection())
     {
-      connection = factory.getConnection();
       connection.search(searchBindDN, SearchScope.WHOLE_SUBTREE, SearchFilter.objectClassPresent());
       fail("Search attempt should have timed out");
     }
@@ -2343,7 +2311,6 @@
     }
     finally
     {
-      StaticUtils.close(connection);
       server.unblock();
       server.stop();
     }
@@ -2373,10 +2340,8 @@
     // Test connect and close.
     final LDAPConnectionFactory factory = new LDAPConnectionFactory(
         "127.0.0.1", server.getPort(), cfg);
-    Connection connection = null;
-    try
+    try (Connection connection = factory.getConnection())
     {
-      connection = factory.getConnection();
       connection.search(searchBindDN, SearchScope.WHOLE_SUBTREE,
           SearchFilter.createFilterFromString("(uid=aduser)"));
       fail("Search attempt should have failed");
@@ -2388,7 +2353,6 @@
     }
     finally
     {
-      StaticUtils.close(connection);
       server.stop();
     }
   }
@@ -2418,10 +2382,8 @@
     // Test connect and close.
     final LDAPConnectionFactory factory = new LDAPConnectionFactory(
         "127.0.0.1", server.getPort(), cfg);
-    Connection connection = null;
-    try
+    try (Connection connection = factory.getConnection())
     {
-      connection = factory.getConnection();
       connection.search(searchBindDN, SearchScope.WHOLE_SUBTREE,
           SearchFilter.createFilterFromString("(uid=aduser)"));
       fail("Search attempt should have failed");
@@ -2433,7 +2395,6 @@
     }
     finally
     {
-      StaticUtils.close(connection);
       server.stop();
     }
   }
@@ -2461,10 +2422,8 @@
     // Test connect and close.
     final LDAPConnectionFactory factory = new LDAPConnectionFactory(
         "127.0.0.1", server.getPort(), cfg);
-    Connection connection = null;
-    try
+    try (Connection connection = factory.getConnection())
     {
-      connection = factory.getConnection();
       connection.search(searchBindDN, SearchScope.WHOLE_SUBTREE,
           SearchFilter.createFilterFromString("(uid=aduser)"));
       fail("Search attempt should have failed");
@@ -2476,7 +2435,6 @@
     }
     finally
     {
-      StaticUtils.close(connection);
       server.stop();
     }
   }
@@ -2504,10 +2462,8 @@
     // Test connect and close.
     final LDAPConnectionFactory factory = new LDAPConnectionFactory(
         "127.0.0.1", server.getPort(), cfg);
-    Connection connection = null;
-    try
+    try (Connection connection = factory.getConnection())
     {
-      connection = factory.getConnection();
       connection.search(searchBindDN, SearchScope.WHOLE_SUBTREE,
           SearchFilter.createFilterFromString("(uid=aduser)"));
       fail("Search attempt should have failed");
@@ -2519,7 +2475,6 @@
     }
     finally
     {
-      StaticUtils.close(connection);
       server.stop();
     }
   }
@@ -2549,10 +2504,8 @@
     // Test connect and close.
     final LDAPConnectionFactory factory = new LDAPConnectionFactory(
         "127.0.0.1", server.getPort(), cfg);
-    Connection connection = null;
-    try
+    try (Connection connection = factory.getConnection())
     {
-      connection = factory.getConnection();
       connection.search(searchBindDN, SearchScope.WHOLE_SUBTREE,
           SearchFilter.createFilterFromString("(uid=aduser)"));
       fail("Search attempt should have failed");
@@ -2564,7 +2517,6 @@
     }
     finally
     {
-      StaticUtils.close(connection);
       server.stop();
     }
   }
@@ -2592,10 +2544,8 @@
     // Test connect and close.
     final LDAPConnectionFactory factory = new LDAPConnectionFactory(
         "127.0.0.1", server.getPort(), cfg);
-    Connection connection = null;
-    try
+    try (Connection connection = factory.getConnection())
     {
-      connection = factory.getConnection();
       final ByteString username = connection.search(searchBindDN,
           SearchScope.WHOLE_SUBTREE,
           SearchFilter.createFilterFromString("(uid=aduser)"));
@@ -2603,7 +2553,6 @@
     }
     finally
     {
-      StaticUtils.close(connection);
       server.stop();
     }
   }
@@ -2633,10 +2582,8 @@
     // Test connect and close.
     final LDAPConnectionFactory factory = new LDAPConnectionFactory(
         "127.0.0.1", server.getPort(), cfg);
-    Connection connection = null;
-    try
+    try (Connection connection = factory.getConnection())
     {
-      connection = factory.getConnection();
       connection.search(searchBindDN, SearchScope.WHOLE_SUBTREE,
           SearchFilter.createFilterFromString("(uid=aduser)"));
       fail("Search attempt should have failed");
@@ -2648,7 +2595,6 @@
     }
     finally
     {
-      StaticUtils.close(connection);
       server.stop();
     }
   }
@@ -2678,10 +2624,8 @@
     // Test connect and close.
     final LDAPConnectionFactory factory = new LDAPConnectionFactory(
         "127.0.0.1", server.getPort(), cfg);
-    Connection connection = null;
-    try
+    try (Connection connection = factory.getConnection())
     {
-      connection = factory.getConnection();
       connection.search(searchBindDN, SearchScope.WHOLE_SUBTREE,
           SearchFilter.createFilterFromString("(uid=aduser)"));
       fail("Search attempt should have failed");
@@ -2693,7 +2637,6 @@
     }
     finally
     {
-      StaticUtils.close(connection);
       server.stop();
     }
   }
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/TLSByteChannelTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/TLSByteChannelTestCase.java
index 5921e22..2837674 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/TLSByteChannelTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/TLSByteChannelTestCase.java
@@ -11,7 +11,7 @@
  * Header, with the fields enclosed by brackets [] replaced by your own identifying
  * information: "Portions Copyright [year] [name of copyright owner]".
  *
- * Copyright 2012-2015 ForgeRock AS.
+ * Copyright 2012-2016 ForgeRock AS.
  */
 package org.opends.server.extensions;
 
@@ -35,22 +35,16 @@
 import javax.xml.xpath.XPathFactory;
 
 import org.opends.server.DirectoryServerTestCase;
-import org.opends.server.util.StaticUtils;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.NodeList;
 
-/**
- * Tests for {@link TLSByteChannel} class.
- */
-@Test(groups = { "slow" }, sequential = true)
+/** Tests for {@link TLSByteChannel} class. */
+@Test(groups = "slow", sequential = true)
 public class TLSByteChannelTestCase extends DirectoryServerTestCase
 {
-
-  /**
-   * Cipher suite hardcoded from the IANA registry on internet.
-   */
+  /** Cipher suite hardcoded from the IANA registry on internet. */
   static final String[][] HARDCODED_CIPHER_SUITE = new String[][] {
         { "TLS_NULL_WITH_NULL_NULL" },
         { "TLS_RSA_WITH_NULL_MD5" },
@@ -378,9 +372,8 @@
     String url =
         "http://www.iana.org/assignments/tls-parameters/tls-parameters.xml";
     URLConnection conn = new URL(url).openConnection();
-    BufferedInputStream bis = new BufferedInputStream(conn.getInputStream());
 
-    try
+    try (BufferedInputStream bis = new BufferedInputStream(conn.getInputStream()))
     {
       // JAXP boilerplate
       DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
@@ -395,10 +388,6 @@
       List<String> realCiphers = retrieveRealCiphers(doc, xpath, xPathExpr);
       return toDataProviderResult(realCiphers);
     }
-    finally
-    {
-      StaticUtils.close(bis);
-    }
   }
 
   private String[][] toDataProviderResult(List<String> realCiphers)
@@ -496,9 +485,7 @@
         .getSSF("TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA"));
   }
 
-  /**
-   * Ensures that no new overlapping cipher strings are added to the cipher map.
-   */
+  /** Ensures that no new overlapping cipher strings are added to the cipher map. */
   @Test
   public void checkNoUnknownOverlappingCiphers()
   {
@@ -520,15 +507,11 @@
     }
   }
 
-  /**
-   * Ensure the set (cipher1, cipher2) is different from the set (match1,
-   * match2).
-   */
+  /** Ensure the set (cipher1, cipher2) is different from the set (match1, match2). */
   private boolean not(String cipher1, String cipher2, String match1,
       String match2)
   {
     return (!cipher1.equals(match1) || !cipher2.equals(match2))
         && (!cipher2.equals(match1) || !cipher1.equals(match2));
   }
-
 }
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/tools/ArgumentParserToolsTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/tools/ArgumentParserToolsTestCase.java
index 0ec2aec..7d409d5 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/tools/ArgumentParserToolsTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/tools/ArgumentParserToolsTestCase.java
@@ -199,7 +199,7 @@
   @Test(dataProvider = "invalidArg")
   public void testManageTasks(final String[] args)
   {
-    assertToolFailsWithUsage(ManageTasks.mainTaskInfo(args, null, outStream, errStream, false), ERRORS_ON_STDOUT);
+    assertToolFailsWithUsage(ManageTasks.mainTaskInfo(args, outStream, errStream, false), ERRORS_ON_STDOUT);
   }
 
   @Test(dataProvider = "invalidArgs")
@@ -217,7 +217,7 @@
   @Test(dataProvider = "invalidArg")
   public void testStatus(final String[] args)
   {
-    assertToolFailsWithUsage(StatusCli.mainCLI(args, false, outStream, errStream, null), ERRORS_ON_STDOUT);
+    assertToolFailsWithUsage(StatusCli.mainCLI(args, outStream, errStream), ERRORS_ON_STDOUT);
   }
 
   @Test(dataProvider = "invalidArgs")
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/tools/UpgradeTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/tools/UpgradeTestCase.java
index 76511e8..8faafa8 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/tools/UpgradeTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/tools/UpgradeTestCase.java
@@ -11,7 +11,7 @@
  * Header, with the fields enclosed by brackets [] replaced by your own identifying
  * information: "Portions Copyright [year] [name of copyright owner]".
  *
- * Portions Copyright 2013-2015 ForgeRock AS.
+ * Portions Copyright 2013-2016 ForgeRock AS.
  */
 package org.opends.server.tools;
 
@@ -34,9 +34,7 @@
 import static com.forgerock.opendj.cli.ArgumentConstants.*;
 import static org.testng.Assert.*;
 
-/**
- * A set of test cases for the Upgrade tool.
- */
+/** A set of test cases for the Upgrade tool. */
 @SuppressWarnings("javadoc")
 public class UpgradeTestCase extends ToolsTestCase
 {
@@ -83,121 +81,77 @@
     Assertions.assertThat(out).contains(expected);
   }
 
-  /**
-   * Tests display help information.
-   */
+  /** Tests display help information. */
   @Test
-  public void testUpgradeToolDisplaysHelpUsage()
+  public void testUpgradeToolDisplaysHelpUsage() throws Exception
   {
-    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    final PrintStream ps = new PrintStream(baos);
-
-    try
+    try (final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        final PrintStream ps = new PrintStream(baos))
     {
       // The 'main' should exit with success code.
       assertEquals(UpgradeCli.main(setArgs("--help"), true, ps, ps), 0);
       assertContainsMessage(baos.toString(), INFO_UPGRADE_DESCRIPTION_CLI.get());
     }
-    finally
-    {
-      StaticUtils.close(ps, baos);
-    }
   }
 
-  /**
-   * Tests display help information.
-   */
+  /** Tests display help information. */
   @Test
-  public void testUpgradeToolDisplaysHelpUsage2()
+  public void testUpgradeToolDisplaysHelpUsage2() throws Exception
   {
-    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    final PrintStream ps = new PrintStream(baos);
-
-    try
+    try (final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        final PrintStream ps = new PrintStream(baos))
     {
       // The 'main' should exit with success code.
       assertEquals(UpgradeCli.main(setArgs("-H"), true, ps, ps), 0);
       assertContainsMessage(baos.toString(), INFO_UPGRADE_DESCRIPTION_CLI.get());
     }
-    finally
-    {
-      StaticUtils.close(ps, baos);
-    }
   }
 
-  /**
-   * Tests display help information.
-   */
+  /** Tests display help information. */
   @Test
-  public void testUpgradeToolDisplaysHelpUsage3()
+  public void testUpgradeToolDisplaysHelpUsage3() throws Exception
   {
-    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    final PrintStream ps = new PrintStream(baos);
-
-    try
+    try (final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        final PrintStream ps = new PrintStream(baos))
     {
       // The 'main' should exit with success code.
       assertEquals(UpgradeCli.main(setArgs("-?"), true, ps, ps), 0);
       assertContainsMessage(baos.toString(), INFO_UPGRADE_DESCRIPTION_CLI.get());
     }
-    finally
-    {
-      StaticUtils.close(ps, baos);
-    }
   }
 
-  /**
-   * Tests the upgrade tool with an invalid sub-command.
-   */
+  /** Tests the upgrade tool with an invalid sub-command. */
   @Test
-  public void testUpgradeToolDoesntAllowWrongSubcommand()
+  public void testUpgradeToolDoesntAllowWrongSubcommand() throws Exception
   {
-    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    final PrintStream ps = new PrintStream(baos);
-
-    try
+    try (final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        final PrintStream ps = new PrintStream(baos))
     {
       // The 'main' should exit with an error code.
       assertEquals(UpgradeCli.main(setArgs("-- wrong"), true, ps, ps), 1);
       assertContainsMessage(baos.toString(), ERR_ERROR_PARSING_ARGS.get(""));
     }
-    finally
-    {
-      StaticUtils.close(ps, baos);
-    }
   }
 
-  /**
-   * Tests the upgrade tool with an invalid sub-command.
-   */
+  /** Tests the upgrade tool with an invalid sub-command. */
   @Test
-  public void testUpgradeToolDoesntAllowWrongSubcommand2()
+  public void testUpgradeToolDoesntAllowWrongSubcommand2() throws Exception
   {
-    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    final PrintStream ps = new PrintStream(baos);
-
-    try
+    try (final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        final PrintStream ps = new PrintStream(baos))
     {
       // The 'main' should exit with an error code.
       assertEquals(UpgradeCli.main(setArgs("--wrong"), true, ps, ps), 1);
       assertContainsMessage(baos.toString(), ERR_ERROR_PARSING_ARGS.get(""));
     }
-    finally
-    {
-      StaticUtils.close(ps, baos);
-    }
   }
 
-  /**
-   * The upgrade tool disallows the force sub-command used with 'interactive
-   * mode'.
-   */
+  /** The upgrade tool disallows the force sub-command used with 'interactive mode'. */
   @Test
-  public void testUpgradeToolDoesntAllowInteractiveAndForce()
+  public void testUpgradeToolDoesntAllowInteractiveAndForce() throws Exception
   {
-    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    final PrintStream ps = new PrintStream(baos);
-    try
+    try (final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        final PrintStream ps = new PrintStream(baos))
     {
       // The 'main' should exit with an error code.
       assertEquals(UpgradeCli.main(setArgs("--force"), true, ps, ps), 1);
@@ -206,15 +160,9 @@
       assertContainsMessage(baos.toString(), ERR_UPGRADE_INCOMPATIBLE_ARGS.get(
           OPTION_LONG_FORCE_UPGRADE, "interactive mode"));
     }
-    finally
-    {
-      StaticUtils.close(ps, baos);
-    }
   }
 
-  /**
-   * Upgrade tool allows use of force and no-prompt sub-commands.
-   */
+  /** Upgrade tool allows use of force and no-prompt sub-commands. */
   @Test
   public void testUpgradeToolAllowsNonInteractiveAndForce() throws Exception
   {
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/tools/makeldif/MakeLDIFTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/tools/makeldif/MakeLDIFTestCase.java
index 3b88669..a244b1e 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/tools/makeldif/MakeLDIFTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/tools/makeldif/MakeLDIFTestCase.java
@@ -13,7 +13,7 @@
  *
  * Copyright 2006-2008 Sun Microsystems, Inc.
  * Portions Copyright 2006 Brighton Consulting, Inc.
- * Portions Copyright 2013-2015 ForgeRock AS.
+ * Portions Copyright 2013-2016 ForgeRock AS.
  */
 package org.opends.server.tools.makeldif;
 
@@ -21,27 +21,30 @@
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Random;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.opends.server.TestCaseUtils;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.tasks.LdifFileWriter;
 import org.opends.server.tools.ToolsTestCase;
-import org.opends.server.types.*;
+import org.opends.server.types.Attribute;
+import org.opends.server.types.Attributes;
+import org.opends.server.types.Entry;
+import org.opends.server.types.InitializationException;
+import org.opends.server.types.LDIFImportConfig;
 import org.opends.server.util.LDIFException;
 import org.opends.server.util.LDIFReader;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-import static org.testng.Assert.*;
 import static org.opends.messages.ToolMessages.*;
+import static org.testng.Assert.*;
 
-/**
- * A set of test cases for the MakeLDIF tool.
- */
-public class MakeLDIFTestCase
-    extends ToolsTestCase
+/** A set of test cases for the MakeLDIF tool. */
+@SuppressWarnings("javadoc")
+public class MakeLDIFTestCase extends ToolsTestCase
 {
   private String resourcePath;
 
@@ -77,7 +80,7 @@
     // Test must show "missingVar" missing on line 1.
     // Previous behaviour showed "missingVar" on line 5.
 
-    TemplateFile templateFile = new TemplateFile(resourcePath);
+    TemplateFile templateFile = new TemplateFile(resourcePath, new Random());
     List<LocalizableMessage> warns = new ArrayList<>();
 
     try
@@ -143,14 +146,12 @@
     };
   }
 
-  /**
-   * Test for parsing escaped  character in templates.
-   */
+  /** Test for parsing escaped character in templates. */
   @Test(dataProvider = "validTemplates")
   public void testParsingEscapeCharInTemplate(String testName, String[] lines)
       throws Exception
   {
-    TemplateFile templateFile = new TemplateFile(resourcePath);
+    TemplateFile templateFile = new TemplateFile(resourcePath, new Random());
     List<LocalizableMessage> warns = new ArrayList<>();
     templateFile.parse(lines, warns);
     assertTrue(warns.isEmpty(),"Warnings in parsing test template " + testName );
@@ -302,10 +303,8 @@
     };
   }
 
-  /**
-   * Test for escaped characters in templates, check LDIF output.
-   */
-  @Test(dataProvider="templatesToTestLDIFOutput", dependsOnMethods = { "testParsingEscapeCharInTemplate"})
+  /** Test for escaped characters in templates, check LDIF output. */
+  @Test(dataProvider = "templatesToTestLDIFOutput", dependsOnMethods = "testParsingEscapeCharInTemplate")
   public void testLDIFOutputFromTemplate(String testName, String[] lines,
                                          String attrName, String expectedValue) throws Exception
   {
@@ -339,7 +338,7 @@
    * Test for escaped characters in templates, check LDIF output when
    * the templates combines escaped characters and variables.
    */
-  @Test(dependsOnMethods = { "testParsingEscapeCharInTemplate"})
+  @Test(dependsOnMethods = "testParsingEscapeCharInTemplate")
   public void testOutputCombineEscapeCharInTemplate() throws Exception
   {
     String[] lines =
@@ -358,7 +357,6 @@
             "",
         };
 
-
     File tmpFile = File.createTempFile("combineEscapeChar", "out.ldif");
     tmpFile.deleteOnExit();
     String outLdifFilePath = tmpFile.getAbsolutePath();
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/util/TestStaticUtils.java b/opendj-server-legacy/src/test/java/org/opends/server/util/TestStaticUtils.java
index 8e1e82f..1601842 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/util/TestStaticUtils.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/util/TestStaticUtils.java
@@ -12,11 +12,10 @@
  * information: "Portions Copyright [year] [name of copyright owner]".
  *
  * Copyright 2006-2009 Sun Microsystems, Inc.
- * Portions Copyright 2013-2015 ForgeRock AS.
+ * Portions Copyright 2013-2016 ForgeRock AS.
  */
 package org.opends.server.util;
 
-import static org.opends.server.util.CollectionUtils.*;
 import static org.testng.Assert.*;
 
 import java.io.BufferedReader;
@@ -31,9 +30,6 @@
 import java.nio.channels.FileChannel;
 import java.nio.channels.FileLock;
 import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
 import java.util.LinkedList;
 import java.util.List;
 
@@ -600,71 +596,6 @@
   }
 
   /**
-   * Create test strings for the
-   * {@link StaticUtils#isRelativePath(String)}.
-   *
-   * @return Returns an array of test data.
-   */
-  @DataProvider(name = "isRelativePathTestData")
-  public Object[][] createIsRelativePathTestData() {
-    String root = File.listRoots()[0].getPath();
-    return new Object[][] { { "", true }, { root, false },
-         { root + "foo", false }, { "foo", true },
-         { "foo" + File.separator + "bar", true },
-         { root + "foo" + File.separator + "bar", false },
-         { ".", true }, { "..", true },
-         { root + "foo" + File.separator + ".", false },
-         { root + "foo" + File.separator + "..", false } };
-  }
-
-  /**
-   * Tests the {@link StaticUtils#isRelativePath(String)} method.
-   *
-   * @param path
-   *          The test string.
-   * @param result
-   *          Expected result.
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(dataProvider = "isRelativePathTestData")
-  public void testIsRelativePath(String path, boolean result)
-      throws Exception {
-    Assert.assertEquals(StaticUtils.isRelativePath(path), result);
-  }
-
-  /**
-   * Create test lists for the {@link StaticUtils#listToArray(List)}.
-   *
-   * @return Returns an array of test data.
-   */
-  @DataProvider(name = "listToArrayTestData")
-  public Object[][] createListToArrayTestData() {
-    return new Object[][] { { null }, { new String[] {} },
-        { new String[] { "aaa" } },
-        { new String[] { "aaa", "bbb", "ccc" } } };
-  }
-
-  /**
-   * Tests the {@link StaticUtils#listToArray(List)} method.
-   *
-   * @param strings
-   *          The test string list.
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(dataProvider = "listToArrayTestData")
-  public void testListToArray(String[] strings) throws Exception {
-    if (strings != null) {
-      List<String> list = new ArrayList<>(strings.length);
-      Collections.addAll(list, strings);
-      Assert.assertEquals(StaticUtils.listToArray(list), strings);
-    } else {
-      Assert.assertNull(StaticUtils.listToArray(null));
-    }
-  }
-
-  /**
    * Tests the {@link StaticUtils#moveFile(java.io.File, java.io.File)}
    * method.
    *
@@ -1115,62 +1046,6 @@
     Assert.assertEquals(builder.toString(), expected);
   }
 
-  /**
-   * Create test lists for the
-   * {@link StaticUtils#listsAreEqual(List, List)} method.
-   *
-   * @return Returns an array of test data.
-   */
-  @DataProvider(name = "listsAreEqualTestData")
-  public Object[][] createListsAreEqualTestData() {
-    return new Object[][] {
-        // Check null behaviour.
-        { null, null, true },
-        { null, Collections.emptyList(), false },
-        { Collections.emptyList(), null, false },
-
-        // Check empty-list behaviour.
-        { Collections.emptyList(), Collections.emptyList(), true },
-        { Collections.singletonList(0), Collections.emptyList(), false },
-        { Collections.emptyList(), Collections.singletonList(0), false },
-
-        // Check single-element behaviour.
-        { Collections.singletonList(0), Collections.singletonList(0), true },
-        { Collections.singletonList(0), Collections.singletonList(1), false },
-
-        // Check multi-element random access behaviour.
-        { Arrays.asList(0, 1), Arrays.asList(0, 1), true },
-        { Arrays.asList(0, 1), Arrays.asList(1, 0), false },
-
-        // ...With duplicates.
-        { Arrays.asList(0, 1), Arrays.asList(0, 1, 1), false },
-
-        // Check multi-element sequential behaviour.
-        { newLinkedList(0, 1), newLinkedList(0, 1), true },
-        { newLinkedList(0, 1), newLinkedList(1, 0), false },
-
-        // ...With duplicates.
-        { newLinkedList(0, 1), newLinkedList(0, 1, 1), false } };
-  }
-
-  /**
-   * Tests the {@link StaticUtils#listsAreEqual(List, List)} method.
-   *
-   * @param list1
-   *          The first list.
-   * @param list2
-   *          The second list.
-   * @param result
-   *          The expected equality result.
-   * @throws Exception
-   *           If the test failed unexpectedly.
-   */
-  @Test(dataProvider = "listsAreEqualTestData")
-  public void testListsAreEqual(List<?> list1, List<?> list2, boolean result)
-      throws Exception {
-    Assert.assertEquals(StaticUtils.listsAreEqual(list1, list2), result);
-  }
-
   @Test
   public void testStackTraceHasCause() throws Exception
   {

--
Gitblit v1.10.0