Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/apache/directory-studio.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Seelmann <mail@stefan-seelmann.de>2020-05-04 23:00:17 +0300
committerStefan Seelmann <mail@stefan-seelmann.de>2020-05-04 23:00:17 +0300
commit16753e1c51f04018e15e1b66a59a99e378884666 (patch)
tree7349f0409eab254843deac8b1f4f8b8906cae63e /plugins
parent4aa973bcd2d121e0c638b54403dee2b31a70fdc7 (diff)
DIRSTUDIO-1251: Show LDAP result code in modification log, LDIF log, and error dialog
Diffstat (limited to 'plugins')
-rw-r--r--plugins/common.core/src/main/java/org/apache/directory/studio/common/core/jobs/StudioProgressMonitor.java2
-rw-r--r--plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/ILdapLogger.java42
-rw-r--r--plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/StudioLdapException.java74
-rw-r--r--plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java52
-rw-r--r--plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/LdifModificationLogger.java47
-rw-r--r--plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/LdifSearchLogger.java52
-rw-r--r--plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CopyEntriesRunnable.java4
-rw-r--r--plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesRunnable.java4
-rw-r--r--plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ImportLdifRunnable.java4
-rw-r--r--plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/MoveEntriesRunnable.java4
-rw-r--r--plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/RenameEntryRunnable.java4
-rw-r--r--plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/PasswordModifyExtendedOperationAction.java1
12 files changed, 147 insertions, 143 deletions
diff --git a/plugins/common.core/src/main/java/org/apache/directory/studio/common/core/jobs/StudioProgressMonitor.java b/plugins/common.core/src/main/java/org/apache/directory/studio/common/core/jobs/StudioProgressMonitor.java
index 321406763..6dcbb4051 100644
--- a/plugins/common.core/src/main/java/org/apache/directory/studio/common/core/jobs/StudioProgressMonitor.java
+++ b/plugins/common.core/src/main/java/org/apache/directory/studio/common/core/jobs/StudioProgressMonitor.java
@@ -285,7 +285,7 @@ public class StudioProgressMonitor extends ProgressMonitorWrapper
if ( indexOfAny > -1 )
{
- exceptionMessage = exceptionMessage.substring( 0, indexOfAny - 1 );
+ exceptionMessage = exceptionMessage.substring( 0, indexOfAny );
}
buffer.append( "\n - " ).append( exceptionMessage ); //$NON-NLS-1$
diff --git a/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/ILdapLogger.java b/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/ILdapLogger.java
index fd00f5994..259245dad 100644
--- a/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/ILdapLogger.java
+++ b/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/ILdapLogger.java
@@ -26,11 +26,11 @@ import javax.naming.directory.SearchControls;
import org.apache.directory.api.ldap.model.entry.Entry;
import org.apache.directory.api.ldap.model.entry.Modification;
-import org.apache.directory.api.ldap.model.exception.LdapException;
import org.apache.directory.api.ldap.model.message.Control;
import org.apache.directory.api.ldap.model.message.Referral;
import org.apache.directory.api.ldap.model.name.Dn;
import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod;
+import org.apache.directory.studio.connection.core.io.StudioLdapException;
/**
@@ -49,7 +49,10 @@ public interface ILdapLogger
* @param controls the controls
* @param ex the LDAP exception if an error occurred, null otherwise
*/
- void logChangetypeAdd( Connection connection, final Entry entry, final Control[] controls, LdapException ex );
+ default void logChangetypeAdd( Connection connection, final Entry entry, final Control[] controls,
+ StudioLdapException ex )
+ {
+ }
/**
@@ -61,8 +64,11 @@ public interface ILdapLogger
* @param ex the LDAP exception if an error occurred, null otherwise
*
*/
- void logChangetypeDelete( Connection connection, final Dn dn, final Control[] controls,
- LdapException ex );
+ default void logChangetypeDelete( Connection connection, final Dn dn, final Control[] controls,
+ StudioLdapException ex )
+ {
+
+ }
/**
@@ -74,8 +80,10 @@ public interface ILdapLogger
* @param ex the LDAP exception if an error occurred, null otherwise
* @param controls the controls
*/
- void logChangetypeModify( Connection connection, final Dn dn,
- final Collection<Modification> modifications, final Control[] controls, LdapException ex );
+ default void logChangetypeModify( Connection connection, final Dn dn,
+ final Collection<Modification> modifications, final Control[] controls, StudioLdapException ex )
+ {
+ }
/**
@@ -88,8 +96,10 @@ public interface ILdapLogger
* @param controls the controls
* @param ex the LDAP exception if an error occurred, null otherwise
*/
- void logChangetypeModDn( Connection connection, final Dn oldDn, final Dn newDn,
- final boolean deleteOldRdn, final Control[] controls, LdapException ex );
+ default void logChangetypeModDn( Connection connection, final Dn oldDn, final Dn newDn,
+ final boolean deleteOldRdn, final Control[] controls, StudioLdapException ex )
+ {
+ }
/**
@@ -152,9 +162,11 @@ public interface ILdapLogger
* @param requestNum the request number
* @param ex the LDAP exception if an error occurred, null otherwise
*/
- void logSearchRequest( Connection connection, String searchBase, String filter,
+ default void logSearchRequest( Connection connection, String searchBase, String filter,
SearchControls searchControls, AliasDereferencingMethod aliasesDereferencingMethod,
- Control[] controls, long requestNum, LdapException ex );
+ Control[] controls, long requestNum, StudioLdapException ex )
+ {
+ }
/**
@@ -166,8 +178,10 @@ public interface ILdapLogger
* @param requestNum the request number
* @param ex the LDAP exception if an error occurred, null otherwise
*/
- void logSearchResultReference( Connection connection, Referral referral,
- ReferralsInfo referralsInfo, long requestNum, LdapException ex );
+ default void logSearchResultReference( Connection connection, Referral referral,
+ ReferralsInfo referralsInfo, long requestNum, StudioLdapException ex )
+ {
+ }
/**
@@ -178,6 +192,8 @@ public interface ILdapLogger
* @param requestNum the request number
* @param ex the LDAP exception if an error occurred, null otherwise
*/
- void logSearchResultDone( Connection connection, long count, long requestNum, LdapException ex );
+ default void logSearchResultDone( Connection connection, long count, long requestNum, StudioLdapException ex )
+ {
+ }
}
diff --git a/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/StudioLdapException.java b/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/StudioLdapException.java
new file mode 100644
index 000000000..4057a4de4
--- /dev/null
+++ b/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/StudioLdapException.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.connection.core.io;
+
+
+import java.util.Locale;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.exception.ExceptionUtils;
+import org.apache.directory.api.ldap.model.exception.LdapContextNotEmptyException;
+import org.apache.directory.api.ldap.model.exception.LdapEntryAlreadyExistsException;
+import org.apache.directory.api.ldap.model.exception.LdapOperationException;
+import org.apache.directory.api.ldap.model.message.ResultCodeEnum;
+
+
+public class StudioLdapException extends Exception
+{
+ private static final long serialVersionUID = -1L;
+
+ public StudioLdapException( Exception exception )
+ {
+ super( exception );
+ }
+
+
+ @Override
+ public String getMessage()
+ {
+ String message = "";
+ Throwable cause = getCause();
+ if ( cause instanceof LdapOperationException )
+ {
+ LdapOperationException loe = ( LdapOperationException ) cause;
+ ResultCodeEnum rc = loe.getResultCode();
+ String template = " [LDAP result code %d - %s]"; //$NON-NLS-1$
+ message += String.format( Locale.ROOT, template, rc.getResultCode(), rc.getMessage() );
+ }
+ if ( StringUtils.isNotBlank( cause.getMessage() ) )
+ {
+ message += " " + cause.getMessage(); //$NON-NLS-1$
+ }
+ return message;
+ }
+
+
+ public static boolean isEntryAlreadyExistsException( Exception exception )
+ {
+ return ExceptionUtils.indexOfThrowable( exception, LdapEntryAlreadyExistsException.class ) > -1;
+ }
+
+
+ public static boolean isContextNotEmptyException( Exception exception )
+ {
+ return ExceptionUtils.indexOfThrowable( exception, LdapContextNotEmptyException.class ) > -1;
+ }
+
+}
diff --git a/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java b/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java
index b7ebdb3cc..0450fd206 100644
--- a/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java
+++ b/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java
@@ -91,6 +91,7 @@ import org.apache.directory.studio.connection.core.Messages;
import org.apache.directory.studio.connection.core.ReferralsInfo;
import org.apache.directory.studio.connection.core.io.ConnectionWrapper;
import org.apache.directory.studio.connection.core.io.ConnectionWrapperUtils;
+import org.apache.directory.studio.connection.core.io.StudioLdapException;
import org.apache.directory.studio.connection.core.io.StudioTrustManager;
import org.eclipse.core.runtime.Preferences;
import org.eclipse.osgi.util.NLS;
@@ -243,7 +244,7 @@ public class DirectoryApiConnectionWrapper implements ConnectionWrapper
}
catch ( Exception e )
{
- exception = e;
+ exception = toStudioLdapException( e );
try
{
@@ -493,7 +494,7 @@ public class DirectoryApiConnectionWrapper implements ConnectionWrapper
}
catch ( Exception e )
{
- exception = e;
+ exception = toStudioLdapException( e );
}
}
};
@@ -593,23 +594,21 @@ public class DirectoryApiConnectionWrapper implements ConnectionWrapper
}
catch ( Exception e )
{
- exception = e;
+ exception = toStudioLdapException( e );
}
- LdapException le = toLdapException( exception );
-
for ( ILdapLogger logger : getLdapLoggers() )
{
if ( searchResultEnumeration != null )
{
logger.logSearchRequest( connection, searchBase, filter, searchControls,
- aliasesDereferencingMethod, controls, requestNum, le );
+ aliasesDereferencingMethod, controls, requestNum, exception );
}
else
{
logger.logSearchRequest( connection, searchBase, filter, searchControls,
- aliasesDereferencingMethod, controls, requestNum, le );
- logger.logSearchResultDone( connection, 0, requestNum, le );
+ aliasesDereferencingMethod, controls, requestNum, exception );
+ logger.logSearchResultDone( connection, 0, requestNum, exception );
}
}
}
@@ -750,14 +749,12 @@ public class DirectoryApiConnectionWrapper implements ConnectionWrapper
}
catch ( Exception e )
{
- exception = e;
+ exception = toStudioLdapException( e );
}
- LdapException le = toLdapException( exception );
-
for ( ILdapLogger logger : getLdapLoggers() )
{
- logger.logChangetypeModify( connection, dn, modifications, controls, le );
+ logger.logChangetypeModify( connection, dn, modifications, controls, exception );
}
}
};
@@ -831,14 +828,12 @@ public class DirectoryApiConnectionWrapper implements ConnectionWrapper
}
catch ( Exception e )
{
- exception = e;
+ exception = toStudioLdapException( e );
}
- LdapException le = toLdapException( exception );
-
for ( ILdapLogger logger : getLdapLoggers() )
{
- logger.logChangetypeModDn( connection, oldDn, newDn, deleteOldRdn, controls, le );
+ logger.logChangetypeModDn( connection, oldDn, newDn, deleteOldRdn, controls, exception );
}
}
};
@@ -912,14 +907,12 @@ public class DirectoryApiConnectionWrapper implements ConnectionWrapper
}
catch ( Exception e )
{
- exception = e;
+ exception = toStudioLdapException( e );
}
- LdapException le = toLdapException( exception );
-
for ( ILdapLogger logger : getLdapLoggers() )
{
- logger.logChangetypeAdd( connection, entry, controls, le );
+ logger.logChangetypeAdd( connection, entry, controls, exception );
}
}
};
@@ -990,14 +983,12 @@ public class DirectoryApiConnectionWrapper implements ConnectionWrapper
}
catch ( Exception e )
{
- exception = e;
+ exception = toStudioLdapException( e );
}
- LdapException le = toLdapException( exception );
-
for ( ILdapLogger logger : getLdapLoggers() )
{
- logger.logChangetypeDelete( connection, dn, controls, le );
+ logger.logChangetypeDelete( connection, dn, controls, exception );
}
}
};
@@ -1049,12 +1040,9 @@ public class DirectoryApiConnectionWrapper implements ConnectionWrapper
}
catch ( Exception e )
{
- exception = e;
+ exception = toStudioLdapException( e );
}
- // TODO: logging?
- LdapException le = toLdapException( exception );
-
for ( ILdapLogger logger : getLdapLoggers() )
{
}
@@ -1090,7 +1078,7 @@ public class DirectoryApiConnectionWrapper implements ConnectionWrapper
abstract class InnerRunnable implements Runnable
{
protected StudioSearchResultEnumeration searchResultEnumeration = null;
- protected Exception exception = null;
+ protected StudioLdapException exception = null;
protected boolean canceled = false;
@@ -1357,7 +1345,7 @@ public class DirectoryApiConnectionWrapper implements ConnectionWrapper
}
- private LdapException toLdapException( Exception exception )
+ private StudioLdapException toStudioLdapException( Exception exception )
{
if ( exception == null )
{
@@ -1365,11 +1353,11 @@ public class DirectoryApiConnectionWrapper implements ConnectionWrapper
}
else if ( exception instanceof LdapException )
{
- return ( LdapException ) exception;
+ return new StudioLdapException( ( LdapException ) exception );
}
else
{
- return new LdapException( exception.getMessage(), exception );
+ return new StudioLdapException( exception );
}
}
diff --git a/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/LdifModificationLogger.java b/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/LdifModificationLogger.java
index ee73cd00d..c3076b61d 100644
--- a/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/LdifModificationLogger.java
+++ b/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/LdifModificationLogger.java
@@ -39,26 +39,21 @@ import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
-import javax.naming.directory.SearchControls;
-
import org.apache.directory.api.ldap.model.entry.Attribute;
import org.apache.directory.api.ldap.model.entry.Entry;
import org.apache.directory.api.ldap.model.entry.Modification;
import org.apache.directory.api.ldap.model.entry.Value;
-import org.apache.directory.api.ldap.model.exception.LdapException;
import org.apache.directory.api.ldap.model.message.Control;
-import org.apache.directory.api.ldap.model.message.Referral;
import org.apache.directory.api.ldap.model.name.Dn;
import org.apache.directory.api.ldap.model.name.Rdn;
import org.apache.directory.api.util.Strings;
import org.apache.directory.studio.connection.core.Connection;
-import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod;
import org.apache.directory.studio.connection.core.ConnectionCoreConstants;
import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
import org.apache.directory.studio.connection.core.ConnectionManager;
import org.apache.directory.studio.connection.core.Controls;
import org.apache.directory.studio.connection.core.ILdapLogger;
-import org.apache.directory.studio.connection.core.ReferralsInfo;
+import org.apache.directory.studio.connection.core.io.StudioLdapException;
import org.apache.directory.studio.ldifparser.LdifFormatParameters;
import org.apache.directory.studio.ldifparser.model.container.LdifChangeAddRecord;
import org.apache.directory.studio.ldifparser.model.container.LdifChangeDeleteRecord;
@@ -207,7 +202,7 @@ public class LdifModificationLogger implements ILdapLogger
}
- private void log( String text, LdapException ex, Connection connection )
+ private void log( String text, StudioLdapException ex, Connection connection )
{
String id = connection.getId();
if ( !loggers.containsKey( id ) )
@@ -261,7 +256,7 @@ public class LdifModificationLogger implements ILdapLogger
/**
* {@inheritDoc}
*/
- public void logChangetypeAdd( Connection connection, final Entry entry, final Control[] controls, LdapException ex )
+ public void logChangetypeAdd( Connection connection, final Entry entry, final Control[] controls, StudioLdapException ex )
{
if ( !isModificationLogEnabled() )
{
@@ -305,7 +300,7 @@ public class LdifModificationLogger implements ILdapLogger
* {@inheritDoc}
*/
public void logChangetypeDelete( Connection connection, final Dn dn, final Control[] controls,
- LdapException ex )
+ StudioLdapException ex )
{
if ( !isModificationLogEnabled() )
{
@@ -326,7 +321,7 @@ public class LdifModificationLogger implements ILdapLogger
* {@inheritDoc}
*/
public void logChangetypeModify( Connection connection, final Dn dn,
- final Collection<Modification> modifications, final Control[] controls, LdapException ex )
+ final Collection<Modification> modifications, final Control[] controls, StudioLdapException ex )
{
if ( !isModificationLogEnabled() )
{
@@ -388,7 +383,7 @@ public class LdifModificationLogger implements ILdapLogger
* {@inheritDoc}
*/
public void logChangetypeModDn( Connection connection, final Dn oldDn, final Dn newDn,
- final boolean deleteOldRdn, final Control[] controls, LdapException ex )
+ final boolean deleteOldRdn, final Control[] controls, StudioLdapException ex )
{
if ( !isModificationLogEnabled() )
{
@@ -412,36 +407,6 @@ public class LdifModificationLogger implements ILdapLogger
/**
- * {@inheritDoc}
- */
- public void logSearchRequest( Connection connection, String searchBase, String filter,
- SearchControls searchControls, AliasDereferencingMethod aliasesDereferencingMethod,
- Control[] controls, long requestNum, LdapException ex )
- {
- // don't log searches
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void logSearchResultReference( Connection connection, Referral referral,
- ReferralsInfo referralsInfo, long requestNum, LdapException ex )
- {
- // don't log searches
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void logSearchResultDone( Connection connection, long count, long requestNum, LdapException ex )
- {
- // don't log searches
- }
-
-
- /**
* Adds control lines to the record
*
* @param record the recored
diff --git a/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/LdifSearchLogger.java b/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/LdifSearchLogger.java
index d2772af4a..f49a20170 100644
--- a/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/LdifSearchLogger.java
+++ b/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/LdifSearchLogger.java
@@ -41,12 +41,8 @@ import java.util.logging.Logger;
import javax.naming.directory.SearchControls;
import org.apache.commons.lang3.StringUtils;
-import org.apache.directory.api.ldap.model.entry.Entry;
-import org.apache.directory.api.ldap.model.entry.Modification;
-import org.apache.directory.api.ldap.model.exception.LdapException;
import org.apache.directory.api.ldap.model.message.Control;
import org.apache.directory.api.ldap.model.message.Referral;
-import org.apache.directory.api.ldap.model.name.Dn;
import org.apache.directory.api.ldap.model.url.LdapUrl;
import org.apache.directory.studio.connection.core.Connection;
import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod;
@@ -56,6 +52,7 @@ import org.apache.directory.studio.connection.core.ConnectionManager;
import org.apache.directory.studio.connection.core.ILdapLogger;
import org.apache.directory.studio.connection.core.ReferralsInfo;
import org.apache.directory.studio.connection.core.Utils;
+import org.apache.directory.studio.connection.core.io.StudioLdapException;
import org.apache.directory.studio.ldifparser.LdifFormatParameters;
import org.apache.directory.studio.ldifparser.model.lines.LdifCommentLine;
import org.apache.directory.studio.ldifparser.model.lines.LdifLineBase;
@@ -191,7 +188,7 @@ public class LdifSearchLogger implements ILdapLogger
}
- private void log( String text, String type, LdapException ex, Connection connection )
+ private void log( String text, String type, StudioLdapException ex, Connection connection )
{
String id = connection.getId();
if ( !loggers.containsKey( id ) )
@@ -245,48 +242,9 @@ public class LdifSearchLogger implements ILdapLogger
/**
* {@inheritDoc}
*/
- public void logChangetypeAdd( Connection connection, final Entry entry, final Control[] controls, LdapException ex )
- {
- // don't log changetypes
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void logChangetypeDelete( Connection connection, final Dn dn, final Control[] controls,
- LdapException ex )
- {
- // don't log changetypes
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void logChangetypeModify( Connection connection, final Dn dn,
- final Collection<Modification> modifications, final Control[] controls, LdapException ex )
- {
- // don't log changetypes
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void logChangetypeModDn( Connection connection, final Dn oldDn, final Dn newDn,
- final boolean deleteOldRdn, final Control[] controls, LdapException ex )
- {
- // don't log changetypes
- }
-
-
- /**
- * {@inheritDoc}
- */
public void logSearchRequest( Connection connection, String searchBase, String filter,
SearchControls searchControls, AliasDereferencingMethod aliasesDereferencingMethod,
- Control[] controls, long requestNum, LdapException ex )
+ Control[] controls, long requestNum, StudioLdapException ex )
{
if ( !isSearchRequestLogEnabled() )
{
@@ -349,7 +307,7 @@ public class LdifSearchLogger implements ILdapLogger
* {@inheritDoc}
*/
public void logSearchResultReference( Connection connection, Referral referral,
- ReferralsInfo referralsInfo, long requestNum, LdapException ex )
+ ReferralsInfo referralsInfo, long requestNum, StudioLdapException ex )
{
if ( !isSearchResultEntryLogEnabled() )
{
@@ -373,7 +331,7 @@ public class LdifSearchLogger implements ILdapLogger
/**
* {@inheritDoc}
*/
- public void logSearchResultDone( Connection connection, long count, long requestNum, LdapException ex )
+ public void logSearchResultDone( Connection connection, long count, long requestNum, StudioLdapException ex )
{
if ( !isSearchRequestLogEnabled() )
{
diff --git a/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CopyEntriesRunnable.java b/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CopyEntriesRunnable.java
index 50e9c0678..ea879310b 100644
--- a/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CopyEntriesRunnable.java
+++ b/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CopyEntriesRunnable.java
@@ -43,6 +43,7 @@ import org.apache.directory.studio.connection.core.Connection;
import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod;
import org.apache.directory.studio.connection.core.Connection.ReferralHandlingMethod;
import org.apache.directory.studio.connection.core.Controls;
+import org.apache.directory.studio.connection.core.io.StudioLdapException;
import org.apache.directory.studio.connection.core.io.api.StudioSearchResultEnumeration;
import org.apache.directory.studio.connection.core.jobs.StudioConnectionBulkRunnableWithProgress;
import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
@@ -317,7 +318,8 @@ public class CopyEntriesRunnable implements StudioConnectionBulkRunnableWithProg
while ( dummyMonitor.errorsReported() )
{
- if ( dialog != null && dummyMonitor.getException() instanceof LdapEntryAlreadyExistsException )
+ if ( dialog != null
+ && StudioLdapException.isEntryAlreadyExistsException( dummyMonitor.getException() ) )
{
// open dialog
dialog.setExistingEntry( targetBrowserConnection, newLdapDn );
diff --git a/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesRunnable.java b/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesRunnable.java
index b7bd125fd..a9b293531 100644
--- a/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesRunnable.java
+++ b/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesRunnable.java
@@ -31,7 +31,6 @@ import java.util.Set;
import javax.naming.directory.SearchControls;
-import org.apache.directory.api.ldap.model.exception.LdapContextNotEmptyException;
import org.apache.directory.api.ldap.model.message.Control;
import org.apache.directory.api.ldap.model.name.Dn;
import org.apache.directory.studio.common.core.jobs.StudioProgressMonitor;
@@ -40,6 +39,7 @@ import org.apache.directory.studio.connection.core.Controls;
import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod;
import org.apache.directory.studio.connection.core.Connection.ReferralHandlingMethod;
import org.apache.directory.studio.connection.core.StudioControl;
+import org.apache.directory.studio.connection.core.io.StudioLdapException;
import org.apache.directory.studio.connection.core.io.api.StudioSearchResultEnumeration;
import org.apache.directory.studio.connection.core.jobs.StudioConnectionBulkRunnableWithProgress;
import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
@@ -276,7 +276,7 @@ public class DeleteEntriesRunnable implements StudioConnectionBulkRunnableWithPr
new String[]
{ "" + numberOfDeletedEntries } ) ); //$NON-NLS-1$
}
- else if ( dummyMonitor.getException() instanceof LdapContextNotEmptyException )
+ else if ( StudioLdapException.isContextNotEmptyException( dummyMonitor.getException() ) )
{
// do not follow referrals or dereference aliases when deleting entries
AliasDereferencingMethod aliasDereferencingMethod = AliasDereferencingMethod.NEVER;
diff --git a/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ImportLdifRunnable.java b/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ImportLdifRunnable.java
index cf7b569f8..d0c301dc2 100644
--- a/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ImportLdifRunnable.java
+++ b/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ImportLdifRunnable.java
@@ -42,7 +42,6 @@ import org.apache.directory.api.ldap.model.entry.DefaultModification;
import org.apache.directory.api.ldap.model.entry.Entry;
import org.apache.directory.api.ldap.model.entry.Modification;
import org.apache.directory.api.ldap.model.entry.ModificationOperation;
-import org.apache.directory.api.ldap.model.exception.LdapEntryAlreadyExistsException;
import org.apache.directory.api.ldap.model.exception.LdapException;
import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
import org.apache.directory.api.ldap.model.exception.LdapSchemaException;
@@ -52,6 +51,7 @@ import org.apache.directory.studio.common.core.jobs.StudioProgressMonitor;
import org.apache.directory.studio.connection.core.Connection;
import org.apache.directory.studio.connection.core.ConnectionCoreConstants;
import org.apache.directory.studio.connection.core.Controls;
+import org.apache.directory.studio.connection.core.io.StudioLdapException;
import org.apache.directory.studio.connection.core.jobs.StudioConnectionBulkRunnableWithProgress;
import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
import org.apache.directory.studio.ldapbrowser.core.events.BulkModificationEvent;
@@ -445,7 +445,7 @@ public class ImportLdifRunnable implements StudioConnectionBulkRunnableWithProgr
.createEntry( entry, getControls( record ), monitor, null );
if ( monitor.errorsReported() && updateIfEntryExists
- && monitor.getException() instanceof LdapEntryAlreadyExistsException )
+ && StudioLdapException.isEntryAlreadyExistsException( monitor.getException() ) )
{
// creation failed with Error 68, now try to update the existing entry
monitor.reset();
diff --git a/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/MoveEntriesRunnable.java b/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/MoveEntriesRunnable.java
index 3b18a2603..f0a50e596 100644
--- a/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/MoveEntriesRunnable.java
+++ b/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/MoveEntriesRunnable.java
@@ -29,13 +29,13 @@ import java.util.Set;
import javax.naming.directory.SearchControls;
-import org.apache.directory.api.ldap.model.exception.LdapContextNotEmptyException;
import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
import org.apache.directory.api.ldap.model.message.Control;
import org.apache.directory.api.ldap.model.name.Dn;
import org.apache.directory.studio.common.core.jobs.StudioProgressMonitor;
import org.apache.directory.studio.connection.core.Connection;
import org.apache.directory.studio.connection.core.Controls;
+import org.apache.directory.studio.connection.core.io.StudioLdapException;
import org.apache.directory.studio.connection.core.jobs.StudioConnectionBulkRunnableWithProgress;
import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
import org.apache.directory.studio.ldapbrowser.core.events.BulkModificationEvent;
@@ -181,7 +181,7 @@ public class MoveEntriesRunnable implements StudioConnectionBulkRunnableWithProg
// do a simulated rename, if renaming of a non-leaf entry is not supported.
if ( dummyMonitor.errorsReported() )
{
- if ( dialog != null && dummyMonitor.getException() instanceof LdapContextNotEmptyException )
+ if ( dialog != null && StudioLdapException.isContextNotEmptyException( dummyMonitor.getException() ) )
{
// open dialog
if ( numAdd == 0 )
diff --git a/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/RenameEntryRunnable.java b/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/RenameEntryRunnable.java
index 7b718e5ee..f6c3bc691 100644
--- a/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/RenameEntryRunnable.java
+++ b/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/RenameEntryRunnable.java
@@ -28,7 +28,6 @@ import java.util.Set;
import javax.naming.directory.SearchControls;
-import org.apache.directory.api.ldap.model.exception.LdapContextNotEmptyException;
import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
import org.apache.directory.api.ldap.model.message.Control;
import org.apache.directory.api.ldap.model.name.Dn;
@@ -36,6 +35,7 @@ import org.apache.directory.api.ldap.model.name.Rdn;
import org.apache.directory.studio.common.core.jobs.StudioProgressMonitor;
import org.apache.directory.studio.connection.core.Connection;
import org.apache.directory.studio.connection.core.Controls;
+import org.apache.directory.studio.connection.core.io.StudioLdapException;
import org.apache.directory.studio.connection.core.jobs.StudioConnectionBulkRunnableWithProgress;
import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
import org.apache.directory.studio.ldapbrowser.core.events.EntryRenamedEvent;
@@ -166,7 +166,7 @@ public class RenameEntryRunnable implements StudioConnectionBulkRunnableWithProg
// do a simulated rename, if renaming of a non-leaf entry is not supported.
if ( dummyMonitor.errorsReported() && !monitor.isCanceled() )
{
- if ( dialog != null && dummyMonitor.getException() instanceof LdapContextNotEmptyException )
+ if ( dialog != null && StudioLdapException.isContextNotEmptyException( dummyMonitor.getException() ) )
{
// open dialog
dialog.setEntryInfo( browserConnection, oldDn, newDn );
diff --git a/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/PasswordModifyExtendedOperationAction.java b/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/PasswordModifyExtendedOperationAction.java
index 4a9bc0bce..1d31660fb 100644
--- a/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/PasswordModifyExtendedOperationAction.java
+++ b/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/PasswordModifyExtendedOperationAction.java
@@ -123,6 +123,7 @@ public class PasswordModifyExtendedOperationAction extends BrowserAction
public boolean isEnabled()
{
return getConnectionAndEntry() != null
+ && getConnectionAndEntry().connection != null
&& getConnectionAndEntry().connection.getRootDSE()
.isExtensionSupported( PasswordModifyRequest.EXTENSION_OID );
}