You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2012/02/15 15:43:41 UTC
svn commit: r1244506 -
/directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeAttributesRunnable.java
Author: pamarcelot
Date: Wed Feb 15 14:43:41 2012
New Revision: 1244506
URL: http://svn.apache.org/viewvc?rev=1244506&view=rev
Log:
Fix for DIRSTUDIO-778 (NullPointerException when refreshing a TableEntryEditor).
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=1244506&r1=1244505&r2=1244506&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 Feb 15 14:43:41 2012
@@ -75,12 +75,17 @@ public class InitializeAttributesRunnabl
*/
public Connection[] getConnections()
{
- Connection[] connections = new Connection[entries.length];
- for ( int i = 0; i < connections.length; i++ )
+ List<Connection> connections = new ArrayList<Connection>();
+
+ for ( IEntry entry : entries )
{
- connections[i] = entries[i].getBrowserConnection().getConnection();
+ if ( entry != null )
+ {
+ connections.add( entry.getBrowserConnection().getConnection() );
+ }
}
- return connections;
+
+ return connections.toArray( new Connection[0] );
}
@@ -124,12 +129,18 @@ public class InitializeAttributesRunnabl
for ( int pi = 0; pi < entries.length && !monitor.isCanceled(); pi++ )
{
- monitor.setTaskName( BrowserCoreMessages.bind( BrowserCoreMessages.jobs__init_entries_task, new String[]
- { this.entries[pi].getDn().getName() } ) );
- monitor.worked( 1 );
- if ( entries[pi].getBrowserConnection() != null )
+ IEntry entry = entries[pi];
+
+ if ( entry != null )
{
- initializeAttributes( entries[pi], monitor );
+ monitor.setTaskName( BrowserCoreMessages.bind( BrowserCoreMessages.jobs__init_entries_task,
+ new String[]
+ { entry.getDn().getName() } ) );
+ monitor.worked( 1 );
+ if ( entry.getBrowserConnection() != null )
+ {
+ initializeAttributes( entry, monitor );
+ }
}
}
}
@@ -142,7 +153,7 @@ public class InitializeAttributesRunnabl
{
for ( IEntry entry : entries )
{
- if ( entry.getBrowserConnection() != null && entry.isAttributesInitialized() )
+ if ( ( entry != null ) && ( entry.getBrowserConnection() != null ) && ( entry.isAttributesInitialized() ) )
{
// lookup the entry from cache and fire event with real entry
if ( entry.getBrowserConnection().getEntryFromCache( entry.getDn() ) != null )