From 3311bbe59fda9ebd51131ac63a5159989c2da8c8 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 10 Nov 2014 09:31:36 +0000
Subject: [PATCH] AuthPasswordEqualityMatchingRule.java, UserPasswordEqualityMatchingRule.java: Aligned the two classes code for easier comparison.

---
 opendj3-server-dev/src/server/org/opends/server/schema/UserPasswordEqualityMatchingRule.java |   54 +++++++++++++--------------
 opendj3-server-dev/src/server/org/opends/server/schema/AuthPasswordEqualityMatchingRule.java |   14 ++----
 2 files changed, 31 insertions(+), 37 deletions(-)

diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/AuthPasswordEqualityMatchingRule.java b/opendj3-server-dev/src/server/org/opends/server/schema/AuthPasswordEqualityMatchingRule.java
index ed7716e..5d1204b 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/AuthPasswordEqualityMatchingRule.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/AuthPasswordEqualityMatchingRule.java
@@ -85,7 +85,7 @@
    * for efficiently performing matching operations on that value.
    *
    * @param schema The schema.
-   * @param  value  The value to be normalized.
+   * @param value  The value to be normalized.
    *
    * @return  The normalized version of the provided value.
    *
@@ -95,19 +95,17 @@
   @Override
   public ByteString normalizeAttributeValue(Schema schema, ByteSequence value) throws DecodeException
   {
-    // We will not alter the value in any way.
+    // We will not alter the value in any way
     return value.toByteString();
   }
 
-
   /** {@inheritDoc} */
   @Override
   public Assertion getAssertion(final Schema schema, final ByteSequence assertionValue) throws DecodeException
   {
+    final ByteString normalizedAssertionValue = normalizeAttributeValue(schema, assertionValue);
     return new Assertion()
     {
-      final ByteString normalizedAssertionValue = normalizeAttributeValue(schema, assertionValue);
-
       @Override
       public ConditionResult matches(final ByteSequence normalizedAttributeValue)
       {
@@ -151,7 +149,6 @@
     return indexers;
   }
 
-
   /** {@inheritDoc} */
   @Override
   public boolean isIndexingSupported()
@@ -174,8 +171,8 @@
       return ConditionResult.FALSE;
     }
 
-    // The first element of the array will be the scheme.  Make sure that we
-    // support the requested scheme.
+    // The first element of the array will be the scheme.
+    // Make sure that we support the requested scheme.
     PasswordStorageScheme<?> storageScheme = getAuthPasswordStorageScheme(authPWComponents[0].toString());
     if (storageScheme == null)
     {
@@ -191,4 +188,3 @@
   }
 
 }
-
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/UserPasswordEqualityMatchingRule.java b/opendj3-server-dev/src/server/org/opends/server/schema/UserPasswordEqualityMatchingRule.java
index de7e7c2..734078b 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/UserPasswordEqualityMatchingRule.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/UserPasswordEqualityMatchingRule.java
@@ -60,26 +60,6 @@
 
   private static final String EQUALITY_ID = "equality";
 
-  /**
-   * Retrieves the normalized form of the provided value, which is best suited
-   * for efficiently performing matching operations on that value.
-   *
-   * @param schema The schema.
-   * @param value  The value to be normalized.
-   *
-   * @return  The normalized version of the provided value.
-   *
-   * @throws  DecodeException  If the provided value is invalid according to
-   *                              the associated attribute syntax.
-   */
-  @Override
-  public ByteString normalizeAttributeValue(Schema schema, ByteSequence value)
-         throws DecodeException
-  {
-    // We will not alter the value in any way
-    return value.toByteString();
-  }
-
   private final Collection<? extends Indexer> indexers = Collections.singleton(new Indexer()
   {
     @Override
@@ -103,14 +83,32 @@
     return ByteSequence.COMPARATOR;
   }
 
+  /**
+   * Retrieves the normalized form of the provided value, which is best suited
+   * for efficiently performing matching operations on that value.
+   *
+   * @param schema The schema.
+   * @param value  The value to be normalized.
+   *
+   * @return  The normalized version of the provided value.
+   *
+   * @throws  DecodeException  If the provided value is invalid according to
+   *                              the associated attribute syntax.
+   */
+  @Override
+  public ByteString normalizeAttributeValue(Schema schema, ByteSequence value) throws DecodeException
+  {
+    // We will not alter the value in any way
+    return value.toByteString();
+  }
+
   /** {@inheritDoc} */
   @Override
   public Assertion getAssertion(final Schema schema, final ByteSequence assertionValue) throws DecodeException
   {
+    final ByteString normalizedAssertionValue = normalizeAttributeValue(schema, assertionValue);
     return new Assertion()
     {
-      final ByteString normalizedAssertionValue = normalizeAttributeValue(schema, assertionValue);
-
       @Override
       public ConditionResult matches(final ByteSequence normalizedAttributeValue)
       {
@@ -149,16 +147,16 @@
 
   /** {@inheritDoc} */
   @Override
-  public boolean isIndexingSupported()
+  public Collection<? extends Indexer> getIndexers()
   {
-    return indexers.isEmpty();
+    return indexers;
   }
 
   /** {@inheritDoc} */
   @Override
-  public Collection<? extends Indexer> getIndexers()
+  public boolean isIndexingSupported()
   {
-    return indexers;
+    return indexers.isEmpty();
   }
 
   /**
@@ -193,7 +191,7 @@
 
     // The first element of the array will be the scheme.
     // Make sure that we support the requested scheme.
-    PasswordStorageScheme<?> storageScheme =  getPasswordStorageScheme(userPWComponents[0]);
+    PasswordStorageScheme<?> storageScheme = getPasswordStorageScheme(userPWComponents[0]);
     if (storageScheme == null)
     {
       // It's not a scheme that we can support.
@@ -204,5 +202,5 @@
     return ConditionResult.valueOf(
         storageScheme.passwordMatches(assertionValue, ByteString.valueOf(userPWComponents[1])));
   }
-}
 
+}

--
Gitblit v1.10.0