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

jvergara
27.37.2007 8684c89c1cdf8f9b2650688f2ac7d3b8ea48ac29
Fix for issue 2167.

Update the code so that the log messages we received are written to the installer log file and also add some code to supress the output of certain operations in the progress dialog of the installer (in the case of the creation of the top entry).
4 files modified
89 ■■■■ changed files
opends/src/quicksetup/org/opends/quicksetup/Application.java 69 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java 8 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java 6 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java 6 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/Application.java
@@ -83,6 +83,9 @@
  /** Handler for listeners and event firing. */
  protected ProgressUpdateListenerDelegate listenerDelegate;
  private ErrorPrintStream err = new ErrorPrintStream();
  private OutputPrintStream out = new OutputPrintStream();
  /**
   * Creates an application by instantiating the Application class
   * denoted by the System property
@@ -725,6 +728,27 @@
  }
  /**
   * Returns the error stream to be used by the application when launching
   * command lines.
   * @return  the error stream to be used by the application when launching
   * command lines.
   */
  protected ErrorPrintStream getApplicationErrorStream()
  {
    return err;
  }
  /**
   * Returns the output stream to be used by the application when launching
   * command lines.
   * @return  the output stream to be used by the application when launching
   * command lines.
   */
  protected OutputPrintStream getApplicationOutputStream()
  {
    return out;
  }
  /**
   * This class is used to notify the ProgressUpdateListeners of events
   * that are written to the standard error.  It is used in WebStartInstaller
   * and in OfflineInstaller.  These classes just create a ErrorPrintStream and
@@ -791,6 +815,8 @@
    private boolean isFirstLine;
    private boolean notifyListeners = true;
    /**
     * Format a string before sending a listener notification.
     * @param string to format
@@ -814,16 +840,21 @@
    @Override
    public void println(String msg)
    {
      MessageBuilder mb = new MessageBuilder();
      if (isFirstLine)
      if (notifyListeners)
      {
        mb.append(formatString(msg));
      } else
      {
        mb.append(formatter.getLineBreak());
        mb.append(formatString(msg));
        MessageBuilder mb = new MessageBuilder();
        if (isFirstLine)
        {
          mb.append(formatString(msg));
        } else
        {
          mb.append(formatter.getLineBreak());
          mb.append(formatString(msg));
        }
        notifyListeners(mb.toMessage());
      }
      notifyListeners(mb.toMessage());
      LOG.log(Level.INFO, "server: " + msg);
      isFirstLine = false;
    }
@@ -845,5 +876,27 @@
      }
      println(new String(b, off, len));
    }
    /**
     * Notifies the progress update listeners of the application of the message
     * we received.
     * @return <CODE>true</CODE> if we must notify the application listeners
     * of the message and <CODE>false</CODE> otherwise.
     */
    public boolean isNotifyListeners()
    {
      return notifyListeners;
    }
    /**
     * Tells whether we must notify the listeners or not of the message
     * received.
     * @param notifyListeners the boolean that informs of whether we have
     * to notify the listeners or not.
     */
    public void setNotifyListeners(boolean notifyListeners)
    {
      this.notifyListeners = notifyListeners;
    }
  }
}
opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -1002,6 +1002,8 @@
    String[] args = new String[argList.size()];
    argList.toArray(args);
    getApplicationOutputStream().setNotifyListeners(false);
    getApplicationErrorStream().setNotifyListeners(false);
    try
    {
      int result = helper.invokeImportLDIF(args);
@@ -1018,7 +1020,11 @@
          ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR,
          getThrowableMsg(INFO_ERROR_CREATING_BASE_ENTRY.get(), t), t);
    }
    finally
    {
      getApplicationOutputStream().setNotifyListeners(true);
      getApplicationErrorStream().setNotifyListeners(true);
    }
    notifyListeners(getFormattedDone());
  }
opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
@@ -88,10 +88,8 @@
    try
    {
      PrintStream err = new ErrorPrintStream();
      PrintStream out = new OutputPrintStream();
      System.setErr(err);
      System.setOut(out);
      System.setErr(getApplicationErrorStream());
      System.setOut(getApplicationOutputStream());
      checkAbort();
opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
@@ -107,10 +107,8 @@
    PrintStream origOut = System.out;
    try
    {
      PrintStream err = new ErrorPrintStream();
      PrintStream out = new OutputPrintStream();
      System.setErr(err);
      System.setOut(out);
      System.setErr(getApplicationErrorStream());
      System.setOut(getApplicationOutputStream());
      setCurrentProgressStep(InstallProgressStep.DOWNLOADING);