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

---
 opends/src/server/org/opends/server/tools/ManageAccount.java |   29 ++++-------------------------
 1 files changed, 4 insertions(+), 25 deletions(-)

diff --git a/opends/src/server/org/opends/server/tools/ManageAccount.java b/opends/src/server/org/opends/server/tools/ManageAccount.java
index c9f12fc..8dadf2f 100644
--- a/opends/src/server/org/opends/server/tools/ManageAccount.java
+++ b/opends/src/server/org/opends/server/tools/ManageAccount.java
@@ -24,12 +24,9 @@
  *
  *
  *      Copyright 2006-2009 Sun Microsystems, Inc.
- *      Portions Copyright 2011-2012 ForgeRock AS
+ *      Portions Copyright 2011-2013 ForgeRock AS
  */
 package org.opends.server.tools;
-import org.opends.messages.Message;
-
-
 
 import java.io.OutputStream;
 import java.io.PrintStream;
@@ -41,6 +38,7 @@
 
 import javax.net.ssl.SSLException;
 
+import org.opends.messages.Message;
 import org.opends.server.admin.AdministrationConnector;
 import org.opends.server.protocols.asn1.*;
 import org.opends.server.protocols.ldap.ExtendedRequestProtocolOp;
@@ -537,27 +535,8 @@
   public static int main(String[] args, Boolean initServer,
                          OutputStream outStream, OutputStream errStream)
   {
-
-    if (outStream == null)
-    {
-      out = NullOutputStream.printStream();
-    }
-    else
-    {
-      out = new PrintStream(outStream);
-    }
-
-    if (errStream == null)
-    {
-      err = NullOutputStream.printStream();
-    }
-    else
-    {
-      err = new PrintStream(errStream);
-    }
-
-
-
+    out = NullOutputStream.wrapOrNullStream(outStream);
+    err = NullOutputStream.wrapOrNullStream(errStream);
 
     // Parse the command-line arguments provided to the program.
     int result = parseArgsAndConnect(args, initServer);

--
Gitblit v1.10.0