From 98a5df3565beaa1999020a16fcb5338d13d5b50f Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 26 Aug 2014 08:11:29 +0000
Subject: [PATCH] Removed useless getChangeNumber() and setChangeNumber methods from *Operation interfaces. These methods are useless because setChangeNumber() is never set inside production code, so changeNumber is always equal to -1 for all the update operations. In addition it is very unlikely the ChangeNumberIndexer could have computed the changeNumber before a results are sent to a persistent search.

---
 opends/src/server/org/opends/server/core/AddOperationBasis.java |  147 ++++++++----------------------------------------
 1 files changed, 26 insertions(+), 121 deletions(-)

diff --git a/opends/src/server/org/opends/server/core/AddOperationBasis.java b/opends/src/server/org/opends/server/core/AddOperationBasis.java
index 47e9c81..c0dc435 100644
--- a/opends/src/server/org/opends/server/core/AddOperationBasis.java
+++ b/opends/src/server/org/opends/server/core/AddOperationBasis.java
@@ -22,7 +22,7 @@
  *
  *
  *      Copyright 2007-2010 Sun Microsystems, Inc.
- *      Portions copyright 2013 ForgeRock AS
+ *      Portions copyright 2013-2014 ForgeRock AS
  */
 package org.opends.server.core;
 
@@ -94,9 +94,6 @@
   /** The set of objectclasses for the entry to add. */
   private Map<ObjectClass,String> objectClasses;
 
-  /** The change number that has been assigned to this operation. */
-  private long changeNumber;
-
   /** The flag indicates if an LDAP error was reported. */
   private boolean ldapError;
 
@@ -132,7 +129,6 @@
     operationalAttributes = null;
     objectClasses         = null;
     proxiedAuthorizationDN = null;
-    changeNumber          = -1;
   }
 
 
@@ -198,22 +194,16 @@
     responseControls = new ArrayList<Control>();
     proxiedAuthorizationDN = null;
     cancelRequest    = null;
-    changeNumber     = -1;
   }
 
-
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
   @Override
   public final ByteString getRawEntryDN()
   {
     return rawEntryDN;
   }
 
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
   @Override
   public final void setRawEntryDN(ByteString rawEntryDN)
   {
@@ -222,10 +212,7 @@
     entryDN = null;
   }
 
-
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
   @Override
   public final DN getEntryDN()
   {
@@ -251,20 +238,14 @@
     return entryDN;
   }
 
-
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
   @Override
   public final List<RawAttribute> getRawAttributes()
   {
     return rawAttributes;
   }
 
-
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
   @Override
   public final void addRawAttribute(RawAttribute rawAttribute)
   {
@@ -275,10 +256,7 @@
     operationalAttributes = null;
   }
 
-
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
   @Override
   public final void setRawAttributes(List<RawAttribute> rawAttributes)
   {
@@ -289,11 +267,7 @@
     operationalAttributes = null;
   }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
   @Override
   public final Map<ObjectClass,String> getObjectClasses()
   {
@@ -303,33 +277,21 @@
     return objectClasses;
   }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
   @Override
   public final void addObjectClass(ObjectClass objectClass, String name)
   {
     objectClasses.put(objectClass, name);
   }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
   @Override
   public final void removeObjectClass(ObjectClass objectClass)
   {
     objectClasses.remove(objectClass);
   }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
   @Override
   public final Map<AttributeType,List<Attribute>> getUserAttributes()
   {
@@ -339,10 +301,7 @@
     return userAttributes;
   }
 
-
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
   @Override
   public final Map<AttributeType,List<Attribute>> getOperationalAttributes()
   {
@@ -396,16 +355,11 @@
               attr = builder.toAttribute();
             }
           }
-          else
+          else if (attr.hasOption("binary"))
           {
             // binary option is not honored for non-BER-encodable attributes.
-            if(attr.hasOption("binary"))
-            {
-              throw new LDAPException(LDAPResultCode.UNDEFINED_ATTRIBUTE_TYPE,
-                      ERR_ADD_ATTR_IS_INVALID_OPTION.get(
-                      String.valueOf(entryDN),
-                      attr.getName()));
-            }
+            throw new LDAPException(LDAPResultCode.UNDEFINED_ATTRIBUTE_TYPE,
+                ERR_ADD_ATTR_IS_INVALID_OPTION.get(String.valueOf(entryDN), attr.getName()));
           }
 
           if (attrType.isObjectClassType())
@@ -486,9 +440,7 @@
     }
   }
 
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
   @Override
   public final void setAttribute(AttributeType attributeType,
                                  List<Attribute> attributeList)
@@ -505,18 +457,14 @@
     }
   }
 
-
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
   @Override
   public final void removeAttribute(AttributeType attributeType)
   {
     getAttributes(attributeType.isOperational()).remove(attributeType);
   }
 
-  private Map<AttributeType, List<Attribute>> getAttributes(
-      boolean isOperational)
+  private Map<AttributeType, List<Attribute>> getAttributes(boolean isOperational)
   {
     if (isOperational)
     {
@@ -525,29 +473,7 @@
     return userAttributes;
   }
 
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public final long getChangeNumber()
-  {
-    return changeNumber;
-  }
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public final void setChangeNumber(long changeNumber)
-  {
-    this.changeNumber = changeNumber;
-  }
-
-
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
   @Override
   public final OperationType getOperationType()
   {
@@ -557,52 +483,35 @@
     return OperationType.ADD;
   }
 
-
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
   @Override
   public DN getProxiedAuthorizationDN()
   {
     return proxiedAuthorizationDN;
   }
 
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
   @Override
   public final ArrayList<Control> getResponseControls()
   {
     return responseControls;
   }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
   @Override
   public final void addResponseControl(Control control)
   {
     responseControls.add(control);
   }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
   @Override
   public final void removeResponseControl(Control control)
   {
     responseControls.remove(control);
   }
 
-
-
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
   @Override
   public final void toString(StringBuilder buffer)
   {
@@ -615,18 +524,14 @@
     buffer.append(")");
   }
 
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
   @Override
   public void setProxiedAuthorizationDN(DN proxiedAuthorizationDN)
   {
     this.proxiedAuthorizationDN = proxiedAuthorizationDN;
   }
 
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
   @Override
   public final void run()
   {

--
Gitblit v1.10.0