From f8b0d03a43dd9803ebb3283d1679d11939620ec4 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 06 Dec 2013 09:22:15 +0000
Subject: [PATCH] Fixed once and for all: privilige => privilege

---
 opends/src/server/org/opends/server/workflowelement/externalchangelog/ECLSearchOperation.java |   60 ++++++++++++++++++++----------------------------------------
 1 files changed, 20 insertions(+), 40 deletions(-)

diff --git a/opends/src/server/org/opends/server/workflowelement/externalchangelog/ECLSearchOperation.java b/opends/src/server/org/opends/server/workflowelement/externalchangelog/ECLSearchOperation.java
index 1eb64b7..b1b943f 100644
--- a/opends/src/server/org/opends/server/workflowelement/externalchangelog/ECLSearchOperation.java
+++ b/opends/src/server/org/opends/server/workflowelement/externalchangelog/ECLSearchOperation.java
@@ -228,7 +228,8 @@
       // search processing.
       baseDN = getBaseDN();
       filter = getFilter();
-      if ((baseDN == null) || (filter == null)){
+      if (baseDN == null || filter == null)
+      {
         break searchProcessing;
       }
 
@@ -367,11 +368,10 @@
    * @throws  DirectoryException  If there is a problem with any of the request
    *                              controls.
    */
-  private void handleRequestControls()
-  throws DirectoryException
+  private void handleRequestControls() throws DirectoryException
   {
     List<Control> requestControls  = getRequestControls();
-    if ((requestControls != null) && (! requestControls.isEmpty()))
+    if (requestControls != null && !requestControls.isEmpty())
     {
       for (Control c : requestControls)
       {
@@ -468,7 +468,7 @@
           addAdditionalLogItem(AdditionalLogItem.keyOnly(getClass(),
               "obsoleteProxiedAuthzV1Control"));
 
-          // The requester must have the PROXIED_AUTH privilige in order to be
+          // The requester must have the PROXIED_AUTH privilege in order to be
           // able to use this control.
           if (! clientConnection.hasPrivilege(Privilege.PROXIED_AUTH, this))
           {
@@ -492,7 +492,7 @@
         }
         else if (oid.equals(OID_PROXIED_AUTH_V2))
         {
-          // The requester must have the PROXIED_AUTH privilige in order to be
+          // The requester must have the PROXIED_AUTH privilege in order to be
           // able to use this control.
           if (! clientConnection.hasPrivilege(Privilege.PROXIED_AUTH, this))
           {
@@ -571,14 +571,12 @@
         }
 
         // TODO: Add support for additional controls, including VLV
-        else if (c.isCritical())
+        else if (c.isCritical()
+            && (replicationServer == null || !supportsControl(oid)))
         {
-          if ((replicationServer == null) || (! supportsControl(oid)))
-          {
-            throw new DirectoryException(
-                ResultCode.UNAVAILABLE_CRITICAL_EXTENSION,
-                ERR_SEARCH_UNSUPPORTED_CRITICAL_CONTROL.get(oid));
-          }
+          throw new DirectoryException(
+              ResultCode.UNAVAILABLE_CRITICAL_EXTENSION,
+              ERR_SEARCH_UNSUPPORTED_CRITICAL_CONTROL.get(oid));
         }
       }
     }
@@ -605,14 +603,11 @@
       if (CHANGELOG_ROOT_DN.matchesBaseAndScope(baseDN, getScope()))
       {
         final Entry entry = createRootEntry(update != null);
-        if (filter.matchesEntry(entry))
+        if (filter.matchesEntry(entry) && !returnEntry(entry, null))
         {
-          if (!returnEntry(entry, null))
-          {
-            // Abandon, Size limit reached.
-            abortECLSession = true;
-            return;
-          }
+          // Abandon, Size limit reached.
+          abortECLSession = true;
+          return;
         }
       }
 
@@ -707,11 +702,8 @@
    */
   private boolean matchScopeAndFilter(Entry entry) throws DirectoryException
   {
-    if (entry.matchesBaseAndScope(getBaseDN(), getScope()))
-    {
-      return getFilter().matchesEntry(entry);
-    }
-    return false;
+    return entry.matchesBaseAndScope(getBaseDN(), getScope())
+        && getFilter().matchesEntry(entry);
   }
 
   /**
@@ -1083,9 +1075,7 @@
         uAttrs, operationalAttrs);
   }
 
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
   @Override
   public CancelResult cancel(CancelRequest cancelRequest)
   {
@@ -1095,9 +1085,7 @@
     return super.cancel(cancelRequest);
   }
 
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
   @Override
   public void abort(CancelRequest cancelRequest)
   {
@@ -1189,20 +1177,17 @@
       int sn = Integer.decode(
           sf.getAssertionValue().getNormalizedValue().toString());
       startCLmsg.setFirstChangeNumber(sn);
-      return startCLmsg;
     }
     else if (matches(sf, FilterType.LESS_OR_EQUAL, "changeNumber"))
     {
       int sn = Integer.decode(
           sf.getAssertionValue().getNormalizedValue().toString());
       startCLmsg.setLastChangeNumber(sn);
-      return startCLmsg;
     }
     else if (matches(sf, FilterType.EQUALITY, "replicationcsn"))
     {
       // == exact CSN
       startCLmsg.setCSN(new CSN(sf.getAssertionValue().toString()));
-      return startCLmsg;
     }
     else if (matches(sf, FilterType.EQUALITY, "changenumber"))
     {
@@ -1210,7 +1195,6 @@
           sf.getAssertionValue().getNormalizedValue().toString());
       startCLmsg.setFirstChangeNumber(sn);
       startCLmsg.setLastChangeNumber(sn);
-      return startCLmsg;
     }
     else if (sf.getFilterType() == FilterType.AND)
     {
@@ -1243,12 +1227,8 @@
         startCLmsg.setLastChangeNumber(Math.min(l1, l2));
 
       startCLmsg.setFirstChangeNumber(Math.max(f1,f2));
-      return startCLmsg;
     }
-    else
-    {
-      return startCLmsg;
-    }
+    return startCLmsg;
   }
 
   private static boolean matches(SearchFilter sf, FilterType filterType,

--
Gitblit v1.10.0