directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lécharny <elecha...@gmail.com>
Subject Re: Trying to change password with Modify Request, 'Server will disconnect' LdapException thrown.
Date Mon, 04 Feb 2013 02:25:27 GMT
Le 2/4/13 3:05 AM, Emmanuel Lécharny a écrit :
> Le 2/3/13 11:28 PM, Carlo.Accorsi@ibs-ag.com a écrit :
>>                                 Entry entry = connection.lookup(dn);
>>               Attribute at = entry.get("userPassword");
>>               Modification mod = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE,
at);
>>
>>                      ModifyRequest modRequest = new ModifyRequestImpl();
>>                      PasswordPolicy ctrl = new PasswordPolicyImpl();
>>                      modRequest.addControl(ctrl);
>>                      modRequest.addModification(mod);
>>                      ModifyResponse modResponse = connection.modify(modRequest);
// exception thrown here..
> I can reproduce the error. It seems that the request does not even get
> to the server, it's likelly an error while encoding the request.
>
> I'm invstigating it, looks like a bug in the Client API. More to come later.
>
Ok, not really a bug, but still, the error message is clearly not helping...

You havent set the MeodifyRequest's DN, so the encoding fails (NPE when
trying to encode the modifyRequest, because the DN is null).

Adding :

    modRequest.setName( dn );

solve the issue.


However, this is really not the right way to handle the NPE : we should
generate a decent error. I'll modify the client API so that such a NPE
can't occur.

-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 


Mime
View raw message