You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Bertrand Delacretaz <bd...@apache.org> on 2008/01/17 14:24:49 UTC

Eating exceptions in activate() methods?

The diffs of my revision 612808 changes include this, in
SimpleWebDavServlet.activate():

       try {
-            httpService.registerServlet(context, this, initparams, null);
-
-            // set the contextPath field to signal successfull registration
-            this.contextPath = context;
-
-        } catch (NamespaceException ne) {
-            // context collision
-
-        } catch (ServletException se) {
-            // servlet initialization failure
-
-        }

+          // Register servlet, and set the contextPath field to
signal successful registration
+          httpService.registerServlet(context, this, initparams, null);
+          this.contextPath = context;

Was there any reason to eat these exceptions?

To me it seems better to let the framework know that something went wrong.

-Bertrand

Re: Eating exceptions in activate() methods?

Posted by Felix Meschberger <fm...@gmail.com>.
Hi,

Am Donnerstag, den 17.01.2008, 14:24 +0100 schrieb Bertrand Delacretaz:
> The diffs of my revision 612808 changes include this, in
> SimpleWebDavServlet.activate():
> 
>        try {
> -            httpService.registerServlet(context, this, initparams, null);
> -
> -            // set the contextPath field to signal successfull registration
> -            this.contextPath = context;
> -
> -        } catch (NamespaceException ne) {
> -            // context collision
> -
> -        } catch (ServletException se) {
> -            // servlet initialization failure
> -
> -        }
> 
> +          // Register servlet, and set the contextPath field to
> signal successful registration
> +          httpService.registerServlet(context, this, initparams, null);
> +          this.contextPath = context;
> 
> Was there any reason to eat these exceptions?

Actually, they should not be eaten silently. This is just a left-over
from the get it up and running quickly time.

Rather my intention would be to catch them and log them with an
appropriate message. I would let them go up to the SCR because that one
cannot do anything about it other than screaming.

Regards
Felix

> 
> To me it seems better to let the framework know that something went wrong.
> 
> -Bertrand