directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lecharny <elecha...@gmail.com>
Subject Re: Constructors & Exceptions
Date Thu, 03 Jan 2008 22:02:23 GMT
Alex Karasulu wrote:
> Why is it bad to have a checked exception in the throws clause of a 
> constructor?
It's not bad by essence. It just palin hurts when you have to create new 
instances in thousands places in the code :


ServerEntry entry = null;

try
{
    entry = new DefaultServerEntry( <params> );
}
catch ( WhateverCheckedException wce )
{
    LOG.error( "Why the HELL do I have to catch errors when creating a 
new object everywhere ???" );
}

instead of :
ServerEntry entry = new DefaultServerentry( <params> ); // I _know_ what 
I'm doing !!! params *are* valid, for G*d sake !

IMHO, of course :)
>
>
>     --
>     cordialement, regards,
>     Emmanuel L├ęcharny
>     www.iktek.com <http://www.iktek.com>
>     directory.apache.org <http://directory.apache.org>
>
>
>


-- 
--
cordialement, regards,
Emmanuel L├ęcharny
www.iktek.com
directory.apache.org



Mime
View raw message