public void destroySubcontext(String name) throws EntityHasDescendantsException, EntityNotFoundException, WIMSystemException {
        TimedDirContext ctx = getDirContext();
        // checkWritePermission(ctx); // TODO Why are we not checking permissions here?
        try {
            try {
                ctx.destroySubcontext(new LdapName(name));
            } catch (NamingException e) {
                if (!isConnectionException(e)) {
                    throw e;
                }
                ctx = reCreateDirContext(ctx, e.toString());
                ctx.destroySubcontext(new LdapName(name));
            }
        } catch (ContextNotEmptyException e) {
            String msg = Tr.formatMessage(tc, WIMMessageKey.ENTITY_HAS_DESCENDENTS, WIMMessageHelper.generateMsgParms(name));
            throw new EntityHasDescendantsException(WIMMessageKey.ENTITY_HAS_DESCENDENTS, msg, e);
        } catch (NameNotFoundException e) {
            String msg = Tr.formatMessage(tc, WIMMessageKey.LDAP_ENTRY_NOT_FOUND, WIMMessageHelper.generateMsgParms(name, e.toString(true)));
            throw new EntityNotFoundException(WIMMessageKey.LDAP_ENTRY_NOT_FOUND, msg, e);
        } catch (NamingException e) {
            String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)));
            throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, msg, e);
        } finally {
            releaseDirContext(ctx);
        }
    }
public void destroySubcontext ( String name ) throws EntityHasDescendantsException , EntityNotFoundException , WIMSystemException { TimedDirContext ctx = getDirContext ( ) ; try { try { ctx . destroySubcontext ( new LdapName ( name ) ) ; } catch ( NamingException e ) { if ( ! isConnectionException ( e ) ) { throw e ; } ctx = reCreateDirContext ( ctx , e . toString ( ) ) ; ctx . destroySubcontext ( new LdapName ( name ) ) ; } } catch ( ContextNotEmptyException e ) { String msg = Tr . formatMessage ( tc , WIMMessageKey . ENTITY_HAS_DESCENDENTS , WIMMessageHelper . generateMsgParms ( name ) ) ; throw new EntityHasDescendantsException ( WIMMessageKey . ENTITY_HAS_DESCENDENTS , msg , e ) ; } catch ( NameNotFoundException e ) { String msg = Tr . formatMessage ( tc , WIMMessageKey . LDAP_ENTRY_NOT_FOUND , WIMMessageHelper . generateMsgParms ( name , e . toString ( true ) ) ) ; throw new EntityNotFoundException ( WIMMessageKey . LDAP_ENTRY_NOT_FOUND , msg , e ) ; } catch ( NamingException e ) { String msg = Tr . formatMessage ( tc , WIMMessageKey . NAMING_EXCEPTION , WIMMessageHelper . generateMsgParms ( e . toString ( true ) ) ) ; throw new WIMSystemException ( WIMMessageKey . NAMING_EXCEPTION , msg , e ) ; } finally { releaseDirContext ( ctx ) ; } }
Delete the given name from the LDAP tree.

@param name The distinguished name to delete.
@throws EntityHasDescendantsException The context being destroyed is not empty.
@throws EntityNotFoundException If part of the name cannot be found to destroy the entity.
@throws WIMSystemException If any other {@link NamingException} occurs or the context cannot be released.