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

Violette Roche-Montane
05.56.2014 4df4b439048aa629e87945af2e4dfac9747e0861
OPENDJ-1303 "opendj-cli"
- Removed && replaced StaticUtils.wrapText by com.forgerock.opendj.cli.Utils.wrapText;

34 files modified
337 ■■■■ changed files
opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ControlPanelLauncher.java 7 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/datamodel/SortableTableModel.java 6 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java 9 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/UninstallLauncher.java 3 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/CliUserInteraction.java 4 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/QuickSetupCli.java 8 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/admin/client/cli/SecureConnectionCliParser.java 2 ●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/extensions/SMTPAlertHandler.java 16 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/tools/BackUpDB.java 1 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/tools/ConfigureDS.java 1 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/tools/ConfigureWindowsService.java 1 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/tools/DBTest.java 1 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/tools/EncodePassword.java 1 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/tools/ExportLDIF.java 1 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/tools/ImportLDIF.java 1 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/tools/LDAPCompare.java 1 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/tools/LDAPDelete.java 1 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/tools/LDAPModify.java 1 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/tools/LDAPPasswordModify.java 1 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/tools/LDAPSearch.java 1 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/tools/LDIFModify.java 1 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/tools/LDIFSearch.java 1 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/tools/ListBackends.java 1 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/tools/ManageAccount.java 1 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/tools/RebuildIndex.java 1 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/tools/RestoreDB.java 4 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/tools/StopDS.java 1 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/tools/VerifyIndex.java 1 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/tools/makeldif/MakeLDIF.java 1 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/tools/tasks/TaskTool.java 2 ●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeCli.java 3 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/util/StaticUtils.java 206 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/util/args/LDAPConnectionArgumentParser.java 2 ●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/util/cli/PointAdder.java 45 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ControlPanelLauncher.java
@@ -30,7 +30,7 @@
import static org.opends.messages.AdminToolMessages.*;
import static org.opends.messages.ToolMessages.*;
import static org.opends.server.util.ServerConstants.MAX_LINE_WIDTH;
import static org.opends.server.util.StaticUtils.wrapText;
import static com.forgerock.opendj.cli.Utils.wrapText;
import java.io.File;
import java.io.PrintStream;
@@ -47,7 +47,6 @@
import org.opends.server.types.InitializationException;
import org.opends.server.util.BuildVersion;
import org.opends.server.util.DynamicConstants;
import org.opends.server.util.StaticUtils;
import com.forgerock.opendj.cli.ArgumentException;
/**
@@ -134,14 +133,14 @@
        }
        if (logFileName != null)
        {
          System.err.println(StaticUtils.wrapText(
          System.err.println(wrapText(
              ERR_CONTROL_PANEL_LAUNCHER_GUI_LAUNCH_FAILED_DETAILS.get(
                  logFileName),
                  Utils.getCommandLineMaxLineWidth()));
        }
        else
        {
          System.err.println(StaticUtils.wrapText(
          System.err.println(wrapText(
              ERR_CONTROL_PANEL_LAUNCHER_GUI_LAUNCH_FAILED.get(),
              Utils.getCommandLineMaxLineWidth()));
        }
opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/datamodel/SortableTableModel.java
@@ -27,13 +27,15 @@
package org.opends.guitools.controlpanel.datamodel;
import static com.forgerock.opendj.cli.Utils.wrapText;
import javax.swing.table.AbstractTableModel;
import org.opends.guitools.controlpanel.ui.ColorAndFontConstants;
import org.opends.guitools.controlpanel.util.Utilities;
import org.forgerock.i18n.LocalizableMessage;
import org.opends.server.util.ServerConstants;
import org.opends.server.util.StaticUtils;
/**
 * A generic interface that must implement table models that are sortable.
@@ -93,7 +95,7 @@
  protected String getHeader(LocalizableMessage msg, int wrap)
  {
    String text = msg.toString();
    String wrappedText = StaticUtils.wrapText(text, wrap);
    String wrappedText = wrapText(text, wrap);
    wrappedText = wrappedText.replaceAll(ServerConstants.EOL, "<br>");
    return "<html>"+Utilities.applyFont(wrappedText,
        ColorAndFontConstants.headerFont);
opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java
@@ -134,6 +134,7 @@
import org.opends.server.util.StaticUtils;
import static org.opends.server.types.CommonSchemaElements.*;
import static com.forgerock.opendj.cli.Utils.wrapText;
/**
 * A static class that provides miscellaneous functions.
@@ -268,7 +269,7 @@
    }
    String msg = getStringFromCollection(stringErrors, "<br>");
    String plainText = msg.replaceAll("<br>", ServerConstants.EOL);
    String wrappedText = StaticUtils.wrapText(plainText, 70);
    String wrappedText = wrapText(plainText, 70);
    wrappedText = wrappedText.replaceAll(ServerConstants.EOL, "<br>");
    JOptionPane.showMessageDialog(
        parentComponent, "<html>"+wrappedText,
@@ -291,7 +292,7 @@
      LocalizableMessage title, LocalizableMessage msg)
  {
    String plainText = msg.toString().replaceAll("<br>", ServerConstants.EOL);
    String wrappedText = StaticUtils.wrapText(plainText, 70);
    String wrappedText = wrapText(plainText, 70);
    wrappedText = wrappedText.replaceAll(ServerConstants.EOL, "<br>");
    return JOptionPane.YES_OPTION == JOptionPane.showOptionDialog(
        parentComponent, "<html>"+wrappedText,
@@ -314,7 +315,7 @@
      LocalizableMessage title, LocalizableMessage msg)
  {
    String plainText = msg.toString().replaceAll("<br>", ServerConstants.EOL);
    String wrappedText = StaticUtils.wrapText(plainText, 70);
    String wrappedText = wrapText(plainText, 70);
    wrappedText = wrappedText.replaceAll(ServerConstants.EOL, "<br>");
    JOptionPane.showMessageDialog(
        parentComponent, "<html>"+wrappedText,
@@ -1025,7 +1026,7 @@
  public static void updatePreferredSize(JEditorPane pane, int nCols,
      String plainText, Font font, boolean applyBackground)
  {
    String wrappedText = StaticUtils.wrapText(plainText, nCols);
    String wrappedText = wrapText(plainText, nCols);
    wrappedText = wrappedText.replaceAll(ServerConstants.EOL, "<br>");
    if (applyBackground)
    {
opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/UninstallLauncher.java
@@ -30,6 +30,7 @@
import static org.opends.messages.AdminToolMessages.*;
import static org.opends.messages.ToolMessages.ERR_ERROR_PARSING_ARGS;
import static com.forgerock.opendj.util.OperatingSystem.isWindows;
import static com.forgerock.opendj.cli.Utils.wrapText;
import org.forgerock.i18n.LocalizableMessage;
import org.opends.messages.ToolMessages;
@@ -152,7 +153,7 @@
    {
      LocalizableMessage message =
        ToolMessages.ERR_CANNOT_INITIALIZE_ARGS.get(ae.getMessage());
      System.err.println(org.opends.server.util.StaticUtils.wrapText(message,
      System.err.println(wrapText(message,
          Utils.getCommandLineMaxLineWidth()));
    }
  }
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/CliUserInteraction.java
@@ -31,9 +31,9 @@
import org.forgerock.i18n.LocalizableMessageBuilder;
import static org.opends.messages.AdminToolMessages.*;
import static com.forgerock.opendj.cli.Utils.wrapText;
import org.opends.quicksetup.util.Utils;
import org.opends.server.util.StaticUtils;
import com.forgerock.opendj.cli.ClientException;
import com.forgerock.opendj.cli.ConsoleApplication;
import com.forgerock.opendj.cli.Menu;
@@ -170,7 +170,7 @@
  private void println(String text) {
    text = Utils.convertHtmlBreakToLineSeparator(text);
    text = Utils.stripHtml(text);
    text = StaticUtils.wrapText(text, Utils.getCommandLineMaxLineWidth());
    text = wrapText(text, Utils.getCommandLineMaxLineWidth());
    getErrorStream().println(text);
  }
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/QuickSetupCli.java
@@ -27,6 +27,7 @@
package org.opends.quicksetup;
import static com.forgerock.opendj.cli.Utils.wrapText;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
@@ -36,7 +37,6 @@
import org.opends.quicksetup.util.Utils;
import org.opends.quicksetup.event.ProgressUpdateListener;
import org.opends.quicksetup.event.ProgressUpdateEvent;
import org.opends.server.util.StaticUtils;
import com.forgerock.opendj.cli.ClientException;
/**
@@ -99,9 +99,7 @@
                      LocalizableMessage newLogs = ev.getNewLogs();
                      if (newLogs != null) {
                        System.out.print(
                                StaticUtils.wrapText(
                                        newLogs,
                                        Utils.getCommandLineMaxLineWidth()));
                                wrapText(newLogs, Utils.getCommandLineMaxLineWidth()));
                      }
                    }
                  });
@@ -141,7 +139,7 @@
    {
      logger.error(LocalizableMessage.raw("UserDataException: "+uude, uude));
      System.err.println();
      System.err.println(StaticUtils.wrapText(uude.getLocalizedMessage(),
      System.err.println(wrapText(uude.getLocalizedMessage(),
              Utils.getCommandLineMaxLineWidth()));
      System.err.println();
      if (uude.getCause() instanceof ClientException)
opendj3-server-dev/src/server/org/opends/server/admin/client/cli/SecureConnectionCliParser.java
@@ -30,7 +30,7 @@
import static com.forgerock.opendj.cli.CliMessages.*;
import static com.forgerock.opendj.cli.Utils.LINE_SEPARATOR;
import static com.forgerock.opendj.cli.Utils.MAX_LINE_WIDTH;
import static org.opends.server.util.StaticUtils.wrapText;
import static com.forgerock.opendj.cli.Utils.wrapText;
import static com.forgerock.opendj.cli.ReturnCode.CONFLICTING_ARGS;
import java.io.IOException;
opendj3-server-dev/src/server/org/opends/server/extensions/SMTPAlertHandler.java
@@ -25,30 +25,28 @@
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.opends.server.extensions;
import org.forgerock.i18n.LocalizableMessage;
import static org.opends.messages.ExtensionMessages.ERR_SMTPALERTHANDLER_NO_SMTP_SERVERS;
import static org.opends.messages.ExtensionMessages.WARN_SMTPALERTHANDLER_ERROR_SENDING_MESSAGE;
import static com.forgerock.opendj.cli.Utils.wrapText;
import java.util.ArrayList;
import java.util.List;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.ResultCode;
import org.opends.server.admin.server.ConfigurationChangeListener;
import org.opends.server.admin.std.server.AlertHandlerCfg;
import org.opends.server.admin.std.server.SMTPAlertHandlerCfg;
import org.opends.server.api.AlertGenerator;
import org.opends.server.api.AlertHandler;
import org.opends.server.core.DirectoryServer;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.opends.server.types.ConfigChangeResult;
import org.opends.server.types.InitializationException;
import org.forgerock.opendj.ldap.ResultCode;
import org.opends.server.util.EMailMessage;
import static org.opends.messages.ExtensionMessages.*;
import static org.opends.server.util.StaticUtils.*;
/**
opendj3-server-dev/src/server/org/opends/server/tools/BackUpDB.java
@@ -79,6 +79,7 @@
import static com.forgerock.opendj.cli.ArgumentConstants.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import static com.forgerock.opendj.cli.Utils.wrapText;
/**
 * This program provides a utility that may be used to back up a Directory
opendj3-server-dev/src/server/org/opends/server/tools/ConfigureDS.java
@@ -82,6 +82,7 @@
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import static com.forgerock.opendj.cli.ArgumentConstants.*;
import static com.forgerock.opendj.cli.Utils.wrapText;
/**
 * This class provides a very basic tool that can be used to configure some of
opendj3-server-dev/src/server/org/opends/server/tools/ConfigureWindowsService.java
@@ -43,6 +43,7 @@
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import static com.forgerock.opendj.util.OperatingSystem.hasUAC;
import static com.forgerock.opendj.cli.Utils.wrapText;
/**
  * This class is used to configure the Windows service for this instance on
opendj3-server-dev/src/server/org/opends/server/tools/DBTest.java
@@ -30,6 +30,7 @@
import static com.forgerock.opendj.cli.ArgumentConstants.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import static com.forgerock.opendj.cli.Utils.wrapText;
import org.forgerock.i18n.LocalizableMessage;
import org.opends.server.admin.std.server.BackendCfg;
opendj3-server-dev/src/server/org/opends/server/tools/EncodePassword.java
@@ -72,6 +72,7 @@
import static com.forgerock.opendj.cli.ArgumentConstants.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import static com.forgerock.opendj.cli.Utils.wrapText;
/**
 * This program provides a utility that may be used to interact with the
opendj3-server-dev/src/server/org/opends/server/tools/ExportLDIF.java
@@ -69,6 +69,7 @@
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import static com.forgerock.opendj.cli.ArgumentConstants.*;
import static com.forgerock.opendj.cli.Utils.wrapText;
import org.opends.server.tools.tasks.TaskTool;
import org.opends.server.admin.std.server.BackendCfg;
opendj3-server-dev/src/server/org/opends/server/tools/ImportLDIF.java
@@ -36,6 +36,7 @@
import static com.forgerock.opendj.cli.ArgumentConstants.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import static com.forgerock.opendj.cli.Utils.wrapText;
import java.io.File;
import java.io.OutputStream;
opendj3-server-dev/src/server/org/opends/server/tools/LDAPCompare.java
@@ -69,6 +69,7 @@
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import static org.opends.server.util.args.LDAPConnectionArgumentParser.*;
import static com.forgerock.opendj.cli.Utils.wrapText;
/**
 * This class provides a tool that can be used to issue compare requests to the
opendj3-server-dev/src/server/org/opends/server/tools/LDAPDelete.java
@@ -66,6 +66,7 @@
import static org.opends.server.util.StaticUtils.*;
import static com.forgerock.opendj.cli.ArgumentConstants.*;
import static org.opends.server.util.args.LDAPConnectionArgumentParser.*;
import static com.forgerock.opendj.cli.Utils.wrapText;
/**
 * This class provides a tool that can be used to issue delete requests to the
opendj3-server-dev/src/server/org/opends/server/tools/LDAPModify.java
@@ -82,6 +82,7 @@
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import static org.opends.server.util.args.LDAPConnectionArgumentParser.*;
import static com.forgerock.opendj.cli.Utils.wrapText;
/**
 * This class provides a tool that can be used to issue modify requests to the
opendj3-server-dev/src/server/org/opends/server/tools/LDAPPasswordModify.java
@@ -64,6 +64,7 @@
import static org.opends.server.util.StaticUtils.*;
import static com.forgerock.opendj.cli.ArgumentConstants.*;
import static org.opends.server.protocols.ldap.LDAPResultCode.*;
import static com.forgerock.opendj.cli.Utils.wrapText;
/**
 * This program provides a utility that uses the LDAP password modify extended
opendj3-server-dev/src/server/org/opends/server/tools/LDAPSearch.java
@@ -61,6 +61,7 @@
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import static org.opends.server.util.args.LDAPConnectionArgumentParser.*;
import static com.forgerock.opendj.cli.Utils.wrapText;
/**
 * This class provides a tool that can be used to issue search requests to the
opendj3-server-dev/src/server/org/opends/server/tools/LDIFModify.java
@@ -76,6 +76,7 @@
import static com.forgerock.opendj.cli.ArgumentConstants.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import static com.forgerock.opendj.cli.Utils.wrapText;
/**
 * This class provides a program that may be used to apply a set of changes (in
opendj3-server-dev/src/server/org/opends/server/tools/LDIFSearch.java
@@ -53,6 +53,7 @@
import static com.forgerock.opendj.cli.ArgumentConstants.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import static com.forgerock.opendj.cli.Utils.wrapText;
/**
 * This class provides a program that may be used to search LDIF files.  It is
opendj3-server-dev/src/server/org/opends/server/tools/ListBackends.java
@@ -65,6 +65,7 @@
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import static com.forgerock.opendj.cli.ArgumentConstants.*;
import static com.forgerock.opendj.cli.Utils.wrapText;
opendj3-server-dev/src/server/org/opends/server/tools/ManageAccount.java
@@ -70,6 +70,7 @@
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import static com.forgerock.opendj.cli.Utils.wrapText;
opendj3-server-dev/src/server/org/opends/server/tools/RebuildIndex.java
@@ -33,6 +33,7 @@
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import static com.forgerock.opendj.cli.Utils.wrapText;
import org.opends.server.util.BuildVersion;
import org.opends.server.util.StaticUtils;
opendj3-server-dev/src/server/org/opends/server/tools/RestoreDB.java
@@ -41,8 +41,6 @@
import org.opends.server.api.Backend;
import org.forgerock.opendj.config.server.ConfigException;
import static org.opends.server.config.ConfigConstants.*;
import org.opends.server.core.CoreConfigManager;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.LockFileManager;
@@ -69,6 +67,8 @@
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import static com.forgerock.opendj.cli.ArgumentConstants.*;
import static org.opends.server.config.ConfigConstants.*;
import static com.forgerock.opendj.cli.Utils.wrapText;
import org.opends.server.tools.tasks.TaskTool;
import org.opends.server.admin.std.server.BackendCfg;
opendj3-server-dev/src/server/org/opends/server/tools/StopDS.java
@@ -74,6 +74,7 @@
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import static com.forgerock.opendj.cli.ArgumentConstants.*;
import static com.forgerock.opendj.cli.Utils.wrapText;
/**
 * This class provides a tool that can send a request to the Directory Server
opendj3-server-dev/src/server/org/opends/server/tools/VerifyIndex.java
@@ -32,6 +32,7 @@
import static com.forgerock.opendj.cli.ArgumentConstants.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import static com.forgerock.opendj.cli.Utils.wrapText;
import java.io.OutputStream;
import java.io.PrintStream;
opendj3-server-dev/src/server/org/opends/server/tools/makeldif/MakeLDIF.java
@@ -54,6 +54,7 @@
import static com.forgerock.opendj.cli.ArgumentConstants.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import static com.forgerock.opendj.cli.Utils.wrapText;
/**
 * This class defines a program that can be used to generate LDIF content based
opendj3-server-dev/src/server/org/opends/server/tools/tasks/TaskTool.java
@@ -34,9 +34,9 @@
import com.forgerock.opendj.cli.StringArgument;
import com.forgerock.opendj.cli.ClientException;
import static org.opends.server.util.StaticUtils.wrapText;
import static org.opends.server.util.StaticUtils.getExceptionMessage;
import static org.opends.server.util.ServerConstants.MAX_LINE_WIDTH;
import static com.forgerock.opendj.cli.Utils.wrapText;
import org.forgerock.opendj.ldap.DecodeException;
import org.opends.server.tools.LDAPConnection;
opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeCli.java
@@ -31,6 +31,7 @@
import static org.opends.server.tools.upgrade.Upgrade.EXIT_CODE_ERROR;
import static org.opends.server.tools.upgrade.Upgrade.EXIT_CODE_SUCCESS;
import static com.forgerock.opendj.cli.ArgumentConstants.*;
import static com.forgerock.opendj.cli.Utils.wrapText;
import java.io.IOException;
import java.io.InputStream;
@@ -427,7 +428,7 @@
        final String defaultOption = getDefaultOption(cc.getDefaultOption());
        StringBuilder prompt =
            new StringBuilder(StaticUtils.wrapText(cc.getPrompt(),
            new StringBuilder(wrapText(cc.getPrompt(),
                ServerConstants.MAX_LINE_WIDTH, 2));
        // Default answers.
opendj3-server-dev/src/server/org/opends/server/util/StaticUtils.java
@@ -3745,212 +3745,6 @@
    }
  }
  /**
   * Inserts line breaks into the provided buffer to wrap text at no more than
   * the specified column width.  Wrapping will only be done at space boundaries
   * and if there are no spaces within the specified width, then wrapping will
   * be performed at the first space after the specified column.
   *
   * @param  message The message to be wrapped.
   * @param  width  The maximum number of characters to allow on a line if there
   *                is a suitable breaking point.
   *
   * @return  The wrapped text.
   */
  public static String wrapText(LocalizableMessage message, int width)
  {
    return wrapText(message.toString(), width, 0);
  }
  /**
   * Inserts line breaks into the provided buffer to wrap text at no more than
   * the specified column width.  Wrapping will only be done at space boundaries
   * and if there are no spaces within the specified width, then wrapping will
   * be performed at the first space after the specified column.
   *
   * @param  text   The text to be wrapped.
   * @param  width  The maximum number of characters to allow on a line if there
   *                is a suitable breaking point.
   *
   * @return  The wrapped text.
   */
  public static String wrapText(String text, int width) {
    return wrapText(text, width, 0);
  }
  /**
   * Inserts line breaks into the provided buffer to wrap text at no
   * more than the specified column width. Wrapping will only be done
   * at space boundaries and if there are no spaces within the
   * specified width, then wrapping will be performed at the first
   * space after the specified column. In addition each line will be
   * indented by the specified amount.
   *
   * @param message
   *          The message to be wrapped.
   * @param width
   *          The maximum number of characters to allow on a line if
   *          there is a suitable breaking point (including any
   *          indentation).
   * @param indent
   *          The number of columns to indent each line.
   * @return The wrapped text.
   */
  public static String wrapText(LocalizableMessage message, int width, int indent)
  {
    return wrapText(message.toString(), width, indent);
  }
  /**
   * Inserts line breaks into the provided buffer to wrap text at no
   * more than the specified column width. Wrapping will only be done
   * at space boundaries and if there are no spaces within the
   * specified width, then wrapping will be performed at the first
   * space after the specified column. In addition each line will be
   * indented by the specified amount.
   *
   * @param text
   *          The text to be wrapped.
   * @param width
   *          The maximum number of characters to allow on a line if
   *          there is a suitable breaking point (including any
   *          indentation).
   * @param indent
   *          The number of columns to indent each line.
   * @return The wrapped text.
   */
  public static String wrapText(String text, int width, int indent)
  {
    Reject.ifFalse(indent >= 0 && indent < width);
    // Calculate the real width and indentation padding.
    width -= indent;
    StringBuilder pb = new StringBuilder();
    for (int i = 0; i < indent; i++) {
      pb.append(' ');
    }
    String padding = pb.toString();
    StringBuilder   buffer        = new StringBuilder();
    if (text != null) {
      StringTokenizer lineTokenizer = new StringTokenizer(text, "\r\n", true);
      while (lineTokenizer.hasMoreTokens())
      {
        String line = lineTokenizer.nextToken();
        if (line.equals("\r") || line.equals("\n"))
        {
          // It's an end-of-line character, so append it as-is.
          buffer.append(line);
        }
        else if (line.length() < width)
        {
          // The line fits in the specified width, so append it as-is.
          buffer.append(padding);
          buffer.append(line);
        }
        else
        {
          // The line doesn't fit in the specified width, so it needs to be
          // wrapped.  Do so at space boundaries.
          StringBuilder   lineBuffer    = new StringBuilder();
          StringBuilder   delimBuffer   = new StringBuilder();
          StringTokenizer wordTokenizer = new StringTokenizer(line, " ", true);
          while (wordTokenizer.hasMoreTokens())
          {
            String word = wordTokenizer.nextToken();
            if (word.equals(" "))
            {
              // It's a space, so add it to the delim buffer only if the line
              // buffer is not empty.
              if (lineBuffer.length() > 0)
              {
                delimBuffer.append(word);
              }
            }
            else if (word.length() > width)
            {
              // This is a long word that can't be wrapped, so we'll just have
              // to make do.
              if (lineBuffer.length() > 0)
              {
                buffer.append(padding);
                buffer.append(lineBuffer);
                buffer.append(EOL);
                lineBuffer = new StringBuilder();
              }
              buffer.append(padding);
              buffer.append(word);
              if (wordTokenizer.hasMoreTokens())
              {
                // The next token must be a space, so remove it.  If there are
                // still more tokens after that, then append an EOL.
                wordTokenizer.nextToken();
                if (wordTokenizer.hasMoreTokens())
                {
                  buffer.append(EOL);
                }
              }
              if (delimBuffer.length() > 0)
              {
                delimBuffer = new StringBuilder();
              }
            }
            else
            {
              // It's not a space, so see if we can fit it on the curent line.
              int newLineLength = lineBuffer.length() + delimBuffer.length() +
                                  word.length();
              if (newLineLength < width)
              {
                // It does fit on the line, so add it.
                lineBuffer.append(delimBuffer).append(word);
                if (delimBuffer.length() > 0)
                {
                  delimBuffer = new StringBuilder();
                }
              }
              else
              {
                // It doesn't fit on the line, so end the current line and start
                // a new one.
                buffer.append(padding);
                buffer.append(lineBuffer);
                buffer.append(EOL);
                lineBuffer = new StringBuilder();
                lineBuffer.append(word);
                if (delimBuffer.length() > 0)
                {
                  delimBuffer = new StringBuilder();
                }
              }
            }
          }
          // If there's anything left in the line buffer, then add it to the
          // final buffer.
          buffer.append(padding);
          buffer.append(lineBuffer);
        }
      }
    }
    return buffer.toString();
  }
  /**
   * Filters the provided value to ensure that it is appropriate for use as an
   * exit code.  Exit code values are generally only allowed to be between 0 and
opendj3-server-dev/src/server/org/opends/server/util/args/LDAPConnectionArgumentParser.java
@@ -56,7 +56,7 @@
import static org.opends.messages.ToolMessages.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import static com.forgerock.opendj.cli.Utils.wrapText;
/**
 * Creates an argument parser pre-populated with arguments for specifying
opendj3-server-dev/src/server/org/opends/server/util/cli/PointAdder.java
@@ -34,7 +34,6 @@
/**
 * Class used to add points periodically to the end of the output.
 *
 */
public class PointAdder implements Runnable
{
@@ -54,9 +53,10 @@
  /**
   * Default constructor.
   * @param app the console application to be used.
   * Creates a PointAdder that writes to the standard output with the default
   * period time.
   *
   * @param app
   *          The console application to be used. Creates a PointAdder that
   *          writes to the standard output with the default period time.
   */
  public PointAdder(ConsoleApplication app)
  {
@@ -66,11 +66,16 @@
  /**
   * Default constructor.
   * @param app the console application to be used.
   * @param periodTime the time between printing two points.
   * @param isError whether the points must be printed in error stream
   * or output stream.
   * @param formatter the text formatter.
   *
   * @param app
   *          The console application to be used.
   * @param periodTime
   *          The time between printing two points.
   * @param isError
   *          Whether the points must be printed in error stream or output
   *          stream.
   * @param formatter
   *          The text formatter.
   */
  public PointAdder(ConsoleApplication app,
      long periodTime, boolean isError,
@@ -94,14 +99,7 @@
    {
      mb.append(formatter.getFormattedPoint());
    }
    if (isError)
    {
      app.print(mb.toMessage());
    }
    else
    {
      app.print(mb.toMessage());
    }
    app.print(mb.toMessage());
    t = new Thread(this);
    t.start();
  }
@@ -127,9 +125,7 @@
    }
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  public void run()
  {
    while (!stopPointAdder)
@@ -137,14 +133,7 @@
      try
      {
        Thread.sleep(periodTime);
        if (isError)
        {
          app.print(formatter.getFormattedPoint());
        }
        else
        {
          app.print(formatter.getFormattedPoint());
        }
        app.print(formatter.getFormattedPoint());
      }
      catch (Throwable t)
      {