directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r687753 - in /directory/studio/trunk: connection-core/src/main/java/org/apache/directory/studio/connection/core/jobs/ ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/ ldapbrowser-common/src/main/java/...
Date Thu, 21 Aug 2008 13:30:02 GMT
Author: seelmann
Date: Thu Aug 21 06:29:58 2008
New Revision: 687753

URL: http://svn.apache.org/viewvc?rev=687753&view=rev
Log:
Fix for DIRSTUDIO-372: Added null checks

Modified:
    directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/jobs/StudioConnectionJob.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SelectBrowserConnectionDialog.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserContentProvider.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/BrowserConnectionWidget.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/EditEntryWizard.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryWizard.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserConnectionListener.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserConnectionManager.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/AbstractAttributeModificationJob.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/AbstractEclipseJob.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CreateValuesJob.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteAttributesValueJob.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesJob.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ImportLdifJob.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ModifyValueJob.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/RenameEntryJob.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/SearchRunnable.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/BrowserConnection.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DelegateEntry.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/Utils.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/ModificationLogsViewInput.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/ModificationLogsViewUniversalListener.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/NewerAction.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/OlderAction.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/NewerAction.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/OlderAction.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/SearchLogsViewInput.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/SearchLogsViewUniversalListener.java
    directory/studio/trunk/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/LdifEntryEditorDialog.java
    directory/studio/trunk/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifEditor.java
    directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/password/PasswordDialog.java

Modified: directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/jobs/StudioConnectionJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/jobs/StudioConnectionJob.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/jobs/StudioConnectionJob.java (original)
+++ directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/jobs/StudioConnectionJob.java Thu Aug 21 06:29:58 2008
@@ -283,7 +283,7 @@
 
     private static String getLockIdentifier( Object object )
     {
-        return object.toString();
+        return object != null ? object.toString() : "null";
     }
 
 }

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SelectBrowserConnectionDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SelectBrowserConnectionDialog.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SelectBrowserConnectionDialog.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SelectBrowserConnectionDialog.java Thu Aug 21 06:29:58 2008
@@ -226,8 +226,11 @@
         if ( initialBrowserConnection != null )
         {
             Connection connection = initialBrowserConnection.getConnection();
-            connectionMainWidget.getViewer().reveal( connection );
-            connectionMainWidget.getViewer().setSelection( new StructuredSelection( connection ), true );
+            if ( connection != null )
+            {
+                connectionMainWidget.getViewer().reveal( connection );
+                connectionMainWidget.getViewer().setSelection( new StructuredSelection( connection ), true );
+            }
         }
 
         applyDialogFont( composite );

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserContentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserContentProvider.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserContentProvider.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserContentProvider.java Thu Aug 21 06:29:58 2008
@@ -296,8 +296,8 @@
             return entryList.toArray();
         }
         else if ( parent instanceof IEntry )
-            {
-                final IEntry parentEntry = ( IEntry ) parent;
+        {
+            final IEntry parentEntry = ( IEntry ) parent;
 
             if ( !parentEntry.isChildrenInitialized() && parentEntry.isDirectoryEntry() )
             {
@@ -408,32 +408,34 @@
         else if ( parent instanceof BrowserCategory )
         {
             BrowserCategory category = ( BrowserCategory ) parent;
-            IBrowserConnection connection = category.getParent();
+            IBrowserConnection browserConnection = category.getParent();
 
             switch ( category.getType() )
             {
                 case BrowserCategory.TYPE_DIT:
                 {
                     // open connection when expanding DIT
-                    if ( !connection.getConnection().getJNDIConnectionWrapper().isConnected() )
+                    if ( browserConnection.getConnection() != null
+                        && !browserConnection.getConnection().getJNDIConnectionWrapper().isConnected() )
                     {
-                        new StudioBrowserJob( new OpenConnectionsRunnable( connection.getConnection() ) ).execute();
+                        new StudioBrowserJob( new OpenConnectionsRunnable( browserConnection.getConnection() ) )
+                            .execute();
                         return new String[]
                             { "Opening Connection..." };
                     }
 
                     return new Object[]
-                        { connection.getRootDSE() };
+                        { browserConnection.getRootDSE() };
                 }
 
                 case BrowserCategory.TYPE_SEARCHES:
                 {
-                    return connection.getSearchManager().getSearches();
+                    return browserConnection.getSearchManager().getSearches();
                 }
 
                 case BrowserCategory.TYPE_BOOKMARKS:
                 {
-                    return connection.getBookmarkManager().getBookmarks();
+                    return browserConnection.getBookmarkManager().getBookmarks();
                 }
             }
 

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/BrowserConnectionWidget.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/BrowserConnectionWidget.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/BrowserConnectionWidget.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/BrowserConnectionWidget.java Thu Aug 21 06:29:58 2008
@@ -125,7 +125,9 @@
     public void setBrowserConnection( IBrowserConnection connection )
     {
         selectedBrowserConnection = connection;
-        browserConnectionText.setText( selectedBrowserConnection != null ? selectedBrowserConnection.getConnection().getName() : "" );
+        browserConnectionText.setText( selectedBrowserConnection != null
+            && selectedBrowserConnection.getConnection() != null ? selectedBrowserConnection.getConnection().getName()
+            : "" );
     }
 
 

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/EditEntryWizard.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/EditEntryWizard.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/EditEntryWizard.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/EditEntryWizard.java Thu Aug 21 06:29:58 2008
@@ -61,8 +61,11 @@
 
         selectedEntry = entry;
         selectedConnection = entry.getBrowserConnection();
-        originalReadOnlyFlag = selectedConnection.getConnection().isReadOnly();
-        selectedConnection.getConnection().setReadOnly( true );
+        if ( selectedConnection.getConnection() != null )
+        {
+            originalReadOnlyFlag = selectedConnection.getConnection().isReadOnly();
+            selectedConnection.getConnection().setReadOnly( true );
+        }
 
         // ensure the attributes of the entry are initialized
         if ( !selectedEntry.isAttributesInitialized() )
@@ -115,7 +118,7 @@
      */
     public boolean performCancel()
     {
-        if ( selectedConnection != null && selectedConnection.getConnection() != null )
+        if ( selectedConnection.getConnection() != null )
         {
             selectedConnection.getConnection().setReadOnly( originalReadOnlyFlag );
         }
@@ -131,7 +134,7 @@
     {
         try
         {
-            if ( selectedConnection != null && selectedConnection.getConnection() != null )
+            if ( selectedConnection.getConnection() != null )
             {
                 selectedConnection.getConnection().setReadOnly( originalReadOnlyFlag );
 

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryWizard.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryWizard.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryWizard.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryWizard.java Thu Aug 21 06:29:58 2008
@@ -172,8 +172,11 @@
 
         if ( selectedConnection != null )
         {
-            originalReadOnlyFlag = selectedConnection.getConnection().isReadOnly();
-            selectedConnection.getConnection().setReadOnly( true );
+            if ( selectedConnection.getConnection() != null )
+            {
+                originalReadOnlyFlag = selectedConnection.getConnection().isReadOnly();
+                selectedConnection.getConnection().setReadOnly( true );
+            }
             prototypeEntry = new DummyEntry( new LdapDN(), selectedConnection );
         }
     }

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserConnectionListener.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserConnectionListener.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserConnectionListener.java (original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserConnectionListener.java Thu Aug 21 06:29:58 2008
@@ -141,7 +141,10 @@
             }
         }
 
-        browserConnection.getConnection().getJNDIConnectionWrapper().setBinaryAttributes( binaryAttributeNames );
+        if ( browserConnection.getConnection() != null )
+        {
+            browserConnection.getConnection().getJNDIConnectionWrapper().setBinaryAttributes( binaryAttributeNames );
+        }
     }
 
 }

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserConnectionManager.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserConnectionManager.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserConnectionManager.java (original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserConnectionManager.java Thu Aug 21 06:29:58 2008
@@ -101,8 +101,9 @@
      */
     public static final String getSchemaCacheFileName( IBrowserConnection browserConnection )
     {
+        String id = browserConnection.getConnection() != null ? browserConnection.getConnection().getId() : "null";
         return BrowserCorePlugin.getDefault().getStateLocation().append(
-            "schema-" + Utils.getFilenameString( browserConnection.getConnection().getId() ) + ".ldif" ).toOSString(); //$NON-NLS-1$ //$NON-NLS-2$
+            "schema-" + Utils.getFilenameString( id ) + ".ldif" ).toOSString(); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
 

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/AbstractAttributeModificationJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/AbstractAttributeModificationJob.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/AbstractAttributeModificationJob.java (original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/AbstractAttributeModificationJob.java Thu Aug 21 06:29:58 2008
@@ -47,7 +47,8 @@
         }
         finally
         {
-            if( !getModifiedEntry().getBrowserConnection().getConnection().isReadOnly() )
+            if ( getModifiedEntry().getBrowserConnection().getConnection() != null
+                && !getModifiedEntry().getBrowserConnection().getConnection().isReadOnly() )
             {
                 // reload affected attributes
                 String[] attributeDescriptions = getAffectedAttributeDescriptions();

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/AbstractEclipseJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/AbstractEclipseJob.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/AbstractEclipseJob.java (original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/AbstractEclipseJob.java Thu Aug 21 06:29:58 2008
@@ -263,7 +263,7 @@
 
     protected static String getLockIdentifier( IBrowserConnection browserConnection )
     {
-        if ( browserConnection instanceof BrowserConnection )
+        if ( browserConnection instanceof BrowserConnection && browserConnection.getConnection() != null )
         {
             return browserConnection.getConnection().getHost() + ":" + browserConnection.getConnection().getPort();
         }

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CreateValuesJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CreateValuesJob.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CreateValuesJob.java (original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CreateValuesJob.java Thu Aug 21 06:29:58 2008
@@ -186,7 +186,7 @@
     static void createValues( IBrowserConnection browserConnection, IEntry entryToModify, IValue[] valuesToCreate,
         StudioProgressMonitor monitor )
     {
-        if ( !browserConnection.getConnection().isReadOnly() )
+        if ( browserConnection.getConnection() != null && !browserConnection.getConnection().isReadOnly() )
         {
             // dn
             String dn = entryToModify.getDn().getUpName();

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteAttributesValueJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteAttributesValueJob.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteAttributesValueJob.java (original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteAttributesValueJob.java Thu Aug 21 06:29:58 2008
@@ -218,7 +218,7 @@
     static void deleteAttributesAndValues( IBrowserConnection browserConnection, IEntry entry,
         IAttribute[] attributesToDelete, IValue[] valuesToDelete, StudioProgressMonitor monitor )
     {
-        if ( !browserConnection.getConnection().isReadOnly() )
+        if ( browserConnection.getConnection() != null && !browserConnection.getConnection().isReadOnly() )
         {
             // dn
             String dn = entry.getDn().getUpName();

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesJob.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesJob.java (original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesJob.java Thu Aug 21 06:29:58 2008
@@ -367,8 +367,11 @@
             : ReferralHandlingMethod.IGNORE;
 
         // delete entry
-        browserConnection.getConnection().getJNDIConnectionWrapper().deleteEntry( dn.getUpName(),
-            referralsHandlingMethod, controls, monitor, null );
+        if ( browserConnection.getConnection() != null )
+        {
+            browserConnection.getConnection().getJNDIConnectionWrapper().deleteEntry( dn.getUpName(),
+                referralsHandlingMethod, controls, monitor, null );
+        }
     }
 
 }

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ImportLdifJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ImportLdifJob.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ImportLdifJob.java (original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ImportLdifJob.java Thu Aug 21 06:29:58 2008
@@ -234,6 +234,11 @@
     static void importLdif( IBrowserConnection browserConnection, LdifEnumeration enumeration, Writer logWriter,
         boolean continueOnError, StudioProgressMonitor monitor )
     {
+        if ( browserConnection == null )
+        {
+            return;
+        }
+
         StudioProgressMonitor dummyMonitor = new StudioProgressMonitor( monitor );
         int importedCount = 0;
         int errorCount = 0;

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ModifyValueJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ModifyValueJob.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ModifyValueJob.java (original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ModifyValueJob.java Thu Aug 21 06:29:58 2008
@@ -156,7 +156,7 @@
     private void modifyValue( IBrowserConnection browserConnection, IEntry entry, IValue oldValue, IValue newValue,
         StudioProgressMonitor monitor )
     {
-        if ( !browserConnection.getConnection().isReadOnly() )
+        if ( browserConnection.getConnection() != null && !browserConnection.getConnection().isReadOnly() )
         {
             // dn
             String dn = entry.getDn().getUpName();

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/RenameEntryJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/RenameEntryJob.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/RenameEntryJob.java (original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/RenameEntryJob.java Thu Aug 21 06:29:58 2008
@@ -262,8 +262,11 @@
         ReferralHandlingMethod referralsHandlingMethod = entry.isReferral() ? ReferralHandlingMethod.MANAGE
             : ReferralHandlingMethod.FOLLOW;
 
-        browserConnection.getConnection().getJNDIConnectionWrapper().renameEntry( oldDnString, newDnString, true,
-            referralsHandlingMethod, null, monitor, null );
+        if ( browserConnection.getConnection() != null )
+        {
+            browserConnection.getConnection().getJNDIConnectionWrapper().renameEntry( oldDnString, newDnString, true,
+                referralsHandlingMethod, null, monitor, null );
+        }
     }
 
 }

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/SearchRunnable.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/SearchRunnable.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/SearchRunnable.java (original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/SearchRunnable.java Thu Aug 21 06:29:58 2008
@@ -291,6 +291,11 @@
     static NamingEnumeration<SearchResult> search( IBrowserConnection browserConnection, SearchParameter parameter,
         StudioProgressMonitor monitor )
     {
+        if ( browserConnection == null )
+        {
+            return null;
+        }
+
         String searchBase = parameter.getSearchBase().getUpName();
         SearchControls controls = new SearchControls();
         switch ( parameter.getScope() )

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/BrowserConnection.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/BrowserConnection.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/BrowserConnection.java (original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/BrowserConnection.java Thu Aug 21 06:29:58 2008
@@ -326,7 +326,7 @@
      */
     public String toString()
     {
-        return getConnection().getName();
+        return getConnection() != null ? getConnection().getName() : "null";
     }
 
 

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DelegateEntry.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DelegateEntry.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DelegateEntry.java (original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DelegateEntry.java Thu Aug 21 06:29:58 2008
@@ -82,12 +82,13 @@
     /**
      * Creates a new instance of DelegateEntry.
      * 
-     * @param connection the connection of the delegate
+     * @param browserConnection the browser connection of the delegate
      * @param dn the DN of the delegate
      */
-    public DelegateEntry( IBrowserConnection connection, LdapDN dn )
+    public DelegateEntry( IBrowserConnection browserConnection, LdapDN dn )
     {
-        this.connectionId = connection.getConnection().getId();
+        this.connectionId = browserConnection.getConnection() != null ? browserConnection.getConnection().getId()
+            : null;
         this.dn = dn;
         this.entryDoesNotExist = false;
         this.delegate = null;
@@ -102,9 +103,15 @@
      */
     protected IEntry getDelegate()
     {
+        IBrowserConnection browserConnection = BrowserCorePlugin.getDefault().getConnectionManager()
+            .getBrowserConnectionById( connectionId );
+        if ( browserConnection == null )
+        {
+            throw new IllegalStateException( "Connection " + connectionId + " does not exist." );
+        }
+        
         // always get the fresh entry from cache
-        IBrowserConnection conn = BrowserCorePlugin.getDefault().getConnectionManager().getBrowserConnectionById( connectionId );
-        delegate = conn.getEntryFromCache( dn );
+        delegate = browserConnection.getEntryFromCache( dn );
         
         if ( delegate != null
             && !delegate.getBrowserConnection().getConnection().getJNDIConnectionWrapper().isConnected() )
@@ -139,7 +146,13 @@
         }
         else
         {
-            return BrowserCorePlugin.getDefault().getConnectionManager().getBrowserConnectionById( connectionId );
+            IBrowserConnection browserConnection = BrowserCorePlugin.getDefault().getConnectionManager()
+                .getBrowserConnectionById( connectionId );
+            if ( browserConnection == null )
+            {
+                throw new IllegalStateException( "Connection " + connectionId + " does not exist." );
+            }
+            return browserConnection;
         }
     }
 

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java (original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java Thu Aug 21 06:29:58 2008
@@ -96,7 +96,7 @@
         }
         else
         {
-            this.connectionId = browserConnection.getConnection().getId();
+            this.connectionId = browserConnection.getConnection() != null ? browserConnection.getConnection().getId() : null;
         }
 
         this.dn = dn;
@@ -207,8 +207,13 @@
      */
     public IBrowserConnection getBrowserConnection()
     {
-        return dummyConnection != null ? dummyConnection : BrowserCorePlugin.getDefault().getConnectionManager()
-            .getBrowserConnectionById( this.connectionId );
+        IBrowserConnection browserConnection = dummyConnection != null ? dummyConnection : BrowserCorePlugin
+            .getDefault().getConnectionManager().getBrowserConnectionById( this.connectionId );
+        if ( browserConnection == null )
+        {
+            throw new IllegalStateException( "Connection " + connectionId + " does not exist." );
+        }
+        return browserConnection;
     }
 
 

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/Utils.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/Utils.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/Utils.java (original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/Utils.java Thu Aug 21 06:29:58 2008
@@ -316,16 +316,19 @@
     public static LdapURL getLdapURL( IBrowserConnection browserConnection )
     {
         LdapURL url = new LdapURL();
-        if ( browserConnection.getConnection().getEncryptionMethod() == EncryptionMethod.LDAPS )
+        if ( browserConnection.getConnection() != null )
         {
-            url.setScheme( LdapURL.LDAPS_SCHEME );
-        }
-        else
-        {
-            url.setScheme( LdapURL.LDAP_SCHEME );
+            if ( browserConnection.getConnection().getEncryptionMethod() == EncryptionMethod.LDAPS )
+            {
+                url.setScheme( LdapURL.LDAPS_SCHEME );
+            }
+            else
+            {
+                url.setScheme( LdapURL.LDAP_SCHEME );
+            }
+            url.setHost( browserConnection.getConnection().getHost() );
+            url.setPort( browserConnection.getConnection().getPort() );
         }
-        url.setHost( browserConnection.getConnection().getHost() );
-        url.setPort( browserConnection.getConnection().getPort() );
         return url;
     }
 

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/ModificationLogsViewInput.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/ModificationLogsViewInput.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/ModificationLogsViewInput.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/ModificationLogsViewInput.java Thu Aug 21 06:29:58 2008
@@ -34,8 +34,8 @@
 public class ModificationLogsViewInput
 {
 
-    /** The connection. */
-    private IBrowserConnection connection;
+    /** The browser connection. */
+    private IBrowserConnection browserConnection;
 
     /** The index of the displayed log file */
     private int index;
@@ -44,24 +44,24 @@
     /**
      * Creates a new instance of ModificationLogsViewInput.
      * 
-     * @param connection the connection
+     * @param browserConnection the browser connection
      * @param index the index of the displayed log file
      */
-    public ModificationLogsViewInput( IBrowserConnection connection, int index )
+    public ModificationLogsViewInput( IBrowserConnection browserConnection, int index )
     {
-        this.connection = connection;
+        this.browserConnection = browserConnection;
         this.index = index;
     }
 
 
     /**
-     * Gets the connection.
+     * Gets the browser connection.
      * 
-     * @return the connection
+     * @return the browser connection
      */
-    public IBrowserConnection getConnection()
+    public IBrowserConnection getBrowserConnection()
     {
-        return connection;
+        return browserConnection;
     }
 
 

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/ModificationLogsViewUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/ModificationLogsViewUniversalListener.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/ModificationLogsViewUniversalListener.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/ModificationLogsViewUniversalListener.java Thu Aug 21 06:29:58 2008
@@ -141,14 +141,14 @@
     void setInput( ModificationLogsViewInput input )
     {
         // only if another connection is selected
-        if ( this.input != input )
+        if ( this.input != input && input.getBrowserConnection().getConnection() != null )
         {
             this.input = input;
 
             // load file %u %g
             StringBuffer sb = new StringBuffer();
             LdifModificationLogger modificationLogger = ConnectionCorePlugin.getDefault().getLdifModificationLogger();
-            File[] files = modificationLogger.getFiles( input.getConnection().getConnection() );
+            File[] files = modificationLogger.getFiles( input.getBrowserConnection().getConnection() );
             int i = input.getIndex();
             if ( 0 <= i && i < files.length && files[i] != null && files[i].exists() && files[i].canRead() )
             {
@@ -225,34 +225,36 @@
 
 
     /**
-     * Clears the input and deletes the logfiles for it
-     * 
+     * Clears the input and deletes the logfiles for it.
      */
     public void clearInput()
     {
-        StringBuffer sb = new StringBuffer( "" );
-        FileWriter fw = null;
-        LdifModificationLogger modificationLogger = ConnectionCorePlugin.getDefault().getLdifModificationLogger();
-        File[] files = modificationLogger.getFiles( input.getConnection().getConnection() );
-        modificationLogger.dispose( input.getConnection().getConnection() );
-        for ( int i = 0; i < files.length; i++ )
+        if ( input.getBrowserConnection().getConnection() != null )
         {
-            try
+            StringBuffer sb = new StringBuffer( "" );
+            FileWriter fw = null;
+            LdifModificationLogger modificationLogger = ConnectionCorePlugin.getDefault().getLdifModificationLogger();
+            File[] files = modificationLogger.getFiles( input.getBrowserConnection().getConnection() );
+            modificationLogger.dispose( input.getBrowserConnection().getConnection() );
+            for ( int i = 0; i < files.length; i++ )
             {
-                if ( files[i] != null && files[i].exists() && !files[i].delete() )
+                try
                 {
-                    fw = new FileWriter( files[i] );
-                    fw.write( "" );
+                    if ( files[i] != null && files[i].exists() && !files[i].delete() )
+                    {
+                        fw = new FileWriter( files[i] );
+                        fw.write( "" );
+                    }
+    
+                }
+                catch ( Exception e )
+                {
+                    sb.append( e.getMessage() );
                 }
-
-            }
-            catch ( Exception e )
-            {
-                sb.append( e.getMessage() );
             }
+            view.getMainWidget().getSourceViewer().setTopIndex( 0 );
+            view.getMainWidget().getSourceViewer().getDocument().set( sb.toString() );
         }
-        view.getMainWidget().getSourceViewer().setTopIndex( 0 );
-        view.getMainWidget().getSourceViewer().getDocument().set( sb.toString() );
     }
 
 }

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/NewerAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/NewerAction.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/NewerAction.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/NewerAction.java Thu Aug 21 06:29:58 2008
@@ -66,7 +66,7 @@
     public void run()
     {
         ModificationLogsViewInput oldInput = ( ModificationLogsViewInput ) getInput();
-        ModificationLogsViewInput newInput = new ModificationLogsViewInput( oldInput.getConnection(), oldInput.getIndex() - 1 );
+        ModificationLogsViewInput newInput = new ModificationLogsViewInput( oldInput.getBrowserConnection(), oldInput.getIndex() - 1 );
         view.getUniversalListener().setInput( newInput );
         view.getUniversalListener().scrollToOldest();
 

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/OlderAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/OlderAction.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/OlderAction.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/OlderAction.java Thu Aug 21 06:29:58 2008
@@ -70,7 +70,7 @@
     public void run()
     {
         ModificationLogsViewInput oldInput = ( ModificationLogsViewInput ) getInput();
-        ModificationLogsViewInput newInput = new ModificationLogsViewInput( oldInput.getConnection(), oldInput
+        ModificationLogsViewInput newInput = new ModificationLogsViewInput( oldInput.getBrowserConnection(), oldInput
             .getIndex() + 1 );
         view.getUniversalListener().setInput( newInput );
         view.getUniversalListener().scrollToNewest();
@@ -112,12 +112,16 @@
         if ( getInput() != null && ( getInput() instanceof ModificationLogsViewInput ) )
         {
             ModificationLogsViewInput input = ( ModificationLogsViewInput ) getInput();
-            LdifModificationLogger modificationLogger = ConnectionCorePlugin.getDefault().getLdifModificationLogger();
-            File[] files = modificationLogger.getFiles( input.getConnection().getConnection() );
-            int i = input.getIndex() + 1;
-            if ( 0 <= i && i < files.length && files[i] != null && files[i].exists() && files[i].canRead() )
+            if ( input.getBrowserConnection().getConnection() != null )
             {
-                return true;
+                LdifModificationLogger modificationLogger = ConnectionCorePlugin.getDefault()
+                    .getLdifModificationLogger();
+                File[] files = modificationLogger.getFiles( input.getBrowserConnection().getConnection() );
+                int i = input.getIndex() + 1;
+                if ( 0 <= i && i < files.length && files[i] != null && files[i].exists() && files[i].canRead() )
+                {
+                    return true;
+                }
             }
         }
 

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/NewerAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/NewerAction.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/NewerAction.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/NewerAction.java Thu Aug 21 06:29:58 2008
@@ -66,7 +66,7 @@
     public void run()
     {
         SearchLogsViewInput oldInput = ( SearchLogsViewInput ) getInput();
-        SearchLogsViewInput newInput = new SearchLogsViewInput( oldInput.getConnection(), oldInput.getIndex() - 1 );
+        SearchLogsViewInput newInput = new SearchLogsViewInput( oldInput.getBrowserConnection(), oldInput.getIndex() - 1 );
         view.getUniversalListener().setInput( newInput );
         view.getUniversalListener().scrollToOldest();
 

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/OlderAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/OlderAction.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/OlderAction.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/OlderAction.java Thu Aug 21 06:29:58 2008
@@ -70,7 +70,7 @@
     public void run()
     {
         SearchLogsViewInput oldInput = ( SearchLogsViewInput ) getInput();
-        SearchLogsViewInput newInput = new SearchLogsViewInput( oldInput.getConnection(), oldInput
+        SearchLogsViewInput newInput = new SearchLogsViewInput( oldInput.getBrowserConnection(), oldInput
             .getIndex() + 1 );
         view.getUniversalListener().setInput( newInput );
         view.getUniversalListener().scrollToNewest();
@@ -112,12 +112,15 @@
         if ( getInput() != null && ( getInput() instanceof SearchLogsViewInput ) )
         {
             SearchLogsViewInput input = ( SearchLogsViewInput ) getInput();
-            LdifSearchLogger searchLogger = ConnectionCorePlugin.getDefault().getLdifSearchLogger();
-            File[] files = searchLogger.getFiles( input.getConnection().getConnection() );
-            int i = input.getIndex() + 1;
-            if ( 0 <= i && i < files.length && files[i] != null && files[i].exists() && files[i].canRead() )
+            if ( input.getBrowserConnection().getConnection() != null )
             {
-                return true;
+                LdifSearchLogger searchLogger = ConnectionCorePlugin.getDefault().getLdifSearchLogger();
+                File[] files = searchLogger.getFiles( input.getBrowserConnection().getConnection() );
+                int i = input.getIndex() + 1;
+                if ( 0 <= i && i < files.length && files[i] != null && files[i].exists() && files[i].canRead() )
+                {
+                    return true;
+                }
             }
         }
 

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/SearchLogsViewInput.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/SearchLogsViewInput.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/SearchLogsViewInput.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/SearchLogsViewInput.java Thu Aug 21 06:29:58 2008
@@ -34,8 +34,8 @@
 public class SearchLogsViewInput
 {
 
-    /** The connection. */
-    private IBrowserConnection connection;
+    /** The browser connection. */
+    private IBrowserConnection browserConnection;
 
     /** The index of the displayed log file */
     private int index;
@@ -44,24 +44,24 @@
     /**
      * Creates a new instance of ModificationLogsViewInput.
      * 
-     * @param connection the connection
+     * @param browserConnection the browser connection
      * @param index the index of the displayed log file
      */
-    public SearchLogsViewInput( IBrowserConnection connection, int index )
+    public SearchLogsViewInput( IBrowserConnection browserConnection, int index )
     {
-        this.connection = connection;
+        this.browserConnection = browserConnection;
         this.index = index;
     }
 
 
     /**
-     * Gets the connection.
+     * Gets the browser connection.
      * 
-     * @return the connection
+     * @return the browser connection
      */
-    public IBrowserConnection getConnection()
+    public IBrowserConnection getBrowserConnection()
     {
-        return connection;
+        return browserConnection;
     }
 
 

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/SearchLogsViewUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/SearchLogsViewUniversalListener.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/SearchLogsViewUniversalListener.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/SearchLogsViewUniversalListener.java Thu Aug 21 06:29:58 2008
@@ -151,14 +151,14 @@
     void setInput( SearchLogsViewInput input )
     {
         // only if another connection is selected
-        if ( this.input != input )
+        if ( this.input != input && input.getBrowserConnection().getConnection() != null )
         {
             this.input = input;
 
             // load file %u %g
             StringBuffer sb = new StringBuffer();
             LdifSearchLogger searchLogger = ConnectionCorePlugin.getDefault().getLdifSearchLogger();
-            File[] files = searchLogger.getFiles( input.getConnection().getConnection() );
+            File[] files = searchLogger.getFiles( input.getBrowserConnection().getConnection() );
             int i = input.getIndex();
             if ( 0 <= i && i < files.length && files[i] != null && files[i].exists() && files[i].canRead() )
             {
@@ -270,34 +270,36 @@
 
 
     /**
-     * Clears the input and deletes the logfiles for it
-     * 
+     * Clears the input and deletes the logfiles for it.
      */
     public void clearInput()
     {
-        StringBuffer sb = new StringBuffer( "" );
-        FileWriter fw = null;
-        LdifSearchLogger searchLogger = ConnectionCorePlugin.getDefault().getLdifSearchLogger();
-        File[] files = searchLogger.getFiles( input.getConnection().getConnection() );
-        searchLogger.dispose( input.getConnection().getConnection() );
-        for ( int i = 0; i < files.length; i++ )
+        if ( input.getBrowserConnection().getConnection() != null )
         {
-            try
+            StringBuffer sb = new StringBuffer( "" );
+            FileWriter fw = null;
+            LdifSearchLogger searchLogger = ConnectionCorePlugin.getDefault().getLdifSearchLogger();
+            File[] files = searchLogger.getFiles( input.getBrowserConnection().getConnection() );
+            searchLogger.dispose( input.getBrowserConnection().getConnection() );
+            for ( int i = 0; i < files.length; i++ )
             {
-                if ( files[i] != null && files[i].exists() && !files[i].delete() )
+                try
                 {
-                    fw = new FileWriter( files[i] );
-                    fw.write( "" );
+                    if ( files[i] != null && files[i].exists() && !files[i].delete() )
+                    {
+                        fw = new FileWriter( files[i] );
+                        fw.write( "" );
+                    }
+    
+                }
+                catch ( Exception e )
+                {
+                    sb.append( e.getMessage() );
                 }
-
-            }
-            catch ( Exception e )
-            {
-                sb.append( e.getMessage() );
             }
+            view.getMainWidget().getSourceViewer().setTopIndex( 0 );
+            view.getMainWidget().getSourceViewer().getDocument().set( sb.toString() );
         }
-        view.getMainWidget().getSourceViewer().setTopIndex( 0 );
-        view.getMainWidget().getSourceViewer().getDocument().set( sb.toString() );
     }
 
 }

Modified: directory/studio/trunk/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/LdifEntryEditorDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/LdifEntryEditorDialog.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/LdifEntryEditorDialog.java (original)
+++ directory/studio/trunk/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/LdifEntryEditorDialog.java Thu Aug 21 06:29:58 2008
@@ -61,7 +61,9 @@
 
     public static final int MAX_HEIGHT = 250;
 
-    private IBrowserConnection connection;
+    private IBrowserConnection browserConnection;
+
+    private boolean originalReadOnlyFlag;
 
     private LdifRecord ldifRecord;
 
@@ -79,25 +81,28 @@
     private IContextActivation contextActivation;
 
 
-    public LdifEntryEditorDialog( Shell parentShell, IBrowserConnection connection, LdifContentRecord ldifRecord )
+    public LdifEntryEditorDialog( Shell parentShell, IBrowserConnection browserConnection, LdifContentRecord ldifRecord )
     {
-        this( parentShell, connection, ldifRecord, null );
+        this( parentShell, browserConnection, ldifRecord, null );
     }
 
 
-    public LdifEntryEditorDialog( Shell parentShell, IBrowserConnection connection, LdifChangeAddRecord ldifRecord )
+    public LdifEntryEditorDialog( Shell parentShell, IBrowserConnection browserConnection,
+        LdifChangeAddRecord ldifRecord )
     {
-        this( parentShell, connection, ldifRecord, null );
+        this( parentShell, browserConnection, ldifRecord, null );
     }
 
 
-    private LdifEntryEditorDialog( Shell parentShell, IBrowserConnection connection, LdifRecord ldifRecord, String s )
+    private LdifEntryEditorDialog( Shell parentShell, IBrowserConnection browserConnection, LdifRecord ldifRecord,
+        String s )
     {
         super( parentShell );
         setShellStyle( getShellStyle() | SWT.RESIZE );
         this.ldifRecord = ldifRecord;
 
-        this.connection = connection != null ? connection : new DummyConnection( Schema.DEFAULT_SCHEMA );
+        this.browserConnection = browserConnection != null ? browserConnection : new DummyConnection(
+            Schema.DEFAULT_SCHEMA );
     }
 
 
@@ -141,7 +146,12 @@
     public void create()
     {
         super.create();
-        //this.actionGroup.activateGlobalActionHandlers();
+
+        if ( browserConnection.getConnection() != null )
+        {
+            originalReadOnlyFlag = browserConnection.getConnection().isReadOnly();
+            browserConnection.getConnection().setReadOnly( true );
+        }
     }
 
 
@@ -151,6 +161,11 @@
         if ( returnValue )
         {
             this.dispose();
+
+            if ( browserConnection.getConnection() != null )
+            {
+                browserConnection.getConnection().setReadOnly( originalReadOnlyFlag );
+            }
         }
         return returnValue;
     }
@@ -221,11 +236,12 @@
         {
             if ( ldifRecord instanceof LdifContentRecord )
             {
-                entry = ModelConverter.ldifContentRecordToEntry( ( LdifContentRecord ) ldifRecord, connection );
+                entry = ModelConverter.ldifContentRecordToEntry( ( LdifContentRecord ) ldifRecord, browserConnection );
             }
             else if ( ldifRecord instanceof LdifChangeAddRecord )
             {
-                entry = ModelConverter.ldifChangeAddRecordToEntry( ( LdifChangeAddRecord ) ldifRecord, connection );
+                entry = ModelConverter.ldifChangeAddRecordToEntry( ( LdifChangeAddRecord ) ldifRecord,
+                    browserConnection );
             }
 
             if ( entry != null )

Modified: directory/studio/trunk/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifEditor.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifEditor.java (original)
+++ directory/studio/trunk/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifEditor.java Thu Aug 21 06:29:58 2008
@@ -569,7 +569,9 @@
     {
         this.browserConnection = browserConnection;
         getEditorSite().getActionBars().getStatusLineManager().setMessage(
-            "Used Connection: " + ( this.browserConnection == null ? "-" : this.browserConnection.getConnection().getName() ) );
+            "Used Connection: "
+                + ( browserConnection == null || browserConnection.getConnection() == null ? "-" : browserConnection
+                    .getConnection().getName() ) );
         // getStatusField("ldapconnection").setText();
         
         IAction action = getAction( ExecuteLdifAction.class.getName() );

Modified: directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/password/PasswordDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/password/PasswordDialog.java?rev=687753&r1=687752&r2=687753&view=diff
==============================================================================
--- directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/password/PasswordDialog.java (original)
+++ directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/password/PasswordDialog.java Thu Aug 21 06:29:58 2008
@@ -440,7 +440,7 @@
             && currentPassword.toBytes().length > 0 );
         verifyPasswordButton.setEnabled( testPasswordText.isEnabled() && !"".equals( testPasswordText.getText() ) );
         bindPasswordButton.setEnabled( testPasswordText.isEnabled() && !"".equals( testPasswordText.getText() )
-            && entry != null );
+            && entry != null && entry.getBrowserConnection().getConnection() != null );
 
         // default dialog button
         if ( verifyPasswordButton.isEnabled() )
@@ -485,7 +485,8 @@
      */
     private void bindCurrentPassword()
     {
-        if ( !"".equals( testPasswordText.getText() ) && entry != null )
+        if ( !"".equals( testPasswordText.getText() ) && entry != null
+            && entry.getBrowserConnection().getConnection() != null )
         {
             Connection connection = ( Connection ) entry.getBrowserConnection().getConnection().clone();
             connection.setName( null );



Mime
View raw message