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

jvergara
16.16.2007 8e150d0986ce911fae3f05fd8d5d0d6808dc9cea
Move the code of the empty stream to the Utils class.

Update the number of entries in the zip file so that the progress bar does not go backwards.
2 files modified
71 ■■■■■ changed files
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Launcher.java 27 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java 44 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Launcher.java
@@ -37,7 +37,6 @@
import org.opends.quicksetup.util.Utils;
import java.io.PrintStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -258,7 +257,7 @@
     * problems with the display environment.
     */
    PrintStream printStream = System.err;
    System.setErr(new EmptyPrintStream());
    System.setErr(Utils.getEmptyPrintStream());
    t.start();
    try
    {
@@ -415,28 +414,4 @@
      }
    }
  }
  /**
   * This class is used to avoid displaying the error message related to display
   * problems that we might have when trying to display the SplashWindow.
   *
   */
  private class EmptyPrintStream extends PrintStream {
    /**
     * Default constructor.
     *
     */
    public EmptyPrintStream()
    {
      super(new ByteArrayOutputStream(), true);
    }
    /**
     * {@inheritDoc}
     */
    public void println(String msg)
    {
    }
  }
}
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
@@ -30,11 +30,13 @@
import static org.opends.messages.QuickSetupMessages.*;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.RandomAccessFile;
import java.util.*;
@@ -1065,7 +1067,7 @@
  static public int getNumberZipEntries()
  {
    // TODO  we should get this dynamically during build
    return 83;
    return 165;
  }
  /**
@@ -1372,5 +1374,45 @@
                    getCommandLineMaxLineWidth()));
  }
  private static EmptyPrintStream emptyStream = new EmptyPrintStream();
  /**
   * Returns a printstream that does not write anything to standard output.
   * @return a printstream that does not write anything to standard output.
   */
  public static EmptyPrintStream getEmptyPrintStream()
  {
    if (emptyStream == null)
    {
      emptyStream = new EmptyPrintStream();
    }
    return emptyStream;
  }
}
/**
 * This class is used to avoid displaying the error message related to display
 * problems that we might have when trying to display the SplashWindow.
 *
 */
class EmptyPrintStream extends PrintStream {
  private static final Logger LOG =
    Logger.getLogger(EmptyPrintStream.class.getName());
  /**
   * Default constructor.
   *
   */
  public EmptyPrintStream()
  {
    super(new ByteArrayOutputStream(), true);
  }
  /**
   * {@inheritDoc}
   */
  public void println(String msg)
  {
    LOG.log(Level.INFO, "EmptyStream msg: "+msg);
  }
}