RFR:8205330 InitialDirContext ctor sometimes throws NPE if the server has sent a disconnection

Daniel Fuchs daniel.fuchs at oracle.com
Mon Sep 10 15:33:49 UTC 2018

On 10/09/2018 15:53, vyom tewari wrote:
> Yes , this will definitely solve this NPE issue but we may hit NPE other 
> places as well because we are setting 'LdapClient.com' to null 
> asynchronously.

I agree with Vyom here.

Other solutions that have been investigated - such as only
setting the connection to null when its ref count reaches zero
now seem to complex (read: too risky because over the complexity
threshold) to me.

Maybe the best thing to do here is to stick to Vyom original's
idea, but declare conn final and do all the necessary (small)
cleanup that goes with it? Possibly also add a comment saying
that CommunicationException will be thrown if some other thread
uses the LdapClient after forceClose has been closed...

best regards,

-- daniel

More information about the core-libs-dev mailing list