You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Martin Cooper <ma...@tumbleweed.com> on 2002/03/04 04:46:37 UTC

[Digester] Asymmetry between ObjectCreateRule and FactoryCreateRule

I noticed an asymmetry between the way ObjectCreateRule and
FactoryCreateRule handle exceptions.

ObjectCreateRule.begin() does not attempt to catch the exceptions which
might be thrown from loadClass() or newInstance(). It simply allows them to
blow out of begin(), so that they may be handled elsewhere.

FactoryCreateRule.begin() calls the createObject() method, which has no
declared exceptions. Therefore, an implementation of createObject() must
handle the same exceptions which do not need to be handled in
ObjectCreateRule.begin().

Is this asymmetry intentional, or perhaps an oversight in
ObjectCreationFactory?

Thanks!

--
Martin Cooper



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [Digester] Asymmetry between ObjectCreateRule and FactoryCreateRule

Posted by robert burrell donkin <ro...@mac.com>.
hi martin

On Monday, March 4, 2002, at 03:46 AM, Martin Cooper wrote:

> I noticed an asymmetry between the way ObjectCreateRule and
> FactoryCreateRule handle exceptions.
>
> ObjectCreateRule.begin() does not attempt to catch the exceptions which
> might be thrown from loadClass() or newInstance(). It simply allows them 
> to
> blow out of begin(), so that they may be handled elsewhere.
>
> FactoryCreateRule.begin() calls the createObject() method, which has no
> declared exceptions. Therefore, an implementation of createObject() must
> handle the same exceptions which do not need to be handled in
> ObjectCreateRule.begin().
>
> Is this asymmetry intentional, or perhaps an oversight in
> ObjectCreationFactory?

i'd say that it's more a matter of style than an oversight. i usually 
prefer to allow no exceptions rather than allowing any exception.

on the other hand, there doesn't seem to be a good design reason why 
ObjectCreationFactory.createObject shouldn't allow any exception to be be 
thrown. so i'll willing to make the change if people think that it'd make 
things easier.

- robert


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [Digester] Asymmetry between ObjectCreateRule and FactoryCreateRule

Posted by Martin Cooper <ma...@tumbleweed.com>.
Great - thanks, Robert.

--
Martin Cooper


----- Original Message -----
From: "robert burrell donkin" <ro...@mac.com>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Tuesday, March 12, 2002 11:12 AM
Subject: Re: [Digester] Asymmetry between ObjectCreateRule and
FactoryCreateRule


> hi martin
>
> i've committed changes along the lines you suggested. thanks.
>
> - robert
>
> On Monday, March 4, 2002, at 03:46 AM, Martin Cooper wrote:
>
> > I noticed an asymmetry between the way ObjectCreateRule and
> > FactoryCreateRule handle exceptions.
> >
> > ObjectCreateRule.begin() does not attempt to catch the exceptions which
> > might be thrown from loadClass() or newInstance(). It simply allows them
> > to
> > blow out of begin(), so that they may be handled elsewhere.
> >
> > FactoryCreateRule.begin() calls the createObject() method, which has no
> > declared exceptions. Therefore, an implementation of createObject() must
> > handle the same exceptions which do not need to be handled in
> > ObjectCreateRule.begin().
> >
> > Is this asymmetry intentional, or perhaps an oversight in
> > ObjectCreationFactory?
> >
> > Thanks!
> >
> > --
> > Martin Cooper
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
<mailto:commons-dev-unsubscribe@jakarta.apache.
> > org>
> > For additional commands, e-mail:
<mailto:commons-dev-help@jakarta.apache.
> > org>
> >
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [Digester] Asymmetry between ObjectCreateRule and FactoryCreateRule

Posted by robert burrell donkin <ro...@mac.com>.
hi martin

i've committed changes along the lines you suggested. thanks.

- robert

On Monday, March 4, 2002, at 03:46 AM, Martin Cooper wrote:

> I noticed an asymmetry between the way ObjectCreateRule and
> FactoryCreateRule handle exceptions.
>
> ObjectCreateRule.begin() does not attempt to catch the exceptions which
> might be thrown from loadClass() or newInstance(). It simply allows them 
> to
> blow out of begin(), so that they may be handled elsewhere.
>
> FactoryCreateRule.begin() calls the createObject() method, which has no
> declared exceptions. Therefore, an implementation of createObject() must
> handle the same exceptions which do not need to be handled in
> ObjectCreateRule.begin().
>
> Is this asymmetry intentional, or perhaps an oversight in
> ObjectCreationFactory?
>
> Thanks!
>
> --
> Martin Cooper
>
>
>
> --
> To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.
> org>
> For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.
> org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>