cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carsten Ziegeler" <cziege...@s-und-n.de>
Subject RE: Declared exceptions not thrown - Can be removed?
Date Sun, 26 Oct 2003 10:16:31 GMT
> From: Antonio Gallardo [mailto:agallardo@agsoftware.dnsalias.com]
>
> I was reviewing the cocoon code and found some declared exceptions that
> are not thrown by the methods declared by it.
>
> Sample:
> o.a.c.webapps.authentication.components.DefaultAuthenticationManager
>
> There is a function:
>
>    public void configure(SitemapConfigurationHolder holder)
>     throws ConfigurationException {
>         this.holder = holder;
>     }
>
> But this function does not trows any Exception. We can write:
>
>    public void configure(SitemapConfigurationHolder holder)
>    {
>         this.holder = holder;
>    }
>
> This also works in Cocoon. Can we remove it? I ask because there are other
> similars elsewhere.
>
These are methods defined by interfaces, like in the case above the
Configurable interface. The method declared in that interface
has the "throws" clause in its signature.
You could remove them, but as soon as you start inheriting from such
a class you can't overwrite the method anymore because of signature
problems.
So we should leave the throws clause if it belongs to an interface.
In other cases, we could remove them.

Carsten


Mime
View raw message