System.out.println( "Search attempt using filter '" + filter + "' "
if (log.isDebugEnabled()) { log.debug( "Search attempt using filter '" + filter + "' "
    public boolean doRun( String filter, String scope, String base,        String limit )        throws Exception    {        System.out.println( "Search attempt using filter '" + filter + "' "            + "with scope '" + scope + "' and a return limit of '" + limit            + "'" );        FilterParser parser = new FilterParserImpl();        ExprNode root = null;        try         {            root = parser.parse( filter );        }         catch ( Exception e )         {            e.printStackTrace();            JTextArea text = new JTextArea();            String msg = e.getMessage();            if ( msg.length() > 1024 )            {                msg = msg.substring( 0, 1024 ) + "\n. . . truncated . . .";            }            text.setText( msg );            text.setEnabled( false );            JOptionPane.showMessageDialog( null, text, "Syntax Error",                JOptionPane.ERROR_MESSAGE );            return false;        }        SearchControls ctls = new SearchControls();        if ( scope == FilterDialog.BASE_SCOPE )        {	        ctls.setSearchScope( SearchControls.OBJECT_SCOPE );        }         else if ( scope == FilterDialog.SINGLE_SCOPE )        {            ctls.setSearchScope( SearchControls.ONELEVEL_SCOPE );        }         else if ( scope == FilterDialog.SUBTREE_SCOPE )        {            ctls.setSearchScope( SearchControls.SUBTREE_SCOPE );        } else {            throw new RuntimeException( "Unexpected scope parameter: " +                scope );        }        int limitMax = Integer.MAX_VALUE;        if ( ! limit.equals( FilterDialog.UNLIMITED ) )        {            limitMax = Integer.parseInt( limit );        }        Hashtable env = new Hashtable();        env.put( DerefAliasesEnum.JNDI_PROP,            DerefAliasesEnum.DEREFALWAYS_NAME );        NamingEnumeration cursor = eng.search( new LdapName( base ),                env, root, ctls );        String [] cols = new String [2];        cols[0] = "id";        cols[1] = "dn";        DefaultTableModel tableModel = new DefaultTableModel( cols, 0 );        Object [] row = new Object[2];        int count = 0;        while ( cursor.hasMore() && count < limitMax )        {            IndexRecord rec = ( IndexRecord ) cursor.next();            row[0] = rec.getEntryId();            row[1] = partition.getEntryDn( ( BigInteger ) row[0] );            tableModel.addRow( row );            count++;        }        SearchResultDialog results = new SearchResultDialog( this, false );        StringBuffer buf = new StringBuffer();        buf.append( "base: " );        buf.append( base );        buf.append( "\n" );        buf.append( "scope: " );        buf.append( scope );        buf.append( "\n" );        buf.append( "limit: " );        buf.append( limit );        buf.append( "\n" );        buf.append( "total: " );        buf.append( count );        buf.append( "\n" );        buf.append( "filter:\n" );        buf.append( filter );        buf.append( "\n" );        results.setFilter( buf.toString() );        TreeNode astRoot = new ASTNode( null, root );        TreeModel treeModel = new DefaultTreeModel( astRoot, true );        results.setTreeModel( treeModel );        results.setTableModel( tableModel );        centerOnScreen( results );        results.setVisible( true );        return true;    }