From e8831e2f60df14b1dc0044d11a6ab26e084ed3f9 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 15 Jul 2013 08:41:33 +0000
Subject: [PATCH] Created NullOutputStream.wrapOrNullStream() and used it in all tools instead of duplicating the null checks everywhere.

---
 opendj-sdk/opends/src/server/org/opends/server/tools/InstallDS.java |   21 +++------------------
 1 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/InstallDS.java b/opendj-sdk/opends/src/server/org/opends/server/tools/InstallDS.java
index 9e7d8a7..f8ae616 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/InstallDS.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/InstallDS.java
@@ -305,27 +305,11 @@
   public static int mainCLI(String[] args,
       OutputStream outStream, OutputStream errStream, InputStream inStream)
   {
-    PrintStream out;
-    if (outStream == null)
-    {
-      out = NullOutputStream.printStream();
-    }
-    else
-    {
-      out = new PrintStream(outStream);
-    }
+    PrintStream out = NullOutputStream.wrapOrNullStream(outStream);
 
     System.setProperty(Constants.CLI_JAVA_PROPERTY, "true");
 
-    PrintStream err;
-    if (errStream == null)
-    {
-      err = NullOutputStream.printStream();
-    }
-    else
-    {
-      err = new PrintStream(errStream);
-    }
+    PrintStream err = NullOutputStream.wrapOrNullStream(errStream);
 
     try {
       QuickSetupLog.initLogFileHandler(
@@ -568,6 +552,7 @@
     installer.setProgressMessageFormatter(formatter);
     installer.addProgressUpdateListener(
         new ProgressUpdateListener() {
+          @Override
           public void progressUpdate(ProgressUpdateEvent ev) {
             if (ev.getNewLogs() != null)
             {

--
Gitblit v1.10.0