directory-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lecharny <>
Subject About exceptions
Date Fri, 12 Mar 2010 11:05:08 GMT

it's about time to talk about exceptions, as many methods will throw an 
exception, and it would be good to know what to throw !

We should first have a base exception, and I suggest using 
LdapException. Evey other exception will inherit this one.

The second point is that the LDAP protocol define a list of errors, and 
we should map an exception to those errors. This has been done for JNDI, 
and it's a pretty good idea to keep our exception hierarchy close to the 
JNDI one.

AFAICT, neither OpenDS nor Unboundid define an exception hierarchy. 
Something I don't find useful is a method throwing a 
NullPointerException (IMO, this is totally useless, and certainly not an 
exception you want to add in the list of thrown exceptions for a method 

jLDAP defines a few exceptions, with a base LDAPException class.
LDAPReferralException, LDAPLocalException are subclasses and used for 
some specific needs.

All in all, JNDI's exception system is pretty decent, and I think we 
should mimic it, but without implementing or extending the JNDI classes 
(something ADS is doing, and it collides with the renaming of DN, as 
it's not anymore a NAME extension).
thoughts ?

Emmanuel L├ęcharny

View raw message