protected void deleteRecursively ( DirContext ctx , Name name ) { NamingEnumeration enumeration = null ; try { enumeration = ctx . listBindings ( name ) ; while ( enumeration . hasMore ( ) ) { Binding binding = ( Binding ) enumeration . next ( ) ; LdapName childName = LdapUtils . newLdapName ( binding . getName ( ) ) ; childName . addAll ( 0 , name ) ; deleteRecursively ( ctx , childName ) ; } ctx . unbind ( name ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Entry " + name + " deleted" ) ; } } catch ( javax . naming . NamingException e ) { throw LdapUtils . convertLdapException ( e ) ; } finally { try { enumeration . close ( ) ; } catch ( Exception e ) { // Never mind this } } }
Delete all subcontexts including the current one recursively .