From 982a6e849c6669bdad7c168294a2d43ce33de82f Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Thu, 04 Feb 2016 16:43:42 +0000
Subject: [PATCH] ModifyCommonMsg.java: Removed null check Code cleanup

---
 opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ModifyCommonMsg.java |   37 ++++++++++++++-----------------------
 1 files changed, 14 insertions(+), 23 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ModifyCommonMsg.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ModifyCommonMsg.java
index 4ff0282..400ef51 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ModifyCommonMsg.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ModifyCommonMsg.java
@@ -34,27 +34,24 @@
 import org.forgerock.opendj.io.ASN1Reader;
 import org.forgerock.opendj.io.ASN1Writer;
 import org.forgerock.opendj.ldap.ByteStringBuilder;
+import org.forgerock.opendj.ldap.schema.AttributeType;
 import org.forgerock.opendj.ldap.schema.AttributeUsage;
 import org.opends.server.protocols.ldap.LDAPAttribute;
 import org.opends.server.protocols.ldap.LDAPModification;
 import org.opends.server.replication.common.CSN;
 import org.opends.server.replication.plugin.EntryHistorical;
-import org.forgerock.opendj.ldap.schema.AttributeType;
-import org.opends.server.types.*;
+import org.opends.server.types.Attribute;
+import org.opends.server.types.DN;
+import org.opends.server.types.LDAPException;
+import org.opends.server.types.Modification;
+import org.opends.server.types.RawModification;
 
-/**
- * This class holds every common code for the modify messages (mod, moddn).
- */
+/** This class holds every common code for the modify messages (mod, moddn). */
 public abstract class ModifyCommonMsg extends LDAPUpdateMsg {
-
-  /**
-   * The modifications kept encoded in the message.
-   */
+  /** The modifications kept encoded in the message. */
   protected byte[] encodedMods = new byte[0];
 
-  /**
-   * Creates a new ModifyCommonMsg.
-   */
+  /** Creates a new ModifyCommonMsg. */
   public ModifyCommonMsg()
   {
     super();
@@ -134,23 +131,17 @@
     {
       Attribute attr = mod.getAttribute();
       AttributeType type = attr.getAttributeDescription().getAttributeType();
-      if (type != null
-          && AttributeUsage.DSA_OPERATION.equals(type.getUsage()) )
-      {
-        // Attributes with a dsaOperation usage should not be synchronized.
-        // skip them.
-        continue;
-      }
-
-      if (!EntryHistorical.isHistoricalAttribute(attr))
+      // Do not synchronize attributes with a dsaOperation usage
+      if (!AttributeUsage.DSA_OPERATION.equals(type.getUsage())
+          && !EntryHistorical.isHistoricalAttribute(attr))
       {
         LDAPModification ldapmod = new LDAPModification(
-          mod.getModificationType(), new LDAPAttribute(mod.getAttribute()));
+            mod.getModificationType(), new LDAPAttribute(mod.getAttribute()));
         try
         {
           ldapmod.write(writer);
         }
-        catch(Exception e)
+        catch (Exception e)
         {
           // DO SOMETHING
         }

--
Gitblit v1.10.0