You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Jukka Zitting <ju...@gmail.com> on 2006/01/31 10:12:14 UTC

Remove o.a.j.BaseException?

Hi,

The org.apache.jackrabbit.BaseException class implements the root
cause mechanism that is also available built-in since Java 1.4. As we
already require Java 1.4 I propose that we remove the BaseException
class in favor of the standard Exception.

There are a few cases where the BaseException is explicitly referenced
like this:

    try {
        // do something
    } catch (BaseException e) {
        // generic error handling
    }

Is there a semantic reason for this or could such cases be replaced
with "catch (Exception e)"? In the former case I propose that a more
descriptive exception base class is created.

BR,

Jukka Zitting

--
Yukatan - http://yukatan.fi/ - info@yukatan.fi
Software craftmanship, JCR consulting, and Java development

Re: Remove o.a.j.BaseException?

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On 1/31/06, Felix Meschberger <Fe...@day.com> wrote:
> Though the BaseException (or JackrabbitException ??) has no life in
> itself, it might be usefull to have a catch-all jackrabbit-specific
> exception, especially since the exception is checked.

Is there a real use case for this?

Within Jackrabbit the BaseException class is used like this only to
catch the different exceptions in o.a.j.name. A more specific base
class like o.a.j.name.NameException would be much better in those
cases.

Outside Jackrabbit this would only be useful to external components
that invoke the Jackrabbit internals and to implementations that
extend or otherwise use the Jackrabbit core. Even these cases would
probably be better served by more specific exception base classes.

BR,

Jukka Zitting

--
Yukatan - http://yukatan.fi/ - info@yukatan.fi
Software craftmanship, JCR consulting, and Java development

Re: Remove o.a.j.BaseException?

Posted by Felix Meschberger <Fe...@day.com>.
Hi all,

+1 for renaming and cause setting support
-1 for removing

Though the BaseException (or JackrabbitException ??) has no life in 
itself, it might be usefull to have a catch-all jackrabbit-specific 
exception, especially since the exception is checked.

Regards
Felix

Stefan Guggisberg schrieb:
> On 1/31/06, Jukka Zitting <ju...@gmail.com> wrote:
>   
>> Hi,
>>
>> The org.apache.jackrabbit.BaseException class implements the root
>> cause mechanism that is also available built-in since Java 1.4. As we
>> already require Java 1.4 I propose that we remove the BaseException
>> class in favor of the standard Exception.
>>
>> There are a few cases where the BaseException is explicitly referenced
>> like this:
>>
>>     try {
>>         // do something
>>     } catch (BaseException e) {
>>         // generic error handling
>>     }
>>
>> Is there a semantic reason for this or could such cases be replaced
>> with "catch (Exception e)"? In the former case I propose that a more
>> descriptive exception base class is created.
>>     
>
> BaseException is the equivalent to RepositoryException. it's used to
> distinguish implementation (i.e. jackrabbit) specific exceptions from
> jcr api exceptions.
>
> +1 for renaming it and removing root cause mechanism (leftover from
> early implementations that were jre 1.3 compatible).
>
> -1 for removing it
>
> cheers
> stefan
>
>   
>> BR,
>>
>> Jukka Zitting
>>
>> --
>> Yukatan - http://yukatan.fi/ - info@yukatan.fi
>> Software craftmanship, JCR consulting, and Java development
>>
>>     


Re: Remove o.a.j.BaseException?

Posted by Stefan Guggisberg <st...@gmail.com>.
On 1/31/06, Jukka Zitting <ju...@gmail.com> wrote:
> Hi,
>
> The org.apache.jackrabbit.BaseException class implements the root
> cause mechanism that is also available built-in since Java 1.4. As we
> already require Java 1.4 I propose that we remove the BaseException
> class in favor of the standard Exception.
>
> There are a few cases where the BaseException is explicitly referenced
> like this:
>
>     try {
>         // do something
>     } catch (BaseException e) {
>         // generic error handling
>     }
>
> Is there a semantic reason for this or could such cases be replaced
> with "catch (Exception e)"? In the former case I propose that a more
> descriptive exception base class is created.

BaseException is the equivalent to RepositoryException. it's used to
distinguish implementation (i.e. jackrabbit) specific exceptions from
jcr api exceptions.

+1 for renaming it and removing root cause mechanism (leftover from
early implementations that were jre 1.3 compatible).

-1 for removing it

cheers
stefan

>
> BR,
>
> Jukka Zitting
>
> --
> Yukatan - http://yukatan.fi/ - info@yukatan.fi
> Software craftmanship, JCR consulting, and Java development
>

Re: Remove o.a.j.BaseException?

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

I've now removed the custom root cause mechanism in BaseException and
added a more specific NameException base class for the o.a.j.name
exceptions.

I'm fine with keeping the BaseException class for now.

PS. I also removed the exception constructors that allowed an
exception to be created without an explanatory message. It is good
practice to always include a error message in the exceptions, and IMO
the exception API should enforce this.

BR,

Jukka Zitting

--
Yukatan - http://yukatan.fi/ - info@yukatan.fi
Software craftmanship, JCR consulting, and Java development