Le 18/09/14 05:16, Kiran Ayyagari a écrit :
> On Thu, Sep 18, 2014 at 1:52 AM, Morris, Chris <[email protected]>
> wrote:
>
>> To whom it may concern,
>>
>> I am working through the User's Guide, and some of the code examples that
>> you have in "2.2-binding-unbinding" shows the following:
>>
>> @Test
>> public void testAnonymousBindRequest() throws Exception
>> {
>>     BindResponse bindResponse = connection.bind();
>>
>>     assertNotNull( bindResponse );
>>     assertEquals( ResultCodeEnum.SUCCESS,
>> bindResponse.getLdapResult().getResultCode() );
>>     assertTrue( connection.isAuthenticated() );
>> }
>>
>> The problem is that I am getting an error on the "BindResponse
>> bindResponse = connection.bind();" line stating, "cannot convert from type
>> void to BindResponse." So, does connection.bind() not return anything,
>> because that is my assumption at this point. If that is true, than the
>> above needs to be updated as well as the rest of that page. If that is not
>> true, I literally have inserted this code into my program, so what am I
>> doing wrong?
>>
>> the API was changed since this page was written,
> change that to:
>
> connection.bind();
>
> and remove rest of the lines
>
> but if you want to experiment with the rest of the assertions then
> call bind with a BindRequest or call the bind with default credentials like
> bind("uid=admin,ou=system", "secret")

I'll fix the page. It's clearly a mistake.

Whe you do a bind(), you will get an exception if something went wrong.
You neber get a BindResponse, unless you have called bind(BindRequest).
Note that the bind( DN, password ) does not return anything either,
except a LdapException if the bind failed.

Thanks for the report.

Reply via email to