From eb52005d89f1502ecb86f81c2e5f36788033fccc Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 01 Mar 2013 10:07:20 +0000
Subject: [PATCH] OPENDJ-778 ldif-diff should exit with different values w.r.t files are identical or not 

---
 opendj-sdk/opends/src/server/org/opends/server/tools/EncodePassword.java |   28 +++++++++++++---------------
 1 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/EncodePassword.java b/opendj-sdk/opends/src/server/org/opends/server/tools/EncodePassword.java
index 6e9a81f..6513ad6 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/EncodePassword.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/EncodePassword.java
@@ -644,11 +644,7 @@
         }
         final boolean authPasswordMatches =
             storageScheme.authPasswordMatches(clearPW, authInfo, authValue);
-        if (authPasswordMatches)
-        {
-          Message message = INFO_ENCPW_PASSWORDS_MATCH.get();
-          out.println(message);
-        }
+        out.println(getOutputMessage(authPasswordMatches));
         if (useCompareResultCode.isPresent())
         {
           return authPasswordMatches ? COMPARE_TRUE : COMPARE_FALSE;
@@ -726,16 +722,7 @@
         boolean passwordMatches =
             storageScheme.passwordMatches(clearPW, ByteString
                 .valueOf(encodedPWString));
-        if (passwordMatches)
-        {
-          Message message = INFO_ENCPW_PASSWORDS_MATCH.get();
-          out.println(message);
-        }
-        else
-        {
-          Message message = INFO_ENCPW_PASSWORDS_DO_NOT_MATCH.get();
-          out.println(message);
-        }
+        out.println(getOutputMessage(passwordMatches));
         if (useCompareResultCode.isPresent())
         {
           return passwordMatches ? COMPARE_TRUE : COMPARE_FALSE;
@@ -842,6 +829,17 @@
 
 
 
+  private static Message getOutputMessage(boolean passwordMatches)
+  {
+    if (passwordMatches)
+    {
+      return INFO_ENCPW_PASSWORDS_MATCH.get();
+    }
+    return INFO_ENCPW_PASSWORDS_DO_NOT_MATCH.get();
+  }
+
+
+
   private static boolean
           initializeServerComponents(DirectoryServer directoryServer,
                                      PrintStream err) {

--
Gitblit v1.10.0