You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2007/10/22 00:18:47 UTC

svn commit: r586962 - in /directory/studio/trunk: studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/ studio-ldapbrowser-core/src/ma...

Author: seelmann
Date: Sun Oct 21 15:18:39 2007
New Revision: 586962

URL: http://svn.apache.org/viewvc?rev=586962&view=rev
Log:
DIRSTUDIO-123: Fixed modification logging

Added:
    directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/IModificationLogger.java   (with props)
Modified:
    directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JNDIConnectionWrapper.java
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/BrowserConnection.java
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/ModificationLogger.java
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteAttributesValueJob.java

Added: directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/IModificationLogger.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/IModificationLogger.java?rev=586962&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/IModificationLogger.java (added)
+++ directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/IModificationLogger.java Sun Oct 21 15:18:39 2007
@@ -0,0 +1,62 @@
+package org.apache.directory.studio.connection.core;
+
+
+import javax.naming.NamingException;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.ModificationItem;
+import javax.naming.ldap.Control;
+
+
+/**
+ * Callback interface to log modifications
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface IModificationLogger
+{
+
+    /**
+     * Logs a changetype:add.
+     * 
+     * @param dn the dn
+     * @param attributes the attributes
+     * @param controls the controls
+     * @param ex the naming exception if an error occurred, null otherwise
+     */
+    public void logChangetypeAdd( final String dn, final Attributes attributes, final Control[] controls, NamingException ex );
+
+
+    /**
+     * Logs a changetype:delete.
+     * 
+     * @param dn the dn
+     * @param controls the controls
+     * @param ex the naming exception if an error occurred, null otherwise
+     */
+    public void logChangetypeDelete( final String dn, final Control[] controls, NamingException ex );
+
+
+    /**
+     * Logs a changetype:modify.
+     * 
+     * @param dn the dn
+     * @param modificationItems the modification items
+     * @param controls the controls
+     * @param ex the naming exception if an error occurred, null otherwise
+     */
+    public void logChangetypeModify( final String dn, final ModificationItem[] modificationItems, final Control[] controls, NamingException ex );
+
+
+    /**
+     * Logs a changetype:moddn.
+     * 
+     * @param oldDn the old dn
+     * @param newDn the new dn
+     * @param deleteOldRdn the delete old rdn
+     * @param controls the controls
+     * @param ex the naming exception if an error occurred, null otherwise
+     */
+    public void logChangetypeModDn( final String oldDn, final String newDn, final boolean deleteOldRdn, final Control[] controls, NamingException ex );
+
+}

Propchange: directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/IModificationLogger.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JNDIConnectionWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JNDIConnectionWrapper.java?rev=586962&r1=586961&r2=586962&view=diff
==============================================================================
--- directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JNDIConnectionWrapper.java (original)
+++ directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JNDIConnectionWrapper.java Sun Oct 21 15:18:39 2007
@@ -44,10 +44,11 @@
 import org.apache.directory.studio.connection.core.Connection;
 import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
 import org.apache.directory.studio.connection.core.ConnectionParameter;
-import org.apache.directory.studio.connection.core.StudioProgressMonitor;
 import org.apache.directory.studio.connection.core.IAuthHandler;
 import org.apache.directory.studio.connection.core.ICredentials;
+import org.apache.directory.studio.connection.core.IModificationLogger;
 import org.apache.directory.studio.connection.core.Messages;
+import org.apache.directory.studio.connection.core.StudioProgressMonitor;
 import org.apache.directory.studio.connection.core.io.ConnectionWrapper;
 
 
@@ -76,7 +77,7 @@
     private String bindPrincipal;
 
     private String bindCredentials;
-    
+
     private String saslRealm;
 
     private Hashtable<String, String> environment;
@@ -87,6 +88,8 @@
 
     private Thread jobThread;
 
+    private IModificationLogger modificationLogger;
+
 
     /**
      * Creates a new instance of JNDIConnectionContext.
@@ -196,9 +199,9 @@
      * 
      * @return the naming enumeration or null if an exception occurs.
      */
-    public NamingEnumeration<SearchResult> search( final String searchBase, final String filter, final SearchControls searchControls,
-        final String derefAliasMethod, final String handleReferralsMethod, final Control[] controls,
-        final StudioProgressMonitor monitor )
+    public NamingEnumeration<SearchResult> search( final String searchBase, final String filter,
+        final SearchControls searchControls, final String derefAliasMethod, final String handleReferralsMethod,
+        final Control[] controls, final StudioProgressMonitor monitor )
     {
         // start
         InnerRunnable runnable = new InnerRunnable()
@@ -315,6 +318,11 @@
                 {
                     namingException = ne;
                 }
+
+                if ( modificationLogger != null )
+                {
+                    modificationLogger.logChangetypeModify( dn, modificationItems, controls, namingException );
+                }
             }
 
 
@@ -391,6 +399,11 @@
                 {
                     namingException = ne;
                 }
+
+                if ( modificationLogger != null )
+                {
+                    modificationLogger.logChangetypeModDn( oldDn, newDn, deleteOldRdn, controls, namingException );
+                }
             }
 
 
@@ -446,16 +459,23 @@
 
             public void run()
             {
+
                 try
                 {
                     LdapContext modCtx = context.newInstance( controls );
                     modCtx.addToEnvironment( Context.REFERRAL, "throw" ); //$NON-NLS-1$
+
                     modCtx.createSubcontext( new LdapName( dn ), attributes );
                 }
                 catch ( NamingException ne )
                 {
                     namingException = ne;
                 }
+
+                if ( modificationLogger != null )
+                {
+                    modificationLogger.logChangetypeAdd( dn, attributes, controls, namingException );
+                }
             }
 
 
@@ -520,6 +540,11 @@
                 {
                     namingException = ne;
                 }
+
+                if ( modificationLogger != null )
+                {
+                    modificationLogger.logChangetypeDelete( dn, controls, namingException );
+                }
             }
 
 
@@ -565,14 +590,14 @@
         // setup connection parameters
         String host = connection.getConnectionParameter().getHost();
         int port = connection.getConnectionParameter().getPort();
-        
+
         useLdaps = connection.getConnectionParameter().getEncryptionMethod() == ConnectionParameter.EncryptionMethod.LDAPS;
         useStartTLS = connection.getConnectionParameter().getEncryptionMethod() == ConnectionParameter.EncryptionMethod.START_TLS;
-        
+
         environment = new Hashtable<String, String>();
         environment.put( Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory" ); //$NON-NLS-1$
         environment.put( "java.naming.ldap.version", "3" ); //$NON-NLS-1$ //$NON-NLS-2$
-        
+
         // timeouts
         if ( !useLdaps )
         {
@@ -580,7 +605,7 @@
         }
         environment.put( "com.sun.jndi.dns.timeout.initial", "2000" ); //$NON-NLS-1$ //$NON-NLS-2$
         environment.put( "com.sun.jndi.dns.timeout.retries", "3" ); //$NON-NLS-1$ //$NON-NLS-2$
-        
+
         // ldaps://
         if ( useLdaps )
         {
@@ -592,7 +617,7 @@
         {
             environment.put( Context.PROVIDER_URL, "ldap://" + host + ":" + port ); //$NON-NLS-1$ //$NON-NLS-2$
         }
-        
+
         InnerRunnable runnable = new InnerRunnable()
         {
             private NamingException namingException = null;
@@ -708,7 +733,7 @@
             }
             bindPrincipal = credentials.getBindPrincipal();
             bindCredentials = credentials.getBindPassword();
-            
+
             InnerRunnable runnable = new InnerRunnable()
             {
                 private NamingException namingException = null;
@@ -905,6 +930,17 @@
          * Reset.
          */
         void reset();
+    }
+
+
+    /**
+     * Sets the modification logger.
+     * 
+     * @param modificationLogger the new modification logger
+     */
+    public void setModificationLogger( IModificationLogger modificationLogger )
+    {
+        this.modificationLogger = modificationLogger;
     }
 
 }

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/BrowserConnection.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/BrowserConnection.java?rev=586962&r1=586961&r2=586962&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/BrowserConnection.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/BrowserConnection.java Sun Oct 21 15:18:39 2007
@@ -113,7 +113,9 @@
         this.schema = Schema.DEFAULT_SCHEMA;
         this.rootDSE = new RootDSE( this );
         cacheEntry( this.rootDSE );
-        
+
+        this.connection.getJNDIConnectionWrapper().setModificationLogger( this.modificationLogger );
+
         ConnectionEventRegistry.addConnectionUpdateListener( this, ConnectionCorePlugin.getDefault().getEventRunner() );
     }
     

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/ModificationLogger.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/ModificationLogger.java?rev=586962&r1=586961&r2=586962&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/ModificationLogger.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/ModificationLogger.java Sun Oct 21 15:18:39 2007
@@ -24,6 +24,9 @@
 import java.io.File;
 import java.io.IOException;
 import java.lang.reflect.Field;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.logging.FileHandler;
 import java.util.logging.Formatter;
 import java.util.logging.Handler;
@@ -31,25 +34,71 @@
 import java.util.logging.LogRecord;
 import java.util.logging.Logger;
 
-import org.apache.directory.studio.ldapbrowser.core.BrowserConnectionManager;
-
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
+import javax.naming.ldap.Control;
 
-public class ModificationLogger
+import org.apache.directory.studio.connection.core.IModificationLogger;
+import org.apache.directory.studio.ldapbrowser.core.BrowserConnectionManager;
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
+import org.apache.directory.studio.ldapbrowser.core.model.DN;
+import org.apache.directory.studio.ldapbrowser.core.model.NameException;
+import org.apache.directory.studio.ldapbrowser.core.model.RDN;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.container.LdifChangeAddRecord;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.container.LdifChangeDeleteRecord;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.container.LdifChangeModDnRecord;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.container.LdifChangeModifyRecord;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.container.LdifModSpec;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.lines.LdifAttrValLine;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.lines.LdifCommentLine;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.lines.LdifDeloldrdnLine;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.lines.LdifModSpecSepLine;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.lines.LdifNewrdnLine;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.lines.LdifNewsuperiorLine;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.lines.LdifSepLine;
+
+
+/**
+ * The ModificationLogger is used to log modifications into a file.
+ *
+ * TODO: LDIF of DSML logging
+ * TODO: switch off logging
+ * TODO: log controls
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ModificationLogger implements IModificationLogger
 {
 
+    /** The browser connection. */
     private BrowserConnection browserConnection;
 
+    /** The file handler. */
     private FileHandler fileHandler;
 
+    /** The logger. */
     private Logger logger;
 
 
-    public ModificationLogger( BrowserConnection connection )
+    /**
+     * Creates a new instance of ModificationLogger.
+     * 
+     * @param browserConnection the browser connection
+     */
+    public ModificationLogger( BrowserConnection browserConnection )
     {
-        this.browserConnection = connection;
+        this.browserConnection = browserConnection;
     }
 
 
+    /**
+     * Inits the modification logger.
+     */
     private void initModificationLogger()
     {
         this.logger = Logger.getAnonymousLogger();
@@ -79,6 +128,9 @@
     }
 
 
+    /**
+     * Disposes the modification logger.
+     */
     public void dispose()
     {
         if ( this.logger != null )
@@ -94,23 +146,201 @@
     }
 
 
-    public void log( String s )
+    /**
+     * Logs the given text.
+     * 
+     * @param text the text to log
+     * @param ex the naming exception if an error occurred, null otherwise
+     */
+    private void log( String text, NamingException ex )
     {
-        if ( this.logger == null )
+        if ( logger == null )
         {
             if ( browserConnection.getConnection().getName() != null )
             {
-                this.initModificationLogger();
+                initModificationLogger();
             }
         }
 
-        if ( this.logger != null )
+        if ( logger != null )
+        {
+            DateFormat df = new SimpleDateFormat( BrowserCoreConstants.DATEFORMAT );
+
+            if ( ex != null )
+            {
+                logger.log( Level.ALL, LdifCommentLine.create( "#!RESULT ERROR" ).toFormattedString() ); //$NON-NLS-1$
+            }
+            else
+            {
+                logger.log( Level.ALL, LdifCommentLine.create( "#!RESULT OK" ).toFormattedString() ); //$NON-NLS-1$
+            }
+
+            logger
+                .log(
+                    Level.ALL,
+                    LdifCommentLine
+                        .create(
+                            "#!CONNECTION ldap://" + browserConnection.getConnection().getHost() + ":" + browserConnection.getConnection().getPort() ).toFormattedString() ); //$NON-NLS-1$ //$NON-NLS-2$
+            logger.log( Level.ALL, LdifCommentLine.create( "#!DATE " + df.format( new Date() ) ).toFormattedString() ); //$NON-NLS-1$
+
+            if ( ex != null )
+            {
+                String errorComment = "#!ERROR " + ex.getMessage(); //$NON-NLS-1$
+                errorComment = errorComment.replaceAll( "\r", " " ); //$NON-NLS-1$ //$NON-NLS-2$
+                errorComment = errorComment.replaceAll( "\n", " " ); //$NON-NLS-1$ //$NON-NLS-2$
+                LdifCommentLine errorCommentLine = LdifCommentLine.create( errorComment );
+                logger.log( Level.ALL, errorCommentLine.toFormattedString() );
+            }
+
+            logger.log( Level.ALL, text );
+        }
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.IModificationLogger#logChangetypeAdd(java.lang.String, javax.naming.directory.Attributes, javax.naming.ldap.Control[], javax.naming.NamingException)
+     */
+    public void logChangetypeAdd( final String dn, final Attributes attributes, final Control[] controls,
+        NamingException ex )
+    {
+        try
+        {
+            LdifChangeAddRecord record = LdifChangeAddRecord.create( dn );
+            //record.addControl( controlLine );
+            NamingEnumeration<? extends Attribute> attributeEnumeration = attributes.getAll();
+            while ( attributeEnumeration.hasMore() )
+            {
+                Attribute attribute = attributeEnumeration.next();
+                String attributeName = attribute.getID();
+                NamingEnumeration<?> valueEnumeration = attribute.getAll();
+                while ( valueEnumeration.hasMore() )
+                {
+                    Object o = valueEnumeration.next();
+                    if ( o instanceof String )
+                    {
+                        record.addAttrVal( LdifAttrValLine.create( attributeName, ( String ) o ) );
+                    }
+                    if ( o instanceof byte[] )
+                    {
+                        record.addAttrVal( LdifAttrValLine.create( attributeName, ( byte[] ) o ) );
+                    }
+                }
+            }
+            record.finish( LdifSepLine.create() );
+
+            String formattedString = record.toFormattedString();
+            log( formattedString, ex );
+        }
+        catch ( NamingException e )
+        {
+        }
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.IModificationLogger#logChangetypeDelete(java.lang.String, javax.naming.ldap.Control[], javax.naming.NamingException)
+     */
+    public void logChangetypeDelete( final String dn, final Control[] controls, NamingException ex )
+    {
+        LdifChangeDeleteRecord record = LdifChangeDeleteRecord.create( dn );
+        //record.addControl( controlLine );
+        record.finish( LdifSepLine.create() );
+
+        String formattedString = record.toFormattedString();
+        log( formattedString, ex );
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.IModificationLogger#logChangetypeModify(java.lang.String, javax.naming.directory.ModificationItem[], javax.naming.ldap.Control[], javax.naming.NamingException)
+     */
+    public void logChangetypeModify( final String dn, final ModificationItem[] modificationItems,
+        final Control[] controls, NamingException ex )
+    {
+        try
+        {
+            LdifChangeModifyRecord record = LdifChangeModifyRecord.create( dn );
+            //record.addControl( controlLine );
+            for ( ModificationItem item : modificationItems )
+            {
+                Attribute attribute = item.getAttribute();
+                String attributeDescription = attribute.getID();
+                LdifModSpec modSpec;
+                switch ( item.getModificationOp() )
+                {
+                    case DirContext.ADD_ATTRIBUTE:
+                        modSpec = LdifModSpec.createAdd( attributeDescription );
+                        break;
+                    case DirContext.REMOVE_ATTRIBUTE:
+                        modSpec = LdifModSpec.createDelete( attributeDescription );
+                        break;
+                    case DirContext.REPLACE_ATTRIBUTE:
+                        modSpec = LdifModSpec.createReplace( attributeDescription );
+                        break;
+                    default:
+                        continue;
+                }
+                NamingEnumeration<?> valueEnumeration = attribute.getAll();
+                while ( valueEnumeration.hasMore() )
+                {
+                    Object o = valueEnumeration.next();
+                    if ( o instanceof String )
+                    {
+                        modSpec.addAttrVal( LdifAttrValLine.create( attributeDescription, ( String ) o ) );
+                    }
+                    if ( o instanceof byte[] )
+                    {
+                        modSpec.addAttrVal( LdifAttrValLine.create( attributeDescription, ( byte[] ) o ) );
+                    }
+                }
+                modSpec.finish( LdifModSpecSepLine.create() );
+
+                record.addModSpec( modSpec );
+            }
+            record.finish( LdifSepLine.create() );
+
+            String formattedString = record.toFormattedString();
+            log( formattedString, ex );
+        }
+        catch ( NamingException e )
+        {
+        }
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.IModificationLogger#logChangetypeModDn(java.lang.String, java.lang.String, boolean, javax.naming.ldap.Control[], javax.naming.NamingException)
+     */
+    public void logChangetypeModDn( final String oldDn, final String newDn, final boolean deleteOldRdn,
+        final Control[] controls, NamingException ex )
+    {
+        try
+        {
+            DN dn = new DN( newDn );
+            RDN newrdn = dn.getRdn();
+            DN newsuperior = dn.getParentDn();
+
+            LdifChangeModDnRecord record = LdifChangeModDnRecord.create( oldDn );
+            //record.addControl( controlLine );
+            record.setNewrdn( LdifNewrdnLine.create( newrdn.toString() ) );
+            record.setDeloldrdn( deleteOldRdn ? LdifDeloldrdnLine.create1() : LdifDeloldrdnLine.create0() );
+            record.setNewsuperior( LdifNewsuperiorLine.create( newsuperior.toString() ) );
+            record.finish( LdifSepLine.create() );
+
+            String formattedString = record.toFormattedString();
+            log( formattedString, ex );
+        }
+        catch ( NameException e )
         {
-            this.logger.log( Level.ALL, s );
         }
     }
 
 
+    /**
+     * Gets the files.
+     * 
+     * @return the files
+     */
     public File[] getFiles()
     {
         if ( this.logger == null )
@@ -132,6 +362,15 @@
     }
 
 
+    /**
+     * Gets the log files.
+     * 
+     * @param fileHandler the file handler
+     * 
+     * @return the log files
+     * 
+     * @throws Exception the exception
+     */
     private static File[] getLogFiles( FileHandler fileHandler ) throws Exception
     {
         Field field = getFieldFromClass( "java.util.logging.FileHandler", "files" ); //$NON-NLS-1$ //$NON-NLS-2$
@@ -141,9 +380,19 @@
     }
 
 
+    /**
+     * Gets the field from class.
+     * 
+     * @param className the class name
+     * @param fieldName the field name
+     * 
+     * @return the field from class
+     * 
+     * @throws Exception the exception
+     */
     private static Field getFieldFromClass( String className, String fieldName ) throws Exception
     {
-        Class clazz = Class.forName( className );
+        Class<?> clazz = Class.forName( className );
         Field[] fields = clazz.getDeclaredFields();
 
         for ( int i = 0; i < fields.length; i++ )

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteAttributesValueJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteAttributesValueJob.java?rev=586962&r1=586961&r2=586962&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteAttributesValueJob.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteAttributesValueJob.java Sun Oct 21 15:18:39 2007
@@ -185,7 +185,7 @@
             event = new ValueDeletedEvent( entry.getBrowserConnection(), entry, deletedValues[0].getAttribute(),
                 deletedValues[0] );
         }
-        if ( deletedAttributes != null && deletedAttributes.length > 0 )
+        else if ( deletedAttributes != null && deletedAttributes.length > 0 )
         {
             event = new AttributeDeletedEvent( entry.getBrowserConnection(), entry, deletedAttributes[0] );
         }