[Date Prev][Date Next] [Chronological] [Thread] [Top]

I find a errorin this function LDAPSearchResults search(LDAPUrl toGet)

when i use connection pool
i run this function search(LDAPUrl toGet),it will appear a error :can not close the connection

so i try to correct the bug,it is no problem:

                LDAPConfigurationReader LDAPConfigurationReader = null;
                Map hashMap = null;
                try {
                    hashMap = LDAPConfigurationReader.getConfiguration();
                } catch (Exception e) {
                    // TODO Auto-generated catch block
                connectionFactory=ConnectionFactory.getInstance ();
                LDAPSearchResults searchResults = LDAPConnection.search (LDAPConnection,myUrl );

    public static LDAPSearchResults search(LDAPConnection LDAPConnection,LDAPUrl toGet)
        throws LDAPException
        // Get a clone of default search constraints, method alters batchSize
        return search( LDAPConnection,toGet, null);

    public static LDAPSearchResults search(LDAPConnection LDAPConnection,LDAPUrl toGet,
                                           LDAPSearchConstraints cons)
        throws LDAPException
        if( Debug.LDAP_DEBUG) {
            Debug.trace( Debug.apiRequests,
                    "LDAPConnection.search(" + toGet.toString() + ")");
        //LDAPConnection lconn = new LDAPConnection();
        if( cons == null) {
            // This is a clone, so we already have our own copy
            cons = LDAPConnection.getSearchConstraints();
        } else {
            // get our own copy of user's constraints because we modify it
            cons = (LDAPSearchConstraints)cons.clone();
        cons.setBatchSize(0); // Must wait until all results arrive
        LDAPSearchResults toReturn = LDAPConnection.search(toGet.getDN(),
                toGet.getScope(), toGet.getFilter(), toGet.getAttributeArray (),
                false, cons);
        return toReturn;

My MSN:zhoujianguo_leo@hotmail.com
i from china shanghai