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

Jean-Noel Rouvignac
07.41.2014 f45aad28ca76ce859bfae6aa9cff650b9a34b85e
opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java
@@ -36,12 +36,11 @@
import java.util.Set;
import java.util.SortedSet;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import javax.naming.NamingException;
import javax.naming.ldap.InitialLdapContext;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.opends.admin.ads.util.ApplicationTrustManager;
import org.opends.admin.ads.util.ConnectionUtils;
import org.opends.guitools.controlpanel.browser.IconPool;
@@ -62,6 +61,7 @@
import org.opends.quicksetup.util.UIKeyStore;
import org.opends.quicksetup.util.Utils;
import org.opends.server.tools.ConfigureWindowsService;
import org.opends.server.util.StaticUtils;
/**
 * This is the classes that is shared among all the different places in the
@@ -516,17 +516,8 @@
      desc.setStatus(status);
      if (status == ServerDescriptor.ServerStatus.STOPPING)
      {
        if (ctx != null)
        {
          try
          {
            ctx.close();
          }
          catch (Throwable t)
          {
          }
          this.ctx = null;
        }
        StaticUtils.close(ctx);
        this.ctx = null;
        if (userDataCtx != null)
        {
          if (connectionPool.isConnectionRegistered(userDataCtx))
@@ -539,13 +530,7 @@
            {
            }
          }
          try
          {
            userDataCtx.close();
          }
          catch (Throwable t)
          {
          }
          StaticUtils.close(userDataCtx);
          userDataCtx = null;
        }
      }
@@ -819,6 +804,7 @@
    poolingThread = new Thread(new Runnable()
    {
      @Override
      public void run()
      {
        try
opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/JavaPropertiesPanel.java
@@ -63,6 +63,7 @@
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import org.forgerock.i18n.LocalizableMessage;
import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo;
import org.opends.guitools.controlpanel.datamodel.SortableTableModel;
import org.opends.guitools.controlpanel.event.BrowseActionListener;
@@ -73,12 +74,12 @@
import org.opends.guitools.controlpanel.ui.renderer.LDAPEntryTableCellRenderer;
import org.opends.guitools.controlpanel.util.BackgroundTask;
import org.opends.guitools.controlpanel.util.Utilities;
import org.forgerock.i18n.LocalizableMessage;
import org.opends.quicksetup.Installation;
import org.opends.quicksetup.util.Utils;
import org.opends.server.tools.JavaPropertiesTool;
import org.opends.server.types.OpenDsException;
import org.opends.server.util.SetupUtils;
import org.opends.server.util.StaticUtils;
/**
 * The panel where the user can specify the java arguments and java home to be
@@ -395,6 +396,7 @@
      Utilities.createCheckBox(INFO_CTRL_PANEL_DISPLAY_ALL_COMMAND_LINES.get());
    showAll.addActionListener(new ActionListener()
    {
      @Override
      public void actionPerformed(ActionEvent ev)
      {
        editor.stopCellEditing();
@@ -445,6 +447,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void configurationChanged(ConfigurationChangeEvent ev)
  {
    final boolean isLocal = ev.getNewDescriptor().isLocal();
@@ -456,6 +459,7 @@
        /**
         * {@inheritDoc}
         */
        @Override
        public void run()
        {
          if (!isLocal)
@@ -631,16 +635,7 @@
        }
        finally
        {
          if (reader != null)
          {
            try
            {
              reader.close();
            }
            catch (Throwable t)
            {
            }
          }
          StaticUtils.close(reader);
        }
        String v = properties.getProperty("overwrite-env-java-home");
@@ -1184,6 +1179,7 @@
     * comparison.  Returns -1 if the second element goes higher than the first
     * one.
     */
    @Override
    public int compare(JavaArgumentsDescriptor desc1,
        JavaArgumentsDescriptor desc2)
    {
@@ -1226,6 +1222,7 @@
    /**
     * {@inheritDoc}
     */
    @Override
    public int getColumnCount()
    {
      return COLUMN_NAMES.length;
@@ -1234,6 +1231,7 @@
    /**
     * {@inheritDoc}
     */
    @Override
    public int getRowCount()
    {
      return dataArray.size();
@@ -1242,6 +1240,7 @@
    /**
     * {@inheritDoc}
     */
    @Override
    public Object getValueAt(int row, int col)
    {
      return dataArray.get(row)[col];
@@ -1542,16 +1541,7 @@
      }
      finally
      {
        if (reader != null)
        {
          try
          {
            reader.close();
          }
          catch (Throwable t)
          {
          }
        }
        StaticUtils.close(reader);
      }
      BufferedWriter writer = null;
@@ -1587,22 +1577,14 @@
      }
      finally
      {
        if (writer != null)
        {
          try
          {
            writer.close();
          }
          catch (Throwable t)
          {
          }
        }
        StaticUtils.close(writer);
      }
      SwingUtilities.invokeLater(new Runnable()
      {
        /**
         * {@inheritDoc}
         */
        @Override
        public void run()
        {
          getProgressDialog().appendProgressHtml(Utilities.applyFont(
opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/LocalOrRemotePanel.java
@@ -42,9 +42,6 @@
import java.util.Iterator;
import java.util.LinkedHashSet;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.directory.SearchControls;
@@ -59,6 +56,8 @@
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.opends.admin.ads.ServerDescriptor;
import org.opends.admin.ads.util.ApplicationTrustManager;
import org.opends.admin.ads.util.ConnectionUtils;
@@ -321,6 +320,7 @@
    ActionListener actionListener = new ActionListener()
    {
      @Override
      public void actionPerformed(ActionEvent ev)
      {
        updateComponentState();
@@ -424,6 +424,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void configurationChanged(ConfigurationChangeEvent ev)
  {
  }
@@ -569,6 +570,7 @@
            // At least load the local information.
            SwingUtilities.invokeLater(new Runnable()
            {
              @Override
              public void run()
              {
                displayMessage(
@@ -615,6 +617,7 @@
            }
            SwingUtilities.invokeLater(new Runnable()
            {
              @Override
              public void run()
              {
                displayMessage(
@@ -629,16 +632,7 @@
            return ctx;
          } catch (Throwable t)
          {
            if (ctx != null)
            {
              try
              {
                ctx.close();
              }
              catch (Throwable t1)
              {
              }
            }
            StaticUtils.close(ctx);
            throw t;
          }
        }
@@ -863,6 +857,7 @@
        /* Simulate a click on the OK by calling in the okClicked method. */
        SwingUtilities.invokeLater(new Runnable()
        {
          @Override
          public void run()
          {
            okClicked();
@@ -931,6 +926,7 @@
    // sleep the pooling period before calling it.
    Thread t = new Thread(new Runnable()
    {
      @Override
      public void run()
      {
        try
opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/LoginPanel.java
@@ -37,9 +37,6 @@
import java.util.Iterator;
import java.util.LinkedHashSet;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import javax.naming.NamingException;
import javax.naming.ldap.InitialLdapContext;
import javax.swing.JLabel;
@@ -47,6 +44,8 @@
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.opends.admin.ads.util.ApplicationTrustManager;
import org.opends.guitools.controlpanel.datamodel.ConfigReadException;
import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent;
@@ -57,6 +56,7 @@
import org.opends.quicksetup.util.UIKeyStore;
import org.opends.quicksetup.util.Utils;
import org.opends.server.types.DN;
import org.opends.server.util.StaticUtils;
/**
 * The panel that appears when the user is asked to provide authentication.
@@ -86,6 +86,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public LocalizableMessage getTitle()
  {
    return INFO_CTRL_PANEL_LOGIN_PANEL_TITLE.get();
@@ -136,6 +137,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public Component getPreferredFocusComponent()
  {
    return pwd;
@@ -144,6 +146,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void configurationChanged(ConfigurationChangeEvent ev)
  {
  }
@@ -164,6 +167,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void okClicked()
  {
    setPrimaryValid(dnLabel);
@@ -211,6 +215,7 @@
        /**
         * {@inheritDoc}
         */
        @Override
        public InitialLdapContext processBackgroundTask() throws Throwable
        {
          InitialLdapContext ctx = null;
@@ -249,6 +254,7 @@
            }
            SwingUtilities.invokeLater(new Runnable()
            {
              @Override
              public void run()
              {
                displayMessage(
@@ -261,16 +267,7 @@
            return ctx;
          } catch (Throwable t)
          {
            if (ctx != null)
            {
              try
              {
                ctx.close();
              }
              catch (Throwable t1)
              {
              }
            }
            StaticUtils.close(ctx);
            throw t;
          }
        }
@@ -278,6 +275,7 @@
        /**
         * {@inheritDoc}
         */
        @Override
        public void backgroundTaskCompleted(InitialLdapContext ctx,
            Throwable throwable)
        {
@@ -447,6 +445,7 @@
        /* Simulate a click on the OK by calling in the okClicked method. */
        SwingUtilities.invokeLater(new Runnable()
        {
          @Override
          public void run()
          {
            okClicked();
opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/util/ReadOnlyConfigFileHandler.java
@@ -24,7 +24,6 @@
 *      Copyright 2008-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.opends.guitools.controlpanel.util;
import static org.opends.messages.ConfigMessages.*;
@@ -62,13 +61,12 @@
import org.opends.server.types.RestoreConfig;
import org.opends.server.util.LDIFException;
import org.opends.server.util.LDIFReader;
import org.opends.server.util.StaticUtils;
/**
 * A class used to read the configuration from a file.  This config file
 * handler does not allow to modify the configuration, only to read it.
 *
 */
public class ReadOnlyConfigFileHandler extends ConfigHandler
{
//The mapping that holds all of the configuration entries that have been read
@@ -91,6 +89,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void finalizeConfigHandler()
  {
  }
@@ -98,6 +97,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public ConfigEntry getConfigEntry(DN entryDN) throws ConfigException
  {
    return configEntries.get(entryDN);
@@ -106,6 +106,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public ConfigEntry getConfigRootEntry() throws ConfigException
  {
    return configRootEntry;
@@ -114,6 +115,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public String getServerRoot()
  {
    return serverRoot;
@@ -122,6 +124,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public String getInstanceRoot()
  {
    return instanceRoot;
@@ -130,6 +133,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public synchronized void initializeConfigHandler(String configFile,
      boolean checkSchema)
  throws InitializationException
@@ -246,27 +250,17 @@
    }
    catch (Throwable t)
    {
    }
    finally
    {
      try
      {
        if (reader != null)
        {
          reader.close();
        }
      }
      catch (Throwable t)
      {
        // Ignore
      }
      StaticUtils.close(reader);
    }
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public void writeSuccessfulStartupConfig()
  {
  }
@@ -274,6 +268,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void writeUpdatedConfig() throws DirectoryException
  {
  }
@@ -281,6 +276,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void addEntry(Entry arg0, AddOperation arg1)
  throws DirectoryException, CanceledOperationException
  {
@@ -289,6 +285,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void configureBackend(Configuration arg0) throws ConfigException
  {
  }
@@ -296,6 +293,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void createBackup(BackupConfig arg0) throws DirectoryException
  {
  }
@@ -303,6 +301,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void deleteEntry(DN arg0, DeleteOperation arg1)
  throws DirectoryException, CanceledOperationException
  {
@@ -311,6 +310,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void exportLDIF(LDIFExportConfig arg0) throws DirectoryException
  {
  }
@@ -318,6 +318,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void finalizeBackend()
  {
  }
@@ -325,6 +326,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public DN[] getBaseDNs()
  {
    return baseDNs;
@@ -333,6 +335,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public Entry getEntry(DN entryDN)
  throws DirectoryException
  {
@@ -350,6 +353,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public long getEntryCount()
  {
    return configEntries.size();
@@ -358,6 +362,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public Set<String> getSupportedControls()
  {
    return emptyStringSet;
@@ -366,6 +371,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public Set<String> getSupportedFeatures()
  {
    return emptyStringSet;
@@ -374,6 +380,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public ConditionResult hasSubordinates(DN entryDN) throws DirectoryException
  {
    ConfigEntry baseEntry = configEntries.get(entryDN);
@@ -394,6 +401,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public LDIFImportResult importLDIF(LDIFImportConfig arg0)
  throws DirectoryException
  {
@@ -403,6 +411,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void initializeBackend()
  throws ConfigException, InitializationException
  {
@@ -411,6 +420,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean isIndexed(AttributeType arg0, IndexType arg1)
  {
    return false;
@@ -419,6 +429,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean isLocal()
  {
    return true;
@@ -427,6 +438,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public long numSubordinates(DN entryDN, boolean subtree)
  throws DirectoryException
  {
@@ -455,6 +467,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void preloadEntryCache() throws UnsupportedOperationException
  {
  }
@@ -462,6 +475,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void removeBackup(BackupDirectory arg0, String arg1)
  throws DirectoryException
  {
@@ -470,6 +484,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void renameEntry(DN arg0, Entry arg1, ModifyDNOperation arg2)
  throws DirectoryException, CanceledOperationException
  {
@@ -478,6 +493,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void replaceEntry(Entry arg0, Entry arg1, ModifyOperation arg2)
  throws DirectoryException, CanceledOperationException
  {
@@ -486,6 +502,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void restoreBackup(RestoreConfig arg0) throws DirectoryException
  {
  }
@@ -493,6 +510,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void search(SearchOperation arg0)
  throws DirectoryException, CanceledOperationException
  {
@@ -501,6 +519,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean supportsBackup()
  {
    return false;
@@ -509,6 +528,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean supportsBackup(BackupConfig arg0, StringBuilder arg1)
  {
    return false;
@@ -517,6 +537,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean supportsLDIFExport()
  {
    return false;
@@ -525,6 +546,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean supportsLDIFImport()
  {
    return false;
@@ -533,6 +555,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean supportsRestore()
  {
    return false;
opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java
@@ -26,8 +26,13 @@
 */
package org.opends.guitools.uninstaller;
import org.opends.server.admin.client.cli.DsFrameworkCliReturnCode;
import org.opends.server.admin.client.cli.SecureConnectionCliArgs;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import static org.forgerock.util.Utils.*;
import static org.opends.messages.AdminToolMessages.*;
import static org.opends.messages.QuickSetupMessages.*;
import org.opends.admin.ads.ADSContext;
import org.opends.admin.ads.ServerDescriptor;
@@ -36,37 +41,28 @@
import org.opends.admin.ads.util.ApplicationTrustManager;
import org.opends.guitools.controlpanel.datamodel.ConnectionProtocolPolicy;
import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import static org.forgerock.util.Utils.*;
import static org.opends.messages.AdminToolMessages.*;
import static org.opends.messages.QuickSetupMessages.*;
import org.opends.quicksetup.*;
import org.opends.quicksetup.event.ProgressUpdateEvent;
import org.opends.quicksetup.event.ProgressUpdateListener;
import org.opends.quicksetup.util.PlainTextProgressMessageFormatter;
import org.opends.quicksetup.util.ServerController;
import org.opends.quicksetup.util.Utils;
import org.opends.server.admin.client.cli.DsFrameworkCliReturnCode;
import org.opends.server.admin.client.cli.SecureConnectionCliArgs;
import org.opends.server.tools.ClientException;
import org.opends.server.tools.ToolConstants;
import org.opends.server.tools.dsconfig.LDAPManagementContextFactory;
import org.opends.server.util.StaticUtils;
import org.opends.server.util.cli.*;
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.CLIException;
import org.opends.server.util.cli.ConsoleApplication;
import org.opends.server.util.cli.LDAPConnectionConsoleInteraction;
import org.opends.server.util.cli.Menu;
import org.opends.server.util.cli.MenuBuilder;
import org.opends.server.util.cli.MenuResult;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.Collections;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
@@ -905,17 +901,7 @@
      }
      finally
      {
        if (ctx != null)
        {
          try
          {
            ctx.close();
          }
          catch (Throwable t)
          {
            logger.info(LocalizableMessage.raw("Error closing connection: "+t, t));
          }
        }
        StaticUtils.close(ctx);
      }
      if (!couldConnect)
@@ -984,6 +970,7 @@
      /**
       * {@inheritDoc}
       */
      @Override
      public String getInstallationPath()
      {
        return Installation.getLocal().getRootDirectory().getAbsolutePath();
@@ -991,6 +978,7 @@
      /**
       * {@inheritDoc}
       */
      @Override
      public String getInstancePath()
      {
        String installPath =  getInstallationPath();
@@ -1035,6 +1023,7 @@
      /**
       * {@inheritDoc}
       */
      @Override
      public ProgressStep getCurrentProgressStep()
      {
        return UninstallProgressStep.NOT_STARTED;
@@ -1042,6 +1031,7 @@
      /**
       * {@inheritDoc}
       */
      @Override
      public Integer getRatio(ProgressStep step)
      {
        return 0;
@@ -1049,6 +1039,7 @@
      /**
       * {@inheritDoc}
       */
      @Override
      public LocalizableMessage getSummary(ProgressStep step)
      {
        return null;
@@ -1056,6 +1047,7 @@
      /**
       * {@inheritDoc}
       */
      @Override
      public boolean isFinished()
      {
        return false;
@@ -1063,6 +1055,7 @@
      /**
       * {@inheritDoc}
       */
      @Override
      public boolean isCancellable()
      {
        return false;
@@ -1070,12 +1063,14 @@
      /**
       * {@inheritDoc}
       */
      @Override
      public void cancel()
      {
      }
      /**
       * {@inheritDoc}
       */
      @Override
      public void run()
      {
      }
@@ -1086,6 +1081,7 @@
    {
      application.addProgressUpdateListener(
          new ProgressUpdateListener() {
            @Override
            public void progressUpdate(ProgressUpdateEvent ev) {
              System.out.print(ev.getNewLogs().toString());
              System.out.flush();
@@ -1232,17 +1228,7 @@
    }
    finally
    {
      if (ctx != null)
      {
        try
        {
          ctx.close();
        }
        catch (Throwable t)
        {
          logger.info(LocalizableMessage.raw("Error closing connection: "+t, t));
        }
      }
      StaticUtils.close(ctx);
    }
    if (exceptionOccurred)
    {
@@ -1446,6 +1432,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean isAdvancedMode() {
    return false;
  }
@@ -1455,8 +1442,9 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean isInteractive() {
    if (forceNonInteractive)
    if (!forceNonInteractive)
    {
      return false;
    }
@@ -1481,6 +1469,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean isQuiet() {
    return false;
  }
@@ -1490,6 +1479,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean isScriptFriendly() {
    return false;
  }
@@ -1499,6 +1489,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean isVerbose() {
    return true;
  }
opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
@@ -27,13 +27,9 @@
package org.opends.guitools.uninstaller;
import org.opends.quicksetup.*;
import static org.forgerock.util.Utils.*;
import static org.opends.quicksetup.Step.FINISHED;
import static org.opends.quicksetup.Step.PROGRESS;
import static org.opends.quicksetup.Step.REVIEW;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.opends.admin.ads.ADSContext;
import org.opends.admin.ads.ADSContextException;
import org.opends.admin.ads.ReplicaDescriptor;
@@ -45,9 +41,8 @@
import org.opends.admin.ads.util.PreferredConnection;
import org.opends.guitools.uninstaller.ui.ConfirmUninstallPanel;
import org.opends.guitools.uninstaller.ui.LoginDialog;
import org.opends.quicksetup.*;
import org.opends.quicksetup.ui.*;
import static org.opends.quicksetup.util.Utils.*;
import org.opends.quicksetup.util.BackgroundTask;
import org.opends.quicksetup.util.ServerController;
import org.opends.quicksetup.util.UIKeyStore;
@@ -67,18 +62,20 @@
import org.opends.server.core.DirectoryServer;
import org.opends.server.tools.ConfigureWindowsService;
import org.opends.server.tools.ToolConstants;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.opends.server.util.DynamicConstants;
import org.opends.server.util.StaticUtils;
import static org.forgerock.util.Utils.*;
import static org.opends.messages.AdminToolMessages.*;
import static org.opends.messages.QuickSetupMessages.*;
import static org.opends.quicksetup.Step.*;
import static org.opends.quicksetup.util.Utils.*;
import java.io.*;
import java.net.InetAddress;
import java.net.URI;
import java.security.cert.X509Certificate;
import java.util.*;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import java.awt.event.WindowEvent;
import javax.naming.Context;
@@ -86,7 +83,6 @@
import javax.naming.ldap.InitialLdapContext;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import org.opends.server.util.DynamicConstants;
/**
 * This class is in charge of performing the uninstallation of Open DS.
@@ -156,6 +152,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public LocalizableMessage getFrameTitle() {
    LocalizableMessage title = Utils.getCustomizedObject("INFO_FRAME_UNINSTALL_TITLE",
        INFO_FRAME_UNINSTALL_TITLE.get(
@@ -166,6 +163,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public UserData createUserData() {
    UninstallUserData data = new UninstallUserData();
    data.setTrustManager(super.getTrustManager());
@@ -175,6 +173,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public WizardStep getFirstWizardStep() {
    return Step.CONFIRM_UNINSTALL;
  }
@@ -182,6 +181,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public WizardStep getNextWizardStep(WizardStep step) {
    Step nextStep = null;
    if (step != null && step.equals(Step.CONFIRM_UNINSTALL)) {
@@ -197,6 +197,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public WizardStep getPreviousWizardStep(WizardStep step) {
    Step prevStep = null;
    if (step != null && step.equals(Step.PROGRESS)) {
@@ -212,6 +213,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public WizardStep getFinishedStep() {
    return Step.FINISHED;
  }
@@ -219,6 +221,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean finishOnLeft()
  {
    return false;
@@ -227,6 +230,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean canGoBack(WizardStep step) {
    return false;
  }
@@ -234,6 +238,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean canGoForward(WizardStep step) {
    return false;
  }
@@ -241,6 +246,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean canFinish(WizardStep step) {
    return step == Step.CONFIRM_UNINSTALL;
  }
@@ -255,6 +261,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void nextClicked(WizardStep cStep, QuickSetup qs) {
    if (cStep == PROGRESS) {
      throw new IllegalStateException(
@@ -270,6 +277,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void closeClicked(WizardStep cStep, QuickSetup qs) {
    if (cStep == PROGRESS) {
        if (isFinished()
@@ -343,6 +351,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void quitClicked(WizardStep step, QuickSetup qs) {
    if (step == Step.PROGRESS) {
      throw new IllegalStateException(
@@ -358,6 +367,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public LocalizableMessage getCloseButtonToolTip() {
    return INFO_CLOSE_BUTTON_UNINSTALL_TOOLTIP.get();
  }
@@ -365,6 +375,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public LocalizableMessage getFinishButtonToolTip() {
    return INFO_FINISH_BUTTON_UNINSTALL_TOOLTIP.get();
  }
@@ -372,6 +383,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public LocalizableMessage getFinishButtonLabel() {
    return INFO_FINISH_BUTTON_UNINSTALL_LABEL.get();
  }
@@ -379,6 +391,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void previousClicked(WizardStep cStep, QuickSetup qs) {
    if (cStep == PROGRESS) {
      throw new IllegalStateException(
@@ -393,6 +406,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void notifyListeners(Integer ratio, LocalizableMessage currentPhaseSummary,
      final LocalizableMessage newLogDetail)
  {
@@ -404,6 +418,7 @@
    {
      SwingUtilities.invokeLater(new Runnable()
      {
        @Override
        public void run()
        {
          if (startProgressDlg != null)
@@ -422,10 +437,12 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean finishClicked(final WizardStep cStep, final QuickSetup qs) {
    if (cStep == Step.CONFIRM_UNINSTALL) {
      BackgroundTask<UninstallData> worker =
        new BackgroundTask<UninstallData>() {
        @Override
        public UninstallData processBackgroundTask() throws UserDataException {
          try {
            updateUserUninstallDataForConfirmUninstallPanel(qs);
@@ -440,6 +457,7 @@
          }
        }
        @Override
        public void backgroundTaskCompleted(UninstallData returnValue,
                                            Throwable throwable) {
          qs.getDialog().workerFinished();
@@ -560,6 +578,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void updateUserData(WizardStep step, QuickSetup qs) {
    // do nothing;
  }
@@ -567,6 +586,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void setWizardDialogState(QuickSetupDialog dlg,
                                      UserData userData,
                                      WizardStep step) {
@@ -582,8 +602,8 @@
  /**
   * {@inheritDoc}
   * @param launcher
   */
  @Override
  public UserData createUserData(Launcher launcher)
          throws UserDataException, ApplicationException {
    parser = (UninstallerArgumentParser)launcher.getArgumentParser();
@@ -596,6 +616,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public String getInstallationPath() {
    return getInstallPathFromClasspath();
  }
@@ -603,6 +624,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public String getInstancePath() {
    return getInstancePathFromInstallPath(getInstallPathFromClasspath());
  }
@@ -614,6 +636,7 @@
   * @return the ApplicationException that might occur during installation or
   *         <CODE>null</CODE> if no exception occurred.
   */
  @Override
  public ApplicationException getRunError() {
    return ue;
  }
@@ -621,6 +644,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public ReturnCode getReturnCode() {
    return null;
  }
@@ -789,6 +813,7 @@
  /**
   * Actually performs the uninstall in this thread.  The thread is blocked.
   */
  @Override
  public void run() {
    runStarted = true;
    logger.info(LocalizableMessage.raw("run of the Uninstaller started"));
@@ -983,6 +1008,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public ProgressStep getCurrentProgressStep() {
    return status;
  }
@@ -995,6 +1021,7 @@
   * @return an integer that specifies which percentage of the whole
   *         uninstallation has been completed.
   */
  @Override
  public Integer getRatio(ProgressStep step) {
    return hmRatio.get(step);
  }
@@ -1007,6 +1034,7 @@
   * @return an formatted representation of the summary for the specified
   *         UninstallProgressStep.
   */
  @Override
  public LocalizableMessage getSummary(ProgressStep step) {
    return hmSummary.get(step);
  }
@@ -1014,6 +1042,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean isFinished() {
    return getCurrentProgressStep() ==
            UninstallProgressStep.FINISHED_SUCCESSFULLY
@@ -1028,6 +1057,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean isCancellable() {
    return false;
  }
@@ -1035,6 +1065,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void cancel() {
    // do nothing; not cancellable
  }
@@ -1042,6 +1073,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void windowClosing(QuickSetupDialog dlg, WindowEvent evt) {
    if ((dlg.getDisplayedStep() == PROGRESS) ||
        (dlg.getDisplayedStep() == FINISHED)) {
@@ -1056,6 +1088,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public ButtonName getInitialFocusButtonName() {
    return ButtonName.FINISH;
  }
@@ -1063,6 +1096,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public Set<? extends WizardStep> getWizardSteps() {
    Set<WizardStep> setSteps = new HashSet<WizardStep>();
    setSteps.add(Step.CONFIRM_UNINSTALL);
@@ -1074,6 +1108,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public QuickSetupStepPanel createWizardStepPanel(WizardStep step) {
    QuickSetupStepPanel p = null;
    if (step == Step.CONFIRM_UNINSTALL) {
@@ -1217,36 +1252,28 @@
       */
      int totalRatio = 0;
      ArrayList<Integer> cumulatedRatio = new ArrayList<Integer>();
      for (int i = 0; i < rootFiles.length; i++) {
        File f = rootFiles[i];
      for (File f : rootFiles) {
        if (filter.accept(f)) {
          Installation installation = getInstallation();
          int relativeRatio;
          if (equalsOrDescendant(rootFiles[i],
                  installation.getLibrariesDirectory())) {
          if (equalsOrDescendant(f, installation.getLibrariesDirectory())) {
            relativeRatio = 10;
          } else
          if (equalsOrDescendant(rootFiles[i],
                  installation.getBinariesDirectory())) {
          if (equalsOrDescendant(f, installation.getBinariesDirectory())) {
            relativeRatio = 5;
          } else
          if (equalsOrDescendant(rootFiles[i],
                  installation.getConfigurationDirectory())) {
          if (equalsOrDescendant(f, installation.getConfigurationDirectory())) {
            relativeRatio = 5;
          } else
          if (equalsOrDescendant(rootFiles[i],
                  installation.getBackupDirectory())) {
          if (equalsOrDescendant(f, installation.getBackupDirectory())) {
            relativeRatio = 20;
          } else
          if (equalsOrDescendant(rootFiles[i],
                  installation.getLdifDirectory())) {
          if (equalsOrDescendant(f, installation.getLdifDirectory())) {
            relativeRatio = 20;
          } else if (equalsOrDescendant(rootFiles[i],
                  installation.getDatabasesDirectory())) {
          } else if (equalsOrDescendant(f, installation.getDatabasesDirectory())) {
            relativeRatio = 50;
          } else
          if (equalsOrDescendant(rootFiles[i],
                  installation.getLogsDirectory())) {
          if (equalsOrDescendant(f, installation.getLogsDirectory())) {
            relativeRatio = 30;
          } else {
            relativeRatio = 2;
@@ -1258,12 +1285,13 @@
        }
      }
      Iterator<Integer> it = cumulatedRatio.iterator();
      for (int i = 0; i < rootFiles.length; i++) {
      for (File rootFile : rootFiles)
      {
        int beforeRatio = minRatio +
                ((it.next() * (maxRatio - minRatio)) / totalRatio);
        hmRatio.put(UninstallProgressStep.DELETING_INSTALLATION_FILES,
                beforeRatio);
        deleteRecursively(rootFiles[i], filter);
        deleteRecursively(rootFile, filter);
      }
      hmRatio.put(UninstallProgressStep.DELETING_INSTALLATION_FILES, maxRatio);
    }
@@ -1314,8 +1342,9 @@
      } else {
        File[] children = cfile.listFiles();
        if (children != null) {
          for (int i = 0; i < children.length; i++) {
            deleteRecursively(children[i], filter);
          for (File element : children)
          {
            deleteRecursively(element, filter);
          }
        }
        if (filter != null) {
@@ -1397,26 +1426,27 @@
   * required to know which are the files that can be deleted directly and which
   * not.
   */
  class InstallationFilesToDeleteFilter implements FileFilter {
    Installation installation = getInstallation();
    File quicksetupFile = installation.getQuicksetupJarFile();
    File openDSFile = installation.getOpenDSJarFile();
    File librariesFile = installation.getLibrariesDirectory();
    File resourcesDir = installation.getResourcesDirectory();
    File classesDir = installation.getClassesDirectory();
    File uninstallBatFile = installation.getUninstallBatFile();
  private class InstallationFilesToDeleteFilter implements FileFilter {
    private Installation installation = getInstallation();
    private File quicksetupFile = installation.getQuicksetupJarFile();
    private File openDSFile = installation.getOpenDSJarFile();
    private File librariesFile = installation.getLibrariesDirectory();
    private File resourcesDir = installation.getResourcesDirectory();
    private File classesDir = installation.getClassesDirectory();
    private File uninstallBatFile = installation.getUninstallBatFile();
    boolean canDeleteResourcesDir =
    private boolean canDeleteResourcesDir =
      !Utils.directoryExistsAndIsNotEmpty(resourcesDir.getAbsolutePath());
    boolean canDeleteClassesDir =
    private boolean canDeleteClassesDir =
      !Utils.directoryExistsAndIsNotEmpty(classesDir.getAbsolutePath());
    File installationPath = installation.getRootDirectory();
    private File installationPath = installation.getRootDirectory();
    /**
     * {@inheritDoc}
     */
    @Override
    public boolean accept(File file) {
      UninstallUserData userData = getUninstallUserData();
      boolean[] uData = {
@@ -1490,6 +1520,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public ApplicationTrustManager getTrustManager()
  {
    return getUninstallUserData().getTrustManager();
@@ -1543,6 +1574,7 @@
    final Boolean[] returnValue = new Boolean[] {Boolean.FALSE};
    Thread t = new Thread(new Runnable()
    {
      @Override
      public void run()
      {
        try
@@ -1553,6 +1585,7 @@
          returnValue[0] = isServerRunning;
          SwingUtilities.invokeLater(new Runnable()
          {
            @Override
            public void run()
            {
              if (isServerRunning)
@@ -1625,6 +1658,7 @@
      BackgroundTask<TopologyCache> worker = new BackgroundTask<TopologyCache>()
      {
        @Override
        public TopologyCache processBackgroundTask() throws Throwable
        {
          logger.info(LocalizableMessage.raw("Loading Topology Cache in askForAuthentication"));
@@ -1635,6 +1669,7 @@
          cache.reloadTopology();
          return cache;
        }
        @Override
        public void backgroundTaskCompleted(TopologyCache returnValue,
            Throwable throwable) {
          qs.getDialog().workerFinished();
@@ -1830,6 +1865,7 @@
        BackgroundTask<TopologyCache> worker =
          new BackgroundTask<TopologyCache>()
        {
          @Override
          public TopologyCache processBackgroundTask() throws Throwable
          {
            logger.info(LocalizableMessage.raw("Reloading topology"));
@@ -1837,6 +1873,7 @@
            cache.reloadTopology();
            return cache;
          }
          @Override
          public void backgroundTaskCompleted(TopologyCache returnValue,
              Throwable throwable) {
            qs.getDialog().workerFinished();
@@ -2050,16 +2087,7 @@
      }
      finally
      {
        if (ctx != null)
        {
          try
          {
            ctx.close();
          }
          catch (Throwable t)
          {
          }
        }
        StaticUtils.close(ctx);
      }
    }
  }
@@ -2128,10 +2156,10 @@
      String[] domainNames = sync.listReplicationDomains();
      if (domainNames != null)
      {
        for (int i=0; i<domainNames.length; i++)
        for (String domainName : domainNames)
        {
          ReplicationDomainCfgClient domain =
            sync.getReplicationDomain(domainNames[i]);
            sync.getReplicationDomain(domainName);
          Set<String> replServers = domain.getReplicationServer();
          if (replServers != null)
          {
@@ -2157,7 +2185,7 @@
              }
              else
              {
                sync.removeReplicationDomain(domainNames[i]);
                sync.removeReplicationDomain(domainName);
                sync.commit();
              }
            }
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/BuildInformation.java
@@ -30,24 +30,20 @@
import static org.opends.messages.QuickSetupMessages.*;
import static org.opends.server.util.SetupUtils.*;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.opends.quicksetup.util.Utils;
import org.opends.server.util.DynamicConstants;
import org.opends.server.util.SetupUtils;
import org.opends.server.util.StaticUtils;
import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import java.io.InputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.OutputStream;
/**
 * Represents information about the current build that is
@@ -172,20 +168,7 @@
          INFO_ERROR_CREATING_BUILD_INFO.get(), ie);
    } finally {
      done[0] = true;
      if (is != null) {
        try {
          is.close();
        } catch (IOException e) {
          // ignore;
        }
      }
      if (out != null) {
        try {
          out.close();
        } catch (IOException e) {
          // ignore;
        }
      }
      StaticUtils.close(is, out);
    }
    // Make sure we got values for important properties that are used
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/FileManager.java
@@ -24,18 +24,16 @@
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Portions Copyright 2012-2014 ForgeRock AS.
 */
package org.opends.quicksetup.util;
import org.forgerock.i18n.LocalizableMessage;
import static org.opends.messages.QuickSetupMessages.*;
import org.opends.quicksetup.*;
import java.io.*;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.opends.quicksetup.*;
import org.opends.server.util.StaticUtils;
import static org.opends.messages.QuickSetupMessages.*;
/**
 * Utility class for use by applications containing methods for managing
@@ -452,6 +450,7 @@
    /**
     * {@inheritDoc}
     */
    @Override
    public FileOperation copyForChild(File child) {
      return new CopyOperation(child, destination, overwrite);
    }
@@ -468,6 +467,7 @@
    /**
     * {@inheritDoc}
     */
    @Override
    public void apply() throws ApplicationException {
      File objectFile = getObjectFile();
      if (objectFile.isDirectory()) {
@@ -527,20 +527,7 @@
                      ReturnCode.FILE_SYSTEM_ACCESS_ERROR,
                      errMsg, null);
            } finally {
              if (fis != null) {
                try {
                  fis.close();
                } catch (IOException e) {
                  // ignore;
                }
              }
              if (fos != null) {
                try {
                  fos.close();
                } catch (IOException e) {
                  // ignore;
                }
              }
              StaticUtils.close(fis, fos);
            }
          } else {
            LocalizableMessage errMsg = INFO_ERROR_COPYING_FILE.get(
@@ -589,6 +576,7 @@
    /**
     * {@inheritDoc}
     */
    @Override
    public FileOperation copyForChild(File child) {
      return new DeleteOperation(child, deletionPolicy);
    }
@@ -596,6 +584,7 @@
    /**
     * {@inheritDoc}
     */
    @Override
    public void apply() throws ApplicationException {
      File file = getObjectFile();
      boolean isFile = file.isFile();
@@ -682,6 +671,7 @@
    /**
     * {@inheritDoc}
     */
    @Override
    public FileOperation copyForChild(File child) {
      return new MoveOperation(child, destination);
    }
@@ -689,6 +679,7 @@
    /**
     * {@inheritDoc}
     */
    @Override
    public void apply() throws ApplicationException {
      File objectFile = getObjectFile();
      if (destination.exists()) {
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/ServerController.java
@@ -24,28 +24,25 @@
 *      Copyright 2008-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.opends.quicksetup.util;
import org.opends.admin.ads.util.ConnectionUtils;
import static org.opends.messages.QuickSetupMessages.*;
import static org.opends.quicksetup.util.Utils.*;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import static org.opends.messages.QuickSetupMessages.*;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.opends.admin.ads.util.ConnectionUtils;
import org.opends.quicksetup.*;
import static org.opends.quicksetup.util.Utils.*;
import org.opends.quicksetup.installer.InstallerHelper;
import org.opends.server.tools.ToolConstants;
import org.opends.server.util.SetupUtils;
import org.opends.server.util.StaticUtils;
import javax.naming.NamingException;
import javax.naming.ldap.InitialLdapContext;
import java.util.ArrayList;
import java.util.Map;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
@@ -490,17 +487,7 @@
            }
            finally
            {
              if (ctx != null)
              {
                try
                {
                  ctx.close();
                }
                catch (Throwable t)
                {
                  // do nothing
                }
              }
              StaticUtils.close(ctx);
            }
            if (!connected)
            {
@@ -581,6 +568,7 @@
      isFirstLine = true;
      Thread t = new Thread(new Runnable() {
        @Override
        public void run() {
          try {
            String line = reader.readLine();
@@ -665,6 +653,7 @@
      Thread t = new Thread(new Runnable()
      {
        @Override
        public void run()
        {
          try
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/Utils.java
@@ -28,34 +28,14 @@
import static org.forgerock.util.Utils.*;
import static org.opends.messages.QuickSetupMessages.*;
import static org.opends.server.util.DynamicConstants.SHORT_NAME;
import static org.opends.server.util.DynamicConstants.*;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.RandomAccessFile;
import java.io.*;
import java.net.InetAddress;
import java.text.SimpleDateFormat;
import java.util.*;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import javax.naming.AuthenticationException;
import javax.naming.CommunicationException;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.NamingSecurityException;
import javax.naming.NoPermissionException;
import javax.naming.*;
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
import javax.naming.ldap.InitialLdapContext;
@@ -69,8 +49,10 @@
import org.opends.admin.ads.SuffixDescriptor;
import org.opends.admin.ads.TopologyCacheException;
import org.opends.admin.ads.util.ConnectionUtils;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.i18n.LocalizableMessageDescriptor;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.opends.quicksetup.*;
import org.opends.quicksetup.installer.AuthenticationData;
import org.opends.quicksetup.installer.DataReplicationOptions;
@@ -687,15 +669,7 @@
    { /* do nothing */
    } finally
    {
      if (raf != null)
      {
        try
        {
          raf.close();
        } catch (IOException ex2)
        { /* do nothing */
        }
      }
      StaticUtils.close(raf);
      if (file != null)
      {
        file.delete();
opendj3-server-dev/src/server/org/opends/server/admin/client/ManagementContext.java
@@ -22,12 +22,11 @@
 *
 *
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.opends.server.admin.client;
import java.io.Closeable;
import java.util.Set;
import java.util.SortedSet;
@@ -45,12 +44,10 @@
import org.opends.server.admin.client.spi.Driver;
import org.opends.server.admin.std.client.RootCfgClient;
/**
 * Client management connection context.
 */
public abstract class ManagementContext {
public abstract class ManagementContext implements Closeable {
  /**
   * Creates a new management context.
@@ -520,6 +517,7 @@
  /**
   * Closes this management context.
   */
  @Override
  public final void close() {
    this.getDriver().close();
  }
opendj3-server-dev/src/server/org/opends/server/admin/client/cli/DsFrameworkCliAds.java
@@ -36,7 +36,6 @@
import java.util.List;
import java.util.Set;
import javax.naming.NamingException;
import javax.naming.ldap.InitialLdapContext;
import org.opends.admin.ads.ADSContext;
@@ -48,6 +47,7 @@
import com.forgerock.opendj.cli.SubCommand;
import static org.opends.server.admin.client.cli.DsFrameworkCliReturnCode.*;
import static org.opends.server.util.StaticUtils.*;
/**
 * This class is handling server group CLI.
@@ -57,7 +57,7 @@
  /**
   * The subcommand Parser.
   */
  DsFrameworkCliParser argParser ;
  private DsFrameworkCliParser argParser;
  /**
   * The enumeration containing the different subCommand names.
@@ -74,24 +74,23 @@
     */
    DELETE_ADS("delete-ads");
    // String representation of the value.
    /** String representation of the value. */
    private final String name;
    // Private constructor.
    /** Private constructor. */
    private SubCommandNameEnum(String name)
    {
      this.name = name;
    }
    /**
     * {@inheritDoc}
     */
    /** {@inheritDoc} */
    @Override
    public String toString()
    {
      return name;
    }
    // A lookup table for resolving a unit from its name.
    /** A lookup table for resolving a unit from its name. */
    private static final List<String> nameToSubCmdName ;
    static
    {
@@ -144,33 +143,29 @@
   */
  private String groupName;
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public Set<SubCommand> getSubCommands()
  {
    return subCommands;
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public boolean isHidden()
  {
    return isHidden ;
    return isHidden;
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public String getGroupName()
  {
    return groupName ;
    return groupName;
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void initializeCliGroup(DsFrameworkCliParser argParser,
      BooleanArgument verboseArg)
      throws ArgumentException
@@ -205,18 +200,16 @@
    deleteAdsSubCmd.addArgument(deleteAdsBackendNameArg);
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public boolean isSubCommand(SubCommand subCmd)
  {
      return SubCommandNameEnum.isSubCommand(subCmd.getName());
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public DsFrameworkCliReturnCode performSubCommand(SubCommand subCmd,
      OutputStream outStream, OutputStream errStream)
      throws ADSContextException, ArgumentException
@@ -228,7 +221,6 @@
    try
    {
      //
      // create-ads subcommand
      if (subCmd.getName().equals(createAdsSubCmd.getName()))
      {
@@ -269,29 +261,11 @@
    }
    catch (ADSContextException e)
    {
      if (ctx != null)
      {
        try
        {
          ctx.close();
        }
        catch (NamingException x)
        {
        }
      }
      throw e;
    }
    // Close the connection, if needed
    if (ctx != null)
    finally
    {
      try
      {
        ctx.close();
      }
      catch (NamingException x)
      {
      }
      close(ctx);
    }
    // return part
opendj3-server-dev/src/server/org/opends/server/admin/client/cli/DsFrameworkCliGlobalAdmin.java
@@ -26,13 +26,12 @@
 */
package org.opends.server.admin.client.cli;
import static org.opends.messages.AdminMessages.*;
import static org.opends.messages.DSConfigMessages.*;
import static org.opends.messages.ToolMessages.*;
import static org.opends.server.admin.client.cli.DsFrameworkCliReturnCode.*;
import static org.opends.server.tools.ToolConstants.*;
import static org.opends.server.util.StaticUtils.*;
import java.io.OutputStream;
import java.io.PrintStream;
@@ -44,7 +43,6 @@
import java.util.Map;
import java.util.Set;
import javax.naming.NamingException;
import javax.naming.ldap.InitialLdapContext;
import org.opends.admin.ads.ADSContext;
@@ -62,25 +60,26 @@
import com.forgerock.opendj.cli.SubCommand;
import org.opends.server.util.table.TableBuilder;
import org.opends.server.util.table.TextTablePrinter;
/**
 * This class is handling user Admin CLI.
 */
public class DsFrameworkCliGlobalAdmin implements DsFrameworkCliSubCommandGroup
{
  // Strings used in property help.
  private final static LocalizableMessage DESCRIPTION_OPTIONS_TITLE =
  private static final LocalizableMessage DESCRIPTION_OPTIONS_TITLE =
    INFO_DSCFG_HELP_DESCRIPTION_OPTION.get();
  private final static LocalizableMessage DESCRIPTION_OPTIONS_READ =
  private static final LocalizableMessage DESCRIPTION_OPTIONS_READ =
    INFO_DSCFG_HELP_DESCRIPTION_READ.get();
  private final static LocalizableMessage DESCRIPTION_OPTIONS_WRITE =
  private static final LocalizableMessage DESCRIPTION_OPTIONS_WRITE =
    INFO_DSCFG_HELP_DESCRIPTION_WRITE.get();
  private final static LocalizableMessage DESCRIPTION_OPTIONS_MANDATORY =
  private static final LocalizableMessage DESCRIPTION_OPTIONS_MANDATORY =
    INFO_DSCFG_HELP_DESCRIPTION_MANDATORY.get();
  private final static LocalizableMessage DESCRIPTION_OPTIONS_SINGLE =
  private static final LocalizableMessage DESCRIPTION_OPTIONS_SINGLE =
    INFO_DSCFG_HELP_DESCRIPTION_SINGLE_VALUED.get();
  /**
@@ -124,25 +123,23 @@
    SET_ADMIN_USER_PROPERTIES("set-admin-user-properties");
    // String representation of the value.
    /** String representation of the value. */
    private final String name;
    // Private constructor.
    /** Private constructor. */
    private SubCommandNameEnum(String name)
    {
      this.name = name;
    }
    /**
     * {@inheritDoc}
     */
    /** {@inheritDoc} */
    @Override
    public String toString()
    {
      return name;
    }
    // A lookup table for resolving a unit from its name.
    /** A lookup table for resolving a unit from its name. */
    private static final List<String> nameToSubCmdName;
    static
    {
@@ -248,33 +245,29 @@
   */
  private String groupName;
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public Set<SubCommand> getSubCommands()
  {
    return subCommands;
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public boolean isHidden()
  {
    return isHidden;
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public String getGroupName()
  {
    return groupName;
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void initializeCliGroup(DsFrameworkCliParser argParser,
      BooleanArgument verboseArg) throws ArgumentException
  {
@@ -415,17 +408,15 @@
    }
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public boolean isSubCommand(SubCommand subCmd)
  {
    return SubCommandNameEnum.isSubCommand(subCmd.getName());
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public DsFrameworkCliReturnCode performSubCommand(SubCommand subCmd,
      OutputStream outStream, OutputStream errStream)
      throws ADSContextException, ArgumentException
@@ -629,29 +620,11 @@
    }
    catch (ADSContextException e)
    {
      if (ctx != null)
      {
        try
        {
          ctx.close();
        }
        catch (NamingException x)
        {
        }
      }
      throw e;
    }
    // Close the connection, if needed
    if (ctx != null)
    finally
    {
      try
      {
        ctx.close();
      }
      catch (NamingException x)
      {
      }
      close(ctx);
    }
    // return part
@@ -821,7 +794,7 @@
    return map;
  }
  //Compute the options field.
  /** Compute the options field. */
  private String getPropertyOptionSummary(AdministratorProperty adminUserProp)
  {
    Argument arg = userAdminProperties.get(adminUserProp);
opendj3-server-dev/src/server/org/opends/server/admin/client/cli/DsFrameworkCliServer.java
@@ -26,13 +26,12 @@
 */
package org.opends.server.admin.client.cli;
import static org.opends.messages.AdminMessages.*;
import static org.opends.messages.DSConfigMessages.*;
import static org.opends.messages.ToolMessages.*;
import static org.opends.server.admin.client.cli.DsFrameworkCliReturnCode.*;
import static org.opends.server.tools.ToolConstants.*;
import static org.opends.server.util.StaticUtils.*;
import java.io.OutputStream;
import java.io.PrintStream;
@@ -44,15 +43,14 @@
import java.util.Map;
import java.util.Set;
import javax.naming.NamingException;
import javax.naming.ldap.InitialLdapContext;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.opends.admin.ads.ADSContext;
import org.opends.admin.ads.ADSContextException;
import org.opends.admin.ads.ADSContext.ServerProperty;
import org.opends.admin.ads.ADSContextException.ErrorType;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.opends.server.tools.dsconfig.ArgumentExceptionFactory;
import com.forgerock.opendj.cli.Argument;
import com.forgerock.opendj.cli.ArgumentException;
@@ -62,25 +60,26 @@
import com.forgerock.opendj.cli.SubCommand;
import org.opends.server.util.table.TableBuilder;
import org.opends.server.util.table.TextTablePrinter;
/**
 * This class is handling server group CLI.
 */
public class DsFrameworkCliServer implements DsFrameworkCliSubCommandGroup
{
  // Strings used in property help.
  private final static LocalizableMessage DESCRIPTION_OPTIONS_TITLE =
  private static final LocalizableMessage DESCRIPTION_OPTIONS_TITLE =
    INFO_DSCFG_HELP_DESCRIPTION_OPTION.get();
  private final static LocalizableMessage DESCRIPTION_OPTIONS_READ =
  private static final LocalizableMessage DESCRIPTION_OPTIONS_READ =
    INFO_DSCFG_HELP_DESCRIPTION_READ.get();
  private final static LocalizableMessage DESCRIPTION_OPTIONS_WRITE =
  private static final LocalizableMessage DESCRIPTION_OPTIONS_WRITE =
    INFO_DSCFG_HELP_DESCRIPTION_WRITE.get();
  private final static LocalizableMessage DESCRIPTION_OPTIONS_MANDATORY =
  private static final LocalizableMessage DESCRIPTION_OPTIONS_MANDATORY =
    INFO_DSCFG_HELP_DESCRIPTION_MANDATORY.get();
  private final static LocalizableMessage DESCRIPTION_OPTIONS_SINGLE =
  private static final LocalizableMessage DESCRIPTION_OPTIONS_SINGLE =
    INFO_DSCFG_HELP_DESCRIPTION_SINGLE_VALUED.get();
  /**
@@ -123,25 +122,23 @@
     */
    LIST_SERVER_PROPERTIES("list-server-properties");
    // String representation of the value.
    /** String representation of the value. */
    private final String name;
    // Private constructor.
    /** Private constructor. */
    private SubCommandNameEnum(String name)
    {
      this.name = name;
    }
    /**
     * {@inheritDoc}
     */
    /** {@inheritDoc} */
    @Override
    public String toString()
    {
      return name;
    }
    // A lookup table for resolving a unit from its name.
    /** A lookup table for resolving a unit from its name. */
    private static final List<String> nameToSubCmdName;
    static
    {
@@ -245,33 +242,29 @@
   */
  private String groupName;
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public Set<SubCommand> getSubCommands()
  {
    return subCommands;
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public boolean isHidden()
  {
    return isHidden;
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public String getGroupName()
  {
    return groupName;
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void initializeCliGroup(DsFrameworkCliParser argParser,
      BooleanArgument verboseArg) throws ArgumentException
  {
@@ -574,17 +567,15 @@
    }
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public boolean isSubCommand(SubCommand subCmd)
  {
    return SubCommandNameEnum.isSubCommand(subCmd.getName());
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public DsFrameworkCliReturnCode performSubCommand(SubCommand subCmd,
      OutputStream outStream, OutputStream errStream)
      throws ADSContextException, ArgumentException
@@ -811,44 +802,25 @@
      }
      else
      {
        // Should never occurs: If we are here, it means that the code
        // to
        // Should never occurs: If we are here, it means that the code to
        // handle to subcommand is not yet written.
        returnCode = ERROR_UNEXPECTED;
      }
    }
    catch (ADSContextException e)
    {
      if (ctx != null)
      {
        try
        {
          ctx.close();
        }
        catch (NamingException x)
        {
        }
      }
      throw e;
    }
    // Close the connection, if needed
    if (ctx != null)
    finally
    {
      try
      {
        ctx.close();
      }
      catch (NamingException x)
      {
      }
      close(ctx);
    }
    // return part
    return returnCode;
  }
  // Compute the options field.
  /** Compute the options field. */
  private String getPropertyOptionSummary(Argument arg)
  {
    StringBuilder b = new StringBuilder();
opendj3-server-dev/src/server/org/opends/server/admin/client/cli/DsFrameworkCliServerGroup.java
@@ -39,11 +39,9 @@
import java.util.Map;
import java.util.Set;
import javax.naming.NamingException;
import javax.naming.ldap.InitialLdapContext;
import javax.naming.ldap.Rdn;
import org.opends.admin.ads.ADSContext;
import org.opends.admin.ads.ADSContextException;
import org.opends.admin.ads.ADSContext.ServerGroupProperty;
@@ -55,6 +53,8 @@
import com.forgerock.opendj.cli.SubCommand;
import static org.opends.server.admin.client.cli.DsFrameworkCliReturnCode.*;
import static org.opends.server.util.StaticUtils.*;
/**
 * This class is handling server group CLI.
 */
@@ -69,12 +69,12 @@
  /**
   * The subcommand Parser.
   */
  DsFrameworkCliParser argParser ;
  private DsFrameworkCliParser argParser ;
  /**
   * The verbose argument.
   */
  BooleanArgument verboseArg ;
  private BooleanArgument verboseArg ;
  /**
   * The enumeration containing the different subCommand names.
@@ -121,24 +121,23 @@
     */
    REMOVE_FROM_GROUP("remove-from-group");
    // String representation of the value.
    /** String representation of the value. */
    private final String name;
    // Private constructor.
    /** Private constructor. */
    private SubCommandNameEnum(String name)
    {
      this.name = name;
    }
    /**
     * {@inheritDoc}
     */
    /** {@inheritDoc} */
    @Override
    public String toString()
    {
      return name;
    }
    // A lookup table for resolving a unit from its name.
    /** A lookup table for resolving a unit from its name. */
    private static final List<String> nameToSubCmdName ;
    static
    {
@@ -287,33 +286,29 @@
    return attributeDisplayName.get(prop);
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public Set<SubCommand> getSubCommands()
  {
    return subCommands;
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public boolean isHidden()
  {
    return isHidden;
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public String getGroupName()
  {
    return groupName ;
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void initializeCliGroup(DsFrameworkCliParser argParser,
      BooleanArgument verboseArg)
      throws ArgumentException
@@ -451,18 +446,16 @@
        OPTION_LONG_MEMBERNAME);
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public boolean isSubCommand(SubCommand subCmd)
  {
      return SubCommandNameEnum.isSubCommand(subCmd.getName());
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public DsFrameworkCliReturnCode performSubCommand(SubCommand subCmd,
      OutputStream outStream, OutputStream errStream)
      throws ADSContextException, ArgumentException
@@ -568,7 +561,7 @@
          int uidLength = 0 ;
          for (ServerGroupProperty sgp : ServerGroupProperty.values())
          {
            int cur = attributeDisplayName.get(sgp).toString().length();
            int cur = attributeDisplayName.get(sgp).length();
            if (cur > uidLength)
            {
              uidLength = cur;
@@ -877,34 +870,15 @@
    }
    catch (ADSContextException e)
    {
     if (ctx != null)
     {
       try
       {
         ctx.close();
       }
       catch (NamingException x)
       {
       }
     }
     throw e;
    }
    // Close the connection, if needed
    if (ctx != null)
    finally
    {
      try
      {
        ctx.close();
      }
      catch (NamingException x)
      {
      }
      close(ctx);
    }
    // return part
    return returnCode;
  }
  /**
opendj3-server-dev/src/server/org/opends/server/backends/SchemaBackend.java
@@ -26,8 +26,6 @@
 */
package org.opends.server.backends;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -52,12 +50,16 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
import javax.crypto.Mac;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.util.Reject;
import org.opends.server.admin.Configuration;
import org.opends.server.admin.std.server.SchemaBackendCfg;
import org.opends.server.admin.server.ConfigurationChangeListener;
import org.opends.server.admin.std.server.SchemaBackendCfg;
import org.opends.server.api.AlertGenerator;
import org.opends.server.api.Backend;
import org.opends.server.api.ClientConnection;
@@ -71,7 +73,6 @@
import org.opends.server.core.ModifyDNOperation;
import org.opends.server.core.SchemaConfigManager;
import org.opends.server.core.SearchOperation;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.opends.server.schema.AttributeTypeSyntax;
import org.opends.server.schema.DITContentRuleSyntax;
import org.opends.server.schema.DITStructureRuleSyntax;
@@ -81,12 +82,10 @@
import org.opends.server.schema.NameFormSyntax;
import org.opends.server.schema.ObjectClassSyntax;
import org.opends.server.types.*;
import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.util.DynamicConstants;
import org.opends.server.util.LDIFException;
import org.opends.server.util.LDIFReader;
import org.opends.server.util.LDIFWriter;
import org.forgerock.util.Reject;
import static org.opends.messages.BackendMessages.*;
import static org.opends.messages.ConfigMessages.*;
@@ -4029,22 +4028,7 @@
    }
    finally
    {
      if (inputStream != null)
      {
        try
        {
          inputStream.close();
        }
        catch (Exception e)
        {
          logger.traceException(e);
        }
      }
      if (outputStream != null)
      {
        outputStream.close();
      }
      close(inputStream, outputStream);
    }
  }
@@ -4227,14 +4211,7 @@
    }
    finally
    {
      try
      {
        ldifWriter.close();
      }
      catch (Exception e)
      {
        logger.traceException(e);
      }
      close(ldifWriter);
    }
  }
@@ -4315,7 +4292,7 @@
    }
    finally
    {
      reader.close();
      close(reader);
    }
  }
@@ -4749,6 +4726,8 @@
    LocalizableMessage message = ERR_SCHEMA_BACKUP_ZIP_COMMENT.get(
            DynamicConstants.PRODUCT_NAME,
            backupID);
    try
    {
    zipStream.setComment(String.valueOf(message));
    if (compress)
@@ -4786,13 +4765,7 @@
    catch (Exception e)
    {
      logger.traceException(e);
      try
      {
        zipStream.close();
      } catch (Exception e2)
      {
    }
      close(zipStream);
      message = ERR_SCHEMA_BACKUP_CANNOT_BACKUP_SCHEMA_FILE.get(commentName,
          stackTraceToSingleLineString(e));
@@ -4889,23 +4862,7 @@
        } catch (Exception e)
        {
          logger.traceException(e);
           try
          {
            if (inputStream != null)
            {
              inputStream.close();
            }
          } catch (Exception e2)
          {
          }
           try
          {
            zipStream.close();
          } catch (Exception e2)
          {
          }
          close(inputStream, zipStream);
          message = ERR_SCHEMA_BACKUP_CANNOT_BACKUP_SCHEMA_FILE.get(baseName,
              stackTraceToSingleLineString(e));
@@ -4914,24 +4871,25 @@
        }
      }
    // We're done writing the file, so close the zip stream (which should also
    // close the underlying stream).
    try
    {
      zipStream.close();
    }
    catch (Exception e)
    finally
    {
      logger.traceException(e);
      // We're done writing the file, so close the zip stream
      // (which should also close the underlying stream).
      try
      {
        zipStream.close();
      }
      catch (Exception e)
      {
        logger.traceException(e);
      message = ERR_SCHEMA_BACKUP_CANNOT_CLOSE_ZIP_STREAM.get(
          filename, backupDirectory.getPath(), stackTraceToSingleLineString(e));
      throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
                                   message, e);
        message = ERR_SCHEMA_BACKUP_CANNOT_CLOSE_ZIP_STREAM.get(
            filename, backupDirectory.getPath(), stackTraceToSingleLineString(e));
        throw new DirectoryException(DirectoryServer.getServerErrorResultCode(), message, e);
      }
    }
    // Get the digest or MAC bytes if appropriate.
    byte[] digestBytes = null;
    byte[] macBytes    = null;
opendj3-server-dev/src/server/org/opends/server/backends/jeb/BackendImpl.java
@@ -236,13 +236,7 @@
      } catch (Exception e) {
        logger.traceException(e);
      } finally {
        if (fis != null) {
          try {
            fis.close();
          } catch (Exception e) {
            logger.traceException(e);
          }
        }
        close(fis);
      }
    }
opendj3-server-dev/src/server/org/opends/server/backends/jeb/EntryCachePreloader.java
@@ -24,14 +24,9 @@
 *      Copyright 2008 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.opends.server.backends.jeb;
import com.sleepycat.je.Cursor;
import com.sleepycat.je.CursorConfig;
import com.sleepycat.je.DatabaseEntry;
import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.LockMode;
import com.sleepycat.je.OperationStatus;
import com.sleepycat.je.*;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
@@ -43,14 +38,16 @@
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.api.DirectoryThread;
import org.opends.server.core.DirectoryServer;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.opends.server.types.Entry;
import org.forgerock.opendj.ldap.ByteString;
import static org.opends.server.util.StaticUtils.*;
import static org.opends.messages.ExtensionMessages.*;
import static org.opends.server.util.StaticUtils.*;
/**
 * This class defines a utility that will be used to pre-load the Directory
@@ -177,6 +174,7 @@
    Timer timer = new Timer();
    TimerTask progressTask = new TimerTask() {
      // Persistent state restore progress report.
      @Override
      public void run() {
        if (processedEntries.get() > 0) {
          long freeMemory =
@@ -339,20 +337,11 @@
            status = cursor.getNext(key, data, LockMode.DEFAULT);
            if (status != OperationStatus.SUCCESS) {
              // Reset cursor and continue.
              if (cursor != null) {
                try {
                  cursor.close();
                } catch (DatabaseException de) {
                  logger.traceException(de);
                }
                status = OperationStatus.SUCCESS;
                cursor = null;
                continue;
              }
              close(cursor);
              status = OperationStatus.SUCCESS;
              cursor = null;
            } else {
              entryQueue.put(new PreloadEntry(data.getData(),
                key.getData()));
              continue;
              entryQueue.put(new PreloadEntry(data.getData(), key.getData()));
            }
          } catch (InterruptedException e) {
            return;
@@ -361,14 +350,7 @@
          }
        }
      } finally {
        // Always close cursor.
        if (cursor != null) {
          try {
            cursor.close();
          } catch (DatabaseException de) {
            logger.traceException(de);
          }
        }
        close(cursor);
      }
    }
  }
opendj3-server-dev/src/server/org/opends/server/backends/jeb/importLDIF/Importer.java
@@ -960,7 +960,7 @@
    }
    finally
    {
      StaticUtils.close(reader);
      close(reader);
      if (!skipDNValidation)
      {
        try
@@ -1319,7 +1319,7 @@
          }
          finally
          {
            cursor.close();
            close(cursor);
          }
        }
      }
@@ -1417,7 +1417,7 @@
          }
          finally
          {
            cursor.close();
            close(cursor);
          }
        }
      }
@@ -2022,29 +2022,7 @@
      }
      finally
      {
        if (bufferFile != null)
        {
          try
          {
            bufferFile.close();
          }
          catch (IOException ignored)
          {
            // Ignore.
          }
        }
        if (bufferIndexFile != null)
        {
          try
          {
            bufferIndexFile.close();
          }
          catch (IOException ignored)
          {
            // Ignore.
          }
        }
        close(bufferFile, bufferIndexFile);
        indexMgr.getBufferFile().delete();
        indexMgr.getBufferIndexFile().delete();
@@ -2671,8 +2649,7 @@
      }
      finally
      {
        bufferStream.close();
        bufferIndexStream.close();
        close(bufferStream, bufferIndexStream);
        indexMgr.setBufferInfo(bufferCount, indexMgr.getBufferFile().length());
      }
      return null;
@@ -3257,7 +3234,6 @@
          entriesProcessed.getAndIncrement();
        }
        flushIndexBuffers();
        cursor.close();
      }
      catch (Exception e)
      {
@@ -3268,7 +3244,7 @@
      }
      finally
      {
        cursor.close();
        close(cursor);
      }
      return null;
    }
@@ -4689,10 +4665,7 @@
      }
      finally
      {
        if (cursor != null)
        {
          cursor.close();
        }
        close(cursor);
      }
      return inserted;
    }
@@ -4713,9 +4686,7 @@
      OperationStatus status = cursor.putCurrent(newVal);
      if (status != OperationStatus.SUCCESS)
      {
        LocalizableMessage message =
            LocalizableMessage.raw("Add of DN to DN cache failed.");
        throw new JebException(message);
        throw new JebException(LocalizableMessage.raw("Add of DN to DN cache failed."));
      }
    }
@@ -4768,10 +4739,7 @@
      }
      finally
      {
        if (cursor != null)
        {
          cursor.close();
        }
        close(cursor);
      }
      return dnExists;
    }
opendj3-server-dev/src/server/org/opends/server/core/DefaultCompressedSchema.java
@@ -26,12 +26,6 @@
 */
package org.opends.server.core;
import static org.opends.messages.CoreMessages.*;
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.util.StaticUtils.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -41,15 +35,17 @@
import java.util.Map.Entry;
import org.forgerock.i18n.LocalizableMessage;
import org.opends.server.api.CompressedSchema;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.io.ASN1;
import org.forgerock.opendj.io.ASN1Reader;
import org.forgerock.opendj.io.ASN1Writer;
import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.api.CompressedSchema;
import org.opends.server.types.DirectoryException;
import static org.opends.messages.CoreMessages.*;
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.util.StaticUtils.*;
/**
 * This class provides a default implementation of a compressed schema manager
@@ -179,17 +175,7 @@
    }
    finally
    {
      try
      {
        if (inputStream != null)
        {
          inputStream.close();
        }
      }
      catch (final Exception e)
      {
        logger.traceException(e);
      }
      close(inputStream);
    }
  }
opendj3-server-dev/src/server/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java
@@ -38,6 +38,9 @@
import javax.net.ssl.*;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DecodeException;
import org.opends.server.admin.server.ConfigurationChangeListener;
import org.opends.server.admin.std.meta.
  LDAPPassThroughAuthenticationPolicyCfgDefn.MappingPolicy;
@@ -46,8 +49,6 @@
import org.opends.server.config.ConfigException;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.ModifyOperation;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.DecodeException;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.opends.server.protocols.ldap.*;
import org.opends.server.schema.GeneralizedTimeSyntax;
@@ -56,7 +57,7 @@
import org.opends.server.tools.LDAPReader;
import org.opends.server.tools.LDAPWriter;
import org.opends.server.types.*;
import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.util.StaticUtils;
import org.opends.server.util.TimeThread;
import static org.opends.messages.ExtensionMessages.*;
@@ -918,26 +919,8 @@
        }
        // Close all IO resources.
        writer.close();
        reader.close();
        try
        {
          ldapSocket.close();
        }
        catch (final IOException e)
        {
          logger.traceException(e);
        }
        try
        {
          plainSocket.close();
        }
        catch (final IOException e)
        {
          logger.traceException(e);
        }
        StaticUtils.close(writer, reader);
        StaticUtils.close(ldapSocket, plainSocket);
      }
@@ -1359,37 +1342,12 @@
          {
            // Connection creation failed for some reason, so clean up IO
            // resources.
            if (reader != null)
            {
              reader.close();
            }
            if (writer != null)
            {
              writer.close();
            }
            if (ldapSocket != null)
            {
              try
              {
                ldapSocket.close();
              }
              catch (final IOException ignored)
              {
                // Ignore.
              }
            }
            StaticUtils.close(reader, writer);
            StaticUtils.close(ldapSocket);
            if (ldapSocket != plainSocket)
            {
              try
              {
                plainSocket.close();
              }
              catch (final IOException ignored)
              {
                // Ignore.
              }
              StaticUtils.close(plainSocket);
            }
          }
        }
@@ -1792,10 +1750,7 @@
              }
              finally
              {
                if (connection != null)
                {
                  connection.close();
                }
                StaticUtils.close(connection);
              }
            }
@@ -1843,10 +1798,7 @@
          }
          finally
          {
            if (connection != null)
            {
              connection.close();
            }
            StaticUtils.close(connection);
          }
        }
        finally
@@ -2363,14 +2315,7 @@
        }
        finally
        {
          try
          {
            br.close();
          }
          catch (Exception e)
          {
            // Ignored.
          }
          StaticUtils.close(br);
        }
      }
    }
opendj3-server-dev/src/server/org/opends/server/replication/server/ReplicationServer.java
@@ -34,6 +34,7 @@
import java.util.concurrent.atomic.AtomicReference;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.opends.server.admin.server.ConfigurationChangeListener;
import org.opends.server.admin.std.meta.VirtualAttributeCfgDefn.*;
import org.opends.server.admin.std.server.ReplicationServerCfg;
@@ -43,7 +44,6 @@
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.WorkflowImpl;
import org.opends.server.core.networkgroups.NetworkGroup;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.opends.server.replication.common.*;
import org.opends.server.replication.plugin.MultimasterReplication;
import org.opends.server.replication.protocol.*;
@@ -655,16 +655,7 @@
    }
    // shutdown the listener thread
    try
    {
      if (listenSocket != null)
      {
        listenSocket.close();
      }
    } catch (IOException e)
    {
      // replication Server service is closing anyway.
    }
    close(listenSocket);
    // shutdown the listen thread
    if (listenThread != null)
opendj3-server-dev/src/server/org/opends/server/tools/LDAPReader.java
@@ -32,14 +32,15 @@
import java.net.Socket;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.io.ASN1;
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.io.ASN1Reader;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DecodeException;
import org.opends.server.protocols.ldap.LDAPMessage;
import org.opends.server.types.LDAPException;
import org.opends.server.types.RecordingInputStream;
import org.opends.server.util.ServerConstants;
import org.opends.server.util.StaticUtils;
/**
 * This class defines a utility that can be used to read LDAP messages from a
@@ -104,14 +105,8 @@
      ByteString bytesRead = debugInputStream.getRecordedBytes();
      debugInputStream.clearRecordedBytes();
      StringBuilder builder = new StringBuilder();
      builder.append("bytes read from wire(len=");
      builder.append(bytesRead.length());
      builder.append("):");
      builder.append(ServerConstants.EOL);
      builder.append(bytesRead.toHexPlusAsciiString(4));
      logger.trace(builder.toString());
      logger.trace("bytes read from wire(len=" + bytesRead.length() + "):"
          + ServerConstants.EOL + bytesRead.toHexPlusAsciiString(4));
      logger.trace(message.toString());
    }
@@ -124,25 +119,7 @@
  @Override
  public void close()
  {
    try
    {
      asn1Reader.close();
    }
    catch (Exception e)
    {
      logger.traceException(e);
    }
    if (socket != null)
    {
      try
      {
        socket.close();
      }
      catch (Exception e)
      {
        logger.traceException(e);
      }
    }
    StaticUtils.close(asn1Reader);
    StaticUtils.close(socket);
  }
}
opendj3-server-dev/src/server/org/opends/server/tools/LDAPSearch.java
@@ -34,14 +34,18 @@
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import org.opends.admin.ads.util.ConnectionUtils;
import org.forgerock.i18n.LocalizableMessage;
import org.opends.server.controls.*;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DecodeException;
import org.opends.admin.ads.util.ConnectionUtils;
import org.opends.server.controls.*;
import org.opends.server.protocols.ldap.*;
import org.opends.server.types.*;
import org.opends.server.util.Base64;
import org.opends.server.util.EmbeddedUtils;
import org.opends.server.util.PasswordReader;
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.ArgumentParser;
import com.forgerock.opendj.cli.BooleanArgument;
@@ -49,15 +53,13 @@
import com.forgerock.opendj.cli.IntegerArgument;
import com.forgerock.opendj.cli.MultiChoiceArgument;
import com.forgerock.opendj.cli.StringArgument;
import org.forgerock.opendj.ldap.DecodeException;
import org.opends.server.types.*;
import org.forgerock.opendj.ldap.ByteString;
import static org.opends.messages.ToolMessages.*;
import static org.opends.server.protocols.ldap.LDAPConstants.*;
import static org.opends.server.protocols.ldap.LDAPResultCode.*;
import static org.opends.server.tools.ToolConstants.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import static org.opends.server.tools.ToolConstants.*;
/**
 * This class provides a tool that can be used to issue search requests to the
@@ -1644,15 +1646,8 @@
      }
      finally
      {
        if(in != null)
        {
          try
          {
           in.close();
          } catch (IOException ioe) {}
        }
        close(in);
      }
    }
    if(filters.isEmpty())
opendj3-server-dev/src/server/org/opends/server/tools/LDIFSearch.java
@@ -27,7 +27,6 @@
package org.opends.server.tools;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.ArrayList;
@@ -39,27 +38,13 @@
import org.opends.server.core.DirectoryServer;
import org.opends.server.extensions.ConfigFileHandler;
import org.opends.server.protocols.ldap.LDAPResultCode;
import org.opends.server.types.AttributeType;
import org.opends.server.types.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.ExistingFileBehavior;
import org.opends.server.types.InitializationException;
import org.opends.server.types.LDIFExportConfig;
import org.opends.server.types.LDIFImportConfig;
import org.opends.server.types.NullOutputStream;
import org.opends.server.types.ObjectClass;
import org.opends.server.types.SearchFilter;
import org.opends.server.types.SearchScope;
import org.opends.server.types.*;
import org.opends.server.util.BuildVersion;
import org.opends.server.util.LDIFException;
import org.opends.server.util.LDIFReader;
import org.opends.server.util.LDIFWriter;
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.ArgumentParser;
import com.forgerock.opendj.cli.BooleanArgument;
import com.forgerock.opendj.cli.IntegerArgument;
import com.forgerock.opendj.cli.MultiChoiceArgument;
import com.forgerock.opendj.cli.StringArgument;
import com.forgerock.opendj.cli.*;
import static org.opends.messages.ToolMessages.*;
import static org.opends.server.tools.ToolConstants.*;
@@ -336,13 +321,7 @@
      }
      finally
      {
        if(in != null)
        {
          try
          {
           in.close();
          } catch (IOException ioe) {}
        }
        close(in);
      }
      ArrayList<String> trailingArguments = argParser.getTrailingArguments();
@@ -705,11 +684,7 @@
    }
    catch (Exception e)
    {
      try
      {
        reader.close();
      } catch (Exception e2) {}
      close(reader);
      err.println(ERR_LDIFSEARCH_CANNOT_CREATE_WRITER.get(e));
      return 1;
    }
opendj3-server-dev/src/server/org/opends/server/tools/WaitForFileDelete.java
@@ -26,28 +26,19 @@
 */
package org.opends.server.tools;
import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.RandomAccessFile;
import java.io.*;
import org.forgerock.i18n.LocalizableMessage;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.NullOutputStream;
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.ArgumentParser;
import com.forgerock.opendj.cli.BooleanArgument;
import com.forgerock.opendj.cli.IntegerArgument;
import com.forgerock.opendj.cli.StringArgument;
import org.opends.server.util.cli.ConsoleApplication;
import static org.opends.messages.ToolMessages.*;
import com.forgerock.opendj.cli.*;
import static org.opends.messages.CoreMessages.*;
import static org.opends.messages.ToolMessages.*;
import static org.opends.server.util.StaticUtils.*;
/**
 * This program provides a simple tool that will wait for a specified file to be
 * deleted before exiting.  It can be used in the process of confirming that the
@@ -394,14 +385,7 @@
      }
    }
    if (outputFile != null)
    {
      try
      {
        outputFile.close();
      }
      catch (Throwable t) {}
    }
    close(outputFile);
    if (targetFile.exists())
    {
@@ -419,6 +403,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean isAdvancedMode()
  {
    return false;
@@ -427,6 +412,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean isInteractive()
  {
    return false;
@@ -435,6 +421,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean isMenuDrivenMode()
  {
    return false;
@@ -443,6 +430,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean isQuiet()
  {
    return false;
@@ -451,6 +439,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean isScriptFriendly()
  {
    return false;
@@ -459,6 +448,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean isVerbose()
  {
    return false;
opendj3-server-dev/src/server/org/opends/server/tools/status/StatusCli.java
@@ -27,11 +27,6 @@
package org.opends.server.tools.status;
import static org.opends.messages.AdminToolMessages.*;
import static org.opends.messages.QuickSetupMessages.*;
import static org.opends.messages.ToolMessages.*;
import static org.opends.quicksetup.util.Utils.*;
import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
@@ -42,12 +37,12 @@
import java.util.Set;
import java.util.TreeSet;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import javax.naming.NamingException;
import javax.naming.ldap.InitialLdapContext;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.opends.admin.ads.util.ApplicationTrustManager;
import org.opends.guitools.controlpanel.datamodel.BackendDescriptor;
import org.opends.guitools.controlpanel.datamodel.BaseDNDescriptor;
@@ -60,7 +55,6 @@
import org.opends.guitools.controlpanel.datamodel.ServerDescriptor;
import org.opends.guitools.controlpanel.util.ControlPanelLog;
import org.opends.guitools.controlpanel.util.Utilities;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.opends.server.admin.AdministrationConnector;
import org.opends.server.admin.client.ManagementContext;
import org.opends.server.admin.client.cli.DsFrameworkCliReturnCode;
@@ -75,12 +69,18 @@
import org.opends.server.types.OpenDsException;
import org.opends.server.util.BuildVersion;
import org.opends.server.util.StaticUtils;
import com.forgerock.opendj.cli.ArgumentException;
import org.opends.server.util.cli.ConsoleApplication;
import org.opends.server.util.cli.LDAPConnectionConsoleInteraction;
import org.opends.server.util.table.TableBuilder;
import org.opends.server.util.table.TextTablePrinter;
import com.forgerock.opendj.cli.ArgumentException;
import static org.opends.messages.AdminToolMessages.*;
import static org.opends.messages.QuickSetupMessages.*;
import static org.opends.messages.ToolMessages.*;
import static org.opends.quicksetup.util.Utils.*;
/**
 * The class used to provide some CLI interface to display status.
 *
@@ -369,12 +369,7 @@
            writeStatus(controlInfo);
            return ErrorReturnCode.USER_CANCELLED_OR_DATA_ERROR.getReturnCode();
          } finally {
            if (ctx != null) {
              try {
                ctx.close();
              } catch (Throwable t) {
              }
            }
            StaticUtils.close(ctx);
          }
        } else {
          bindDn = argParser.getBindDN();
@@ -417,12 +412,7 @@
            return ErrorReturnCode.ERROR_READING_CONFIGURATION_WITH_LDAP.
              getReturnCode();
          } finally {
            if (ctx != null) {
              try {
                ctx.close();
              } catch (Throwable t) {
              }
            }
            StaticUtils.close(ctx);
          }
        } else {
          // The user did not provide authentication: just display the
opendj3-server-dev/src/server/org/opends/server/types/LDIFExportConfig.java
@@ -26,9 +26,6 @@
 */
package org.opends.server.types;
import static org.opends.messages.UtilityMessages.*;
import static org.opends.server.util.StaticUtils.*;
import java.io.*;
import java.util.ArrayList;
import java.util.HashSet;
@@ -38,6 +35,10 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
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
@@ -915,7 +916,6 @@
          return true;
        }
      }
      return false;
    }
@@ -931,16 +931,6 @@
  public void close()
  {
    // FIXME -- Need to add code to generate a signed hash of the LDIF content.
    if (writer != null) {
      try
      {
        writer.close();
      }
      catch (Exception e)
      {
        logger.traceException(e);
      }
    }
    StaticUtils.close(writer);
  }
}
opendj3-server-dev/src/server/org/opends/server/types/LDIFImportConfig.java
@@ -27,22 +27,15 @@
package org.opends.server.types;
import java.io.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.*;
import java.util.zip.GZIPInputStream;
import org.opends.server.tools.makeldif.MakeLDIFInputStream;
import org.opends.server.tools.makeldif.TemplateFile;
import org.opends.server.util.StaticUtils;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import static org.opends.messages.UtilityMessages.*;
/**
 * This class defines a data structure for holding configuration
 * information to use when performing an LDIF import.
@@ -55,10 +48,6 @@
public final class LDIFImportConfig extends OperationConfig
                                    implements Closeable
{
  private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
  /**
   * The default buffer size that will be used when reading LDIF data.
@@ -405,28 +394,24 @@
    {
      return null;
    }
    else
    reader.close();
    InputStream inputStream = ldifInputStream =
         new FileInputStream(ldifFileIterator.next());
    if (isEncrypted)
    {
      reader.close();
      InputStream inputStream = ldifInputStream =
           new FileInputStream(ldifFileIterator.next());
      if (isEncrypted)
      {
        // FIXME -- Add support for encryption with a cipher input
        //          stream.
      }
      if (isCompressed)
      {
        inputStream = new GZIPInputStream(inputStream);
      }
      reader = new BufferedReader(new InputStreamReader(inputStream),
                                  bufferSize);
      return reader;
      // FIXME -- Add support for encryption with a cipher input stream.
    }
    if (isCompressed)
    {
      inputStream = new GZIPInputStream(inputStream);
    }
    reader = new BufferedReader(new InputStreamReader(inputStream), bufferSize);
    return reader;
  }
@@ -564,7 +549,6 @@
      if (skipWriter != null)
      {
        StaticUtils.close(skipWriter);
        skipWriter = null;
      }
@@ -616,7 +600,6 @@
      if (skipWriter != null)
      {
        StaticUtils.close(skipWriter);
        skipWriter = null;
      }
@@ -1312,43 +1295,10 @@
  /**
   * Closes any resources that this import config might have open.
   */
  @Override
  public void close()
  {
    if (reader != null)
    {
      try
      {
        reader.close();
      }
      catch (Exception e)
      {
        logger.traceException(e);
      }
    }
    if (rejectWriter != null)
    {
      try
      {
        rejectWriter.close();
      }
      catch (Exception e)
      {
        logger.traceException(e);
      }
    }
    if (skipWriter != null)
    {
      try
      {
        skipWriter.close();
      }
      catch (Exception e)
      {
        logger.traceException(e);
      }
    }
    StaticUtils.close(reader, rejectWriter, skipWriter);
  }
  /**
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/AssuredReplicationPluginTest.java
@@ -46,6 +46,7 @@
import org.opends.server.replication.common.*;
import org.opends.server.replication.protocol.*;
import org.opends.server.types.*;
import org.opends.server.util.StaticUtils;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -417,25 +418,9 @@
      shutdown = true;
      // Shutdown the listener thread
      try
      {
        if (listenSocket != null)
        {
          listenSocket.close();
        }
      } catch (IOException e)
      {
        // replication Server service is closing anyway.
      }
      /*
       * Shutdown any current client handling code
       */
      if (session != null)
      {
        session.close();
      }
      // Shutdown the listener thread and any current client handling code
      StaticUtils.close(listenSocket);
      StaticUtils.close(session);
      try
      {