while ( ! ancestorDn.equals( suffix ) && null != ancestorId )
while ( ! ancestorDn.equals( upSuffix ) && null != ancestorId )
    private void addAliasIndices( BigInteger aliasId, Name aliasDn,         String aliasTarget ) throws NamingException    {        Name targetDn = null;            // Name value of aliasedObjectName        BigInteger targetId = null;      // Id of the aliasedObjectName        Normalizer normalizer = null;    // Temporary handle for Dn's        Name ancestorDn = null;          // Name of an alias entry relative        BigInteger ancestorId = null;    // Id of an alias entry relative        // Access aliasedObjectName, normalize it and generate the Name         normalizer = oneAliasIdx.getAttribute().getEquality().getNormalizer();        targetDn = new LdapName( ( String ) normalizer.normalize( aliasTarget ) );                   /*         * Check For Cycles         *          * Before wasting time to lookup more values we check using the target         * dn to see if we have the possible formation of an alias cycle.  This         * happens when the alias refers back to a target that is also a          * relative of the alias entry.  For detection we test if the aliased         * entry Dn starts with the target Dn.  If it does then we know the          * aliased target is a relative and we have a perspecitive cycle.         */         if ( aliasDn.startsWith( targetDn ) )        {            if ( aliasDn.equals( targetDn ) )            {                throw new NamingException( "[36] aliasDereferencingProblem - "                     + "attempt to create alias to itself." );            }                        throw new NamingException( "[36] aliasDereferencingProblem - "                 + "attempt to create alias with cycle to relative "                 + aliasTarget + " not allowed from descendent alias "                 + aliasDn );        }                    /*         * Check For Aliases External To Naming Context         *          * id may be null but the alias may be to a valid entry in          * another namingContext.  Such aliases are not allowed and we         * need to point it out to the user instead of saying the target         * does not exist when it potentially could outside of this suffix.         */        if ( ! targetDn.startsWith( suffix ) )        {            // Complain specifically about aliases to outside naming contexts            throw new NamingException( "[36] aliasDereferencingProblem -"                + " the alias points to an entry outside of the " + suffix                + " namingContext to an object whose existance cannot be"                + " determined." );        }        // L O O K U P   T A R G E T   I D        targetId = ndnIdx.forwardLookup( targetDn.toString() );        /*         * Check For Target Existance         *          * We do not allow the creation of inconsistant aliases.  Aliases should         * not be broken links.  If the target does not exist we start screaming         */        if ( null == targetId )        {            // Complain about target not existing            throw new NamingException( "[33] aliasProblem - "                 + "the alias when dereferenced would not name a known object "                + "the aliasedObjectName must be set to a valid existing "                + "entry." );        }                /*         * Detect Direct Alias Chain Creation         *          * Rather than resusitate the target to test if it is an alias and fail         * due to chaing creation we use the alias index to determine if the         * target is an alias.  Hence if the alias we are about to create points         * to another alias as its target in the aliasedObjectName attribute,          * then we have a situation where an alias chain is being created.           * Alias chaining is not allowed so we throw and exception.          */        if ( null != aliasIdx.reverseLookup( targetId ) )        {            // Complain about illegal alias chain            throw new NamingException( "[36] aliasDereferencingProblem -"                 + " the alias points to another alias.  Alias chaining is"                 + " not supported by this backend." );        }                // Add the alias to the simple alias index        aliasIdx.add( aliasTarget, aliasId );                /*         * Handle One Level Scope Alias Index         *          * The first relative is special with respect to the one level alias         * index.  If the target is not a sibling of the alias then we add the         * index entry maping the parent's id to the aliased target id.         */        ancestorDn = aliasDn.getSuffix( 1 );        ancestorId = getEntryId( ancestorDn.toString() );                if ( ! NamespaceTools.isSibling( targetDn, aliasDn ) )        {            oneAliasIdx.add( ancestorId, targetId );        }        /*         * Handle Sub Level Scope Alias Index         *          * Walk the list of relatives from the parents up to the suffix, testing         * to see if the alias' target is a descendant of the relative.  If the         * alias target is not a descentant of the relative it extends the scope         * and is added to the sub tree scope alias index.  The suffix node is         * ignored since everything is under its scope.  The first loop          * iteration shall handle the parents.         */        while ( ! ancestorDn.equals( suffix ) && null != ancestorId )        {            if ( ! NamespaceTools.isDescendant( ancestorDn, targetDn ) )            {                subAliasIdx.add( ancestorId, targetId );            }                        ancestorDn = ancestorDn.getSuffix( 1 );            ancestorId = getEntryId( ancestorDn.toString() );        }            }