directory-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel L├ęcharny <>
Subject Constructor throwing exception
Date Thu, 18 Feb 2016 05:49:25 GMT

yesterday, we had a quick chat with Radovan about the fact that some
constructors are throwing an Exception, like the DefaultSchemaManager().

Actually, all of the 4 DefaultSchemaManager throw an Exception, but we
can easily get rid of the 'throw' for 3 of them. The question is what
should we do with the default constructor ? The thrown Exception is the
one thrown when we intialise it :

    public DefaultSchemaManager() throws Exception
        loadAllEnabled();  <---- This is throwing an Exception

It makes little sense to thrown an exception in this case : the default
schema is not going to be altered in this very case (the default
constructor) because it's part of the API as a Jar file we provide. If
this jar file is incorrect, then the full API is incorrect.

I would suggest we stop throwing an Exception, and catch the one thrown
by loadAllEnabled() in the constructor, logging some message (which will
never happend anyway).

There is also a second change I'd like to do : everywhere we throw an
Exception in the API, we should at least throw a LdapException instead.

wdyt ?

View raw message