Return-Path: Delivered-To: apmail-directory-dev-archive@www.apache.org Received: (qmail 75897 invoked from network); 15 Jun 2010 16:14:38 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 15 Jun 2010 16:14:38 -0000 Received: (qmail 45607 invoked by uid 500); 15 Jun 2010 16:14:38 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 45499 invoked by uid 500); 15 Jun 2010 16:14:37 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 45484 invoked by uid 99); 15 Jun 2010 16:14:36 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Jun 2010 16:14:36 +0000 X-ASF-Spam-Status: No, hits=0.7 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.214.178] (HELO mail-iw0-f178.google.com) (209.85.214.178) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Jun 2010 16:14:30 +0000 Received: by iwn40 with SMTP id 40so6809739iwn.37 for ; Tue, 15 Jun 2010 09:14:08 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.170.3 with SMTP id b3mr8528879ibz.122.1276618448541; Tue, 15 Jun 2010 09:14:08 -0700 (PDT) Sender: mail@stefan-seelmann.de Received: by 10.231.168.207 with HTTP; Tue, 15 Jun 2010 09:14:08 -0700 (PDT) In-Reply-To: <20100615155846.D2CEA23889B3@eris.apache.org> References: <20100615155846.D2CEA23889B3@eris.apache.org> Date: Tue, 15 Jun 2010 18:14:08 +0200 X-Google-Sender-Auth: QvbREQa_XE-e2tsQw6RkkeXR1V8 Message-ID: Subject: Re: svn commit: r954942 - in /directory/apacheds/trunk: core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java From: Stefan Seelmann To: dev@directory.apache.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I also wondered how to deal with those duplicate checks. On one side it would be nice to do the checks in the interceptor chain because then the checks don't need to be implemented for each backend. However I think it is right that each backend does these checks because the backend must protect itself and should not accept invalid data. Kind Regards, Stefan On Tue, Jun 15, 2010 at 5:58 PM, wrote: > Author: elecharny > Date: Tue Jun 15 15:58:46 2010 > New Revision: 954942 > > URL: http://svn.apache.org/viewvc?rev=3D954942&view=3Drev > Log: > Removed the checks for existence in the Exception interceptor, as those c= hecks are already done in the backend. > > Modified: > =C2=A0 =C2=A0directory/apacheds/trunk/core/src/main/java/org/apache/direc= tory/server/core/exception/ExceptionInterceptor.java > =C2=A0 =C2=A0directory/apacheds/trunk/xdbm-partition/src/main/java/org/ap= ache/directory/server/xdbm/AbstractStore.java > > Modified: directory/apacheds/trunk/core/src/main/java/org/apache/director= y/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?r= ev=3D954942&r1=3D954941&r2=3D954942&view=3Ddiff > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- directory/apacheds/trunk/core/src/main/java/org/apache/directory/serv= er/core/exception/ExceptionInterceptor.java (original) > +++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/serv= er/core/exception/ExceptionInterceptor.java Tue Jun 15 15:58:46 2010 > @@ -409,34 +409,14 @@ public class ExceptionInterceptor extend > =C2=A0 =C2=A0 =C2=A0 =C2=A0 throws LdapException > =C2=A0 =C2=A0 { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 DN oldDn =3D moveAndRenameContext.getDn(); > - =C2=A0 =C2=A0 =C2=A0 =C2=A0DN newSuperiorDn =3D moveAndRenameContext.ge= tNewSuperiorDn(); > > + =C2=A0 =C2=A0 =C2=A0 =C2=A0// Don't allow M&R in the SSSE > =C2=A0 =C2=A0 =C2=A0 =C2=A0 if ( oldDn.equals( subschemSubentryDn ) ) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 throw new LdapUnwillingToPerfor= mException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_258, > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 subschemSubentryD= n, subschemSubentryDn ) ); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 } > > - =C2=A0 =C2=A0 =C2=A0 =C2=A0// check if child to move exists > - =C2=A0 =C2=A0 =C2=A0 =C2=A0String msg =3D "Attempt to move to non-exist= ant parent: "; > - =C2=A0 =C2=A0 =C2=A0 =C2=A0assertHasEntry( moveAndRenameContext, msg, o= ldDn ); > - > - =C2=A0 =C2=A0 =C2=A0 =C2=A0// check if parent to move to exists > - =C2=A0 =C2=A0 =C2=A0 =C2=A0msg =3D "Attempt to move to non-existant par= ent: "; > - =C2=A0 =C2=A0 =C2=A0 =C2=A0assertHasEntry( moveAndRenameContext, msg, n= ewSuperiorDn ); > - > - =C2=A0 =C2=A0 =C2=A0 =C2=A0// check to see if target entry exists > - =C2=A0 =C2=A0 =C2=A0 =C2=A0DN newDn =3D moveAndRenameContext.getNewDn()= ; > - > - =C2=A0 =C2=A0 =C2=A0 =C2=A0if ( nextInterceptor.hasEntry( new EntryOper= ationContext( moveAndRenameContext.getSession(), newDn ) ) ) > - =C2=A0 =C2=A0 =C2=A0 =C2=A0{ > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0// we must calculate the resol= ved name using the user provided Rdn value > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0LdapEntryAlreadyExistsExceptio= n e; > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0e =3D new LdapEntryAlreadyExis= tsException( I18n.err( I18n.ERR_250_ENTRY_ALREADY_EXISTS, newDn ) ); > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0//e.setResolvedName( new DN( u= pTarget.getName() ) ); > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0throw e; > - =C2=A0 =C2=A0 =C2=A0 =C2=A0} > - > =C2=A0 =C2=A0 =C2=A0 =C2=A0 // Remove the original entry from the NotAlia= s cache, if needed > =C2=A0 =C2=A0 =C2=A0 =C2=A0 synchronized ( notAliasCache ) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 { > > Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apach= e/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=3D95= 4942&r1=3D954941&r2=3D954942&view=3Ddiff > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/dire= ctory/server/xdbm/AbstractStore.java (original) > +++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/dire= ctory/server/xdbm/AbstractStore.java Tue Jun 15 15:58:46 2010 > @@ -1203,8 +1203,7 @@ public abstract class AbstractStore =C2=A0 =C2=A0 =C2=A0*/ > =C2=A0 =C2=A0 public synchronized void moveAndRename( DN oldDn, DN newSup= eriorDn, RDN newRdn, Entry modifiedEntry, boolean deleteOldRdn ) throws Exc= eption > =C2=A0 =C2=A0 { > - =C2=A0 =C2=A0 =C2=A0 // Check that the old entry exists, that the new s= uperior exists and > - =C2=A0 =C2=A0 =C2=A0 // that the new DN does not exist > + =C2=A0 =C2=A0 =C2=A0 // Check that the old entry exists > =C2=A0 =C2=A0 =C2=A0 =C2=A0 ID oldId =3D getEntryId( oldDn ); > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 if ( oldId =3D=3D null ) > @@ -1215,6 +1214,7 @@ public abstract class AbstractStore =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 throw nse; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 } > > + =C2=A0 =C2=A0 =C2=A0 =C2=A0// Check that the new superior exist > =C2=A0 =C2=A0 =C2=A0 =C2=A0 ID newSuperiorId =3D getEntryId( newSuperiorD= n ); > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 if ( newSuperiorId =3D=3D null ) > > >