String filter = "(objectClass=krb5Principal)";
    public Object execute( DirContext ctx, Name searchBaseDn )    {        SearchControls controls = new SearchControls();        String filter = "(objectClass=krb5Principal)";        List answers = new ArrayList();        try        {            Attributes attrs = null;            NamingEnumeration answer = ctx.search( searchBaseDn, filter, controls );            while ( answer.hasMore() )            {                SearchResult result = ( SearchResult ) answer.next();                attrs = result.getAttributes();                PrincipalStoreEntry entry = getEntry( attrs );                System.out.println( "Result name is " + result.getName() );                answers.add( entry );            }            answer.close();            PrincipalStoreEntry[] entries = new PrincipalStoreEntry[answers.size()];            return ( PrincipalStoreEntry[] ) answers.toArray( entries );        }        catch ( NamingException e )        {            e.printStackTrace();            return null;        }    }