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/LDAPPasswordModify.java | 32 ++++++--------------------------
1 files changed, 6 insertions(+), 26 deletions(-)
diff --git a/opends/src/server/org/opends/server/tools/LDAPPasswordModify.java b/opends/src/server/org/opends/server/tools/LDAPPasswordModify.java
index 700c971..af65032 100644
--- a/opends/src/server/org/opends/server/tools/LDAPPasswordModify.java
+++ b/opends/src/server/org/opends/server/tools/LDAPPasswordModify.java
@@ -23,12 +23,9 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
+ * Portions Copyright 2013 ForgeRock AS
*/
package org.opends.server.tools;
-import org.opends.admin.ads.util.ConnectionUtils;
-import org.opends.messages.Message;
-
-
import java.io.OutputStream;
import java.io.PrintStream;
@@ -36,6 +33,8 @@
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
+import org.opends.admin.ads.util.ConnectionUtils;
+import org.opends.messages.Message;
import org.opends.server.controls.PasswordPolicyErrorType;
import org.opends.server.controls.PasswordPolicyResponseControl;
import org.opends.server.controls.PasswordPolicyWarningType;
@@ -62,8 +61,6 @@
import static org.opends.server.tools.ToolConstants.*;
import static org.opends.server.protocols.ldap.LDAPResultCode.*;
-
-
/**
* This program provides a utility that uses the LDAP password modify extended
* operation to change the password for a user. It exposes the three primary
@@ -72,7 +69,7 @@
* <UL>
* <LI>The user identity whose password should be changed.</LI>
* <LI>The current password for the user.</LI>
- * <LI>The new password for the user.
+ * <LI>The new password for the user.</LI>
* </UL>
*
* All of these are optional components that may be included or omitted from the
@@ -142,25 +139,8 @@
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);
// Create the arguments that will be used by this program.
--
Gitblit v1.10.0