From 8e150d0986ce911fae3f05fd8d5d0d6808dc9cea Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Tue, 16 Oct 2007 14:16:43 +0000
Subject: [PATCH] Move the code of the empty stream to the Utils class.

---
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Launcher.java   |   27 -------------
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java |   44 +++++++++++++++++++++
 2 files changed, 44 insertions(+), 27 deletions(-)

diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Launcher.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Launcher.java
index 7003761..c3eb30f 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Launcher.java
+++ b/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)
-    {
-    }
-  }
-
 }
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
index 5b0a3a6..4cb0518 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
+++ b/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);
+  }
+}
\ No newline at end of file

--
Gitblit v1.10.0