You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2011/07/06 11:00:22 UTC
svn commit: r1143299 - in /directory/apacheds/trunk:
core/src/main/java/org/apache/directory/server/core/exception/
xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/
xdbm-partition/src/main/java/org/apache/directory/ser...
Author: elecharny
Date: Wed Jul 6 09:00:22 2011
New Revision: 1143299
URL: http://svn.apache.org/viewvc?rev=1143299&view=rev
Log:
o Check that the entry does not exist in the store, not in the ExceptionInterceptor.
o Correctly propagate the exception
Modified:
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/AbstractXdbmPartition.java
directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java?rev=1143299&r1=1143298&r2=1143299&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java Wed Jul 6 09:00:22 2011
@@ -121,19 +121,11 @@ public class ExceptionInterceptor extend
{
Dn name = addContext.getDn();
- if ( subschemSubentryDn.getNormName().equals( name.getNormName() ) )
+ if ( subschemSubentryDn.equals( name ) )
{
throw new LdapEntryAlreadyExistsException( I18n.err( I18n.ERR_249 ) );
}
- // check if the entry already exists
- if ( nextInterceptor.hasEntry( new EntryOperationContext( addContext.getSession(), name ) ) )
- {
- LdapEntryAlreadyExistsException ne = new LdapEntryAlreadyExistsException(
- I18n.err( I18n.ERR_250_ENTRY_ALREADY_EXISTS, name.getName() ) );
- throw ne;
- }
-
Dn suffix = nexus.findSuffix( name );
// we're adding the suffix entry so just ignore stuff to mess with the parent
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/AbstractXdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/AbstractXdbmPartition.java?rev=1143299&r1=1143298&r2=1143299&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/AbstractXdbmPartition.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/AbstractXdbmPartition.java Wed Jul 6 09:00:22 2011
@@ -268,6 +268,10 @@ public abstract class AbstractXdbmPartit
{
store.add( ( Entry ) ( ( ClonedServerEntry ) addContext.getEntry() ).getClonedEntry() );
}
+ catch ( LdapException le )
+ {
+ throw le;
+ }
catch ( Exception e )
{
throw new LdapException( e );
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java?rev=1143299&r1=1143298&r2=1143299&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java Wed Jul 6 09:00:22 2011
@@ -847,6 +847,10 @@ public abstract class AbstractStore<E, I
/**
* {@inheritDoc}
+ *
+ * Adding an entryinvolve may steps :
+ * - fist we must check if the entry exists or not (note that it should probably
+ * be checked higher, but not sure)
* TODO : We should be able to revert all the changes made to index
* if something went wrong. Also the index should auto-repair : if
* an entry does not exist in the Master table, then the index must be updated to reflect this.
@@ -856,15 +860,12 @@ public abstract class AbstractStore<E, I
{
Dn entryDn = entry.getDn();
- if ( checkHasEntryDuringAdd )
+ // check if the entry already exists
+ if ( getEntryId( entryDn ) != null )
{
- // check if the entry already exists
- if ( getEntryId( entryDn ) != null )
- {
- LdapEntryAlreadyExistsException ne = new LdapEntryAlreadyExistsException(
- I18n.err( I18n.ERR_250_ENTRY_ALREADY_EXISTS, entryDn.getName() ) );
- throw ne;
- }
+ LdapEntryAlreadyExistsException ne = new LdapEntryAlreadyExistsException(
+ I18n.err( I18n.ERR_250_ENTRY_ALREADY_EXISTS, entryDn.getName() ) );
+ throw ne;
}
ID parentId;