directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1692336 - /directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeAttributesRunnable.java
Date Wed, 22 Jul 2015 23:07:12 GMT
Author: elecharny
Date: Wed Jul 22 23:07:12 2015
New Revision: 1692336

URL: http://svn.apache.org/r1692336
Log:
Some more List creation removal.

Modified:
    directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeAttributesRunnable.java

Modified: directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeAttributesRunnable.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeAttributesRunnable.java?rev=1692336&r1=1692335&r2=1692336&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeAttributesRunnable.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeAttributesRunnable.java
Wed Jul 22 23:07:12 2015
@@ -103,9 +103,11 @@ public class InitializeAttributesRunnabl
      */
     public Object[] getLockedObjects()
     {
-        List<Object> l = new ArrayList<Object>();
-        l.addAll( Arrays.asList( entries ) );
-        return l.toArray();
+        Object[] lockedObjects = new Object[ entries.length ];
+        
+        System.arraycopy( entries, 0, lockedObjects, 0, entries.length );
+        
+        return lockedObjects;
     }
 
 
@@ -114,8 +116,14 @@ public class InitializeAttributesRunnabl
      */
     public String getErrorMessage()
     {
-        return entries.length == 1 ? BrowserCoreMessages.jobs__init_entries_error_1
-            : BrowserCoreMessages.jobs__init_entries_error_n;
+        if ( entries.length == 1 )
+        {
+            return BrowserCoreMessages.jobs__init_entries_error_1;
+        }
+        else
+        {
+            return BrowserCoreMessages.jobs__init_entries_error_n;
+        }
     }
 
 
@@ -127,16 +135,20 @@ public class InitializeAttributesRunnabl
         monitor.beginTask( " ", entries.length + 2 ); //$NON-NLS-1$
         monitor.reportProgress( " " ); //$NON-NLS-1$
 
-        for ( int pi = 0; pi < entries.length && !monitor.isCanceled(); pi++ )
+        for ( IEntry entry : entries )
         {
-            IEntry entry = entries[pi];
-
+            if ( monitor.isCanceled() )
+            {
+                break;
+            }
+            
             if ( entry != null )
             {
                 monitor.setTaskName( BrowserCoreMessages.bind( BrowserCoreMessages.jobs__init_entries_task,
                     new String[]
                         { entry.getDn().getName() } ) );
                 monitor.worked( 1 );
+                
                 if ( entry.getBrowserConnection() != null )
                 {
                     initializeAttributes( entry, monitor );
@@ -160,6 +172,7 @@ public class InitializeAttributesRunnabl
                 {
                     entry = entry.getBrowserConnection().getEntryFromCache( entry.getDn()
);
                 }
+                
                 EventRegistry.fireEntryUpdated( new AttributesInitializedEvent( entry ),
this );
             }
         }
@@ -180,6 +193,7 @@ public class InitializeAttributesRunnabl
         raSet.add( SchemaConstants.ALL_USER_ATTRIBUTES );
         boolean initOperationalAttributes = entry.getBrowserConnection().isFetchOperationalAttributes()
             || entry.isInitOperationalAttributes();
+        
         if ( initOperationalAttributes )
         {
             if ( entry.getBrowserConnection().getRootDSE().isFeatureSupported(
@@ -195,10 +209,12 @@ public class InitializeAttributesRunnabl
                 raSet.addAll( atdNames );
             }
         }
+        
         if ( entry.isReferral() )
         {
             raSet.add( SchemaConstants.REF_AT );
         }
+        
         returningAttributes = ( String[] ) raSet.toArray( new String[raSet.size()] );
 
         initializeAttributes( entry, returningAttributes, true, monitor );
@@ -229,10 +245,12 @@ public class InitializeAttributesRunnabl
         {
             AliasDereferencingMethod aliasesDereferencingMethod = entry.getBrowserConnection()
                 .getAliasesDereferencingMethod();
+            
             if ( entry.isAlias() )
             {
                 aliasesDereferencingMethod = AliasDereferencingMethod.NEVER;
             }
+            
             ReferralHandlingMethod referralsHandlingMethod = entry.getBrowserConnection().getReferralsHandlingMethod();
 
             if ( clearAllAttributes )
@@ -242,6 +260,7 @@ public class InitializeAttributesRunnabl
                 // requested attributes. If the user switches the "Show operational attributes"
                 // property then the operational attributes are not cleared.
                 IAttribute[] oldAttributes = entry.getAttributes();
+                
                 if ( oldAttributes != null )
                 {
                     for ( IAttribute oldAttribute : oldAttributes )



Mime
View raw message