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/StopDS.java | 31 +++++--------------------------
1 files changed, 5 insertions(+), 26 deletions(-)
diff --git a/opends/src/server/org/opends/server/tools/StopDS.java b/opends/src/server/org/opends/server/tools/StopDS.java
index 219702c..b9f8a57 100644
--- a/opends/src/server/org/opends/server/tools/StopDS.java
+++ b/opends/src/server/org/opends/server/tools/StopDS.java
@@ -23,12 +23,9 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011 ForgeRock AS
+ * Portions Copyright 2011-2013 ForgeRock AS
*/
package org.opends.server.tools;
-import org.opends.messages.Message;
-
-
import java.io.IOException;
import java.io.OutputStream;
@@ -40,8 +37,9 @@
import java.util.TimeZone;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
-
import javax.net.ssl.SSLException;
+
+import org.opends.messages.Message;
import org.opends.server.admin.AdministrationConnector;
import org.opends.server.controls.ProxiedAuthV2Control;
import org.opends.server.core.DirectoryServer;
@@ -72,8 +70,6 @@
import static org.opends.server.util.StaticUtils.*;
import static org.opends.server.tools.ToolConstants.*;
-
-
/**
* This class provides a tool that can send a request to the Directory Server
* that will cause it to shut down.
@@ -182,25 +178,8 @@
public static int stopDS(String[] args, OutputStream outStream,
OutputStream errStream)
{
- PrintStream out;
- if (outStream == null)
- {
- out = NullOutputStream.printStream();
- }
- else
- {
- out = new PrintStream(outStream);
- }
-
- PrintStream err;
- if (errStream == null)
- {
- err = NullOutputStream.printStream();
- }
- else
- {
- err = new PrintStream(errStream);
- }
+ PrintStream out = NullOutputStream.wrapOrNullStream(outStream);
+ PrintStream err = NullOutputStream.wrapOrNullStream(errStream);
// Define all the arguments that may be used with this program.
--
Gitblit v1.10.0