From b7e51e19c9bc9a1623feb605633b246ea1b929c1 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.

---
 opends/src/quicksetup/org/opends/quicksetup/util/Utils.java |   44 +++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 43 insertions(+), 1 deletions(-)

diff --git a/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java b/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
index 5b0a3a6..4cb0518 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
+++ b/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