You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2017/08/16 07:59:57 UTC

svn commit: r1805147 - /directory/studio/branches/studio-value/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/jobs/PartitionsDiffComputer.java

Author: elecharny
Date: Wed Aug 16 07:59:57 2017
New Revision: 1805147

URL: http://svn.apache.org/viewvc?rev=1805147&view=rev
Log:
o Use the LDAP API Value branch API
o Fixed some sonar warnings

Modified:
    directory/studio/branches/studio-value/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/jobs/PartitionsDiffComputer.java

Modified: directory/studio/branches/studio-value/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/jobs/PartitionsDiffComputer.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/jobs/PartitionsDiffComputer.java?rev=1805147&r1=1805146&r2=1805147&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/jobs/PartitionsDiffComputer.java (original)
+++ directory/studio/branches/studio-value/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/jobs/PartitionsDiffComputer.java Wed Aug 16 07:59:57 2017
@@ -185,7 +185,7 @@ public class PartitionsDiffComputer
     public List<LdifEntry> comparePartitions( Dn baseDn, String[] attributeIds ) throws PartitionsDiffException
     {
         // Creating the list containing all modifications
-        List<LdifEntry> modifications = new ArrayList<LdifEntry>();
+        List<LdifEntry> modifications = new ArrayList<>();
 
         try
         {
@@ -199,11 +199,11 @@ public class PartitionsDiffComputer
 
             // Creating the list containing all the original entries to be processed
             // and adding it the original base entry
-            List<Entry> originalEntries = new ArrayList<Entry>();
+            List<Entry> originalEntries = new ArrayList<>();
             originalEntries.add( originalBaseEntry );
 
             // Looping until all original entries are being processed
-            while ( originalEntries.size() > 0 )
+            while ( !originalEntries.isEmpty() )
             {
                 // Getting the first original entry from the list
                 Entry originalEntry = originalEntries.remove( 0 );
@@ -238,8 +238,8 @@ public class PartitionsDiffComputer
                 if ( modificationEntryChangeType != ChangeType.None )
                 {
                     if ( modificationEntryChangeType == ChangeType.Delete
-                        || ( modificationEntryChangeType == ChangeType.Modify && modificationEntry
-                            .getModifications().size() > 0 ) )
+                        || ( modificationEntryChangeType == ChangeType.Modify && !modificationEntry
+                            .getModifications().isEmpty() ) )
                     {
                         // Adding the modification entry to the list
                         modifications.add( modificationEntry );
@@ -280,11 +280,11 @@ public class PartitionsDiffComputer
 
             // Creating the list containing all the destination entries to be processed
             // and adding it the destination base entry
-            List<Entry> destinationEntries = new ArrayList<Entry>();
+            List<Entry> destinationEntries = new ArrayList<>();
             destinationEntries.add( originalBaseEntry );
 
             // Looping until all destination entries are being processed
-            while ( destinationEntries.size() > 0 )
+            while ( !destinationEntries.isEmpty() )
             {
                 // Getting the first destination entry from the list
                 Entry destinationEntry = destinationEntries.remove( 0 );
@@ -353,7 +353,7 @@ public class PartitionsDiffComputer
     private void compareEntries( Entry originalEntry, Entry destinationEntry, LdifEntry modificationEntry )
     {
         // Creating a list to store the already evaluated attribute type
-        List<AttributeType> evaluatedATs = new ArrayList<AttributeType>();
+        List<AttributeType> evaluatedATs = new ArrayList<>();
 
         // Checking attributes of the original entry
         for ( Attribute originalAttribute : originalEntry )
@@ -400,7 +400,7 @@ public class PartitionsDiffComputer
                     Attribute attribute = new DefaultAttribute( destinationAttributeType );
                     modification.setAttribute( attribute );
 
-                    for ( Value<?> value : destinationAttribute )
+                    for ( Value value : destinationAttribute )
                     {
                         try
                         {
@@ -437,10 +437,10 @@ public class PartitionsDiffComputer
         LdifEntry modificationEntry )
     {
         // Creating a list to store the already evaluated values
-        List<Value<?>> evaluatedValues = new ArrayList<Value<?>>();
+        List<Value> evaluatedValues = new ArrayList<>();
 
         // Checking values of the original attribute
-        for ( Value<?> originalValue : originalAttribute )
+        for ( Value originalValue : originalAttribute )
         {
             if ( !destinationAttribute.contains( originalValue ) )
             {
@@ -472,7 +472,7 @@ public class PartitionsDiffComputer
         }
 
         // Checking values of the destination attribute
-        for ( Value<?> destinationValue : destinationAttribute )
+        for ( Value destinationValue : destinationAttribute )
         {
             if ( !evaluatedValues.contains( destinationValue ) )
             {