avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen McConnell" <mcconn...@osm.net>
Subject RE: Throwing exceptions during contextualization
Date Mon, 09 Apr 2001 14:05:59 GMT


Berin Loritsch wrote:
> >
> > This is on my to-do list (which I've lost =). I agree.
> > Since the lifecycle stuff is supposed to be stable, this
> > is not something we're allowed to change easily.
> > Perhaps we should make a RuntimeCascadingException
> > that extends RuntimeException and have ContextException
> > extend that to maintain compatibility...would that
> > work?
> >
> > btw, I feel more of the lifecycle methods should throw
> > a specific (new) kind of exception, for issues like this.
> > Would extending RuntimeException still allow legacy
> > code to compile (it should, but I'm not sure)?
>
> It would allow it to compile--the issue is that when the
> exception is thrown, it must be caught or the application/
> server will die unexpectedly.

Berin:

Ummm, ok, what your saying is that if there is an existing implementation
out there that is configuring things dynamically, and if we add in a
configurable instance that throws such an exception, then the existing
implementation may break.  While I agree that this is true, I think we
should
recognise that there are already implementation out there that are throwing
RuntimeExceptions "because of the absence of a formally declared exception".
I.e. adding a RuntimeCascadingException is in practice just documenting what
one is forced to do anyway.  My preference would be to get the interface
right (i.e. add a regular exception) before going to 4.0.

Cheers, Steve.


> >
> > cheers,
> >
> > LSD
> >
> > > -----Original Message-----
> > > From: Stephen McConnell [mailto:mcconnell@osm.net]
> > > Sent: Monday, April 09, 2001 2:30 PM
> > > To: Avalon Development
> > > Subject: RE: Throwing exceptions during contextualization
> > >
> > >
> > >
> > > Ricardo:
> > >
> > > I agree with you suggestion.  We have several cases where we are
> > > throwing a
> > > RuntimeException in order to bypass the interface restrictions.  If a
> > > ContextException is defined - I would like to see this extends
> > > CascadingException.
> > >
> > > Cheers, Steve.
> > >
> > >
> > > > -----Original Message-----
> > > > From: Ricardo Rocha [mailto:ricardo@apache.org]
> > > > Sent: Monday, 09 April, 2001 07:16
> > > > To: avalon-dev@jakarta.apache.org
> > > > Subject: Throwing exceptions during contextualization
> > > >
> > > >
> > > > A component implementing Contextualizable may need to assert some
> > > > condition(s) on its context and throw an exception if such
> condition(s)
> > > > are not met:
> > > >
> > > >   public class MyComponent implements Contextualizable {
> > > >     . . .
> > > >     public void contextualize(Context context) throws
> ContextException {
> > > >         this.requiredComponent = context.get("required");
> > > >         if (this.required == null) {
> > > >          throw new ContextException("Required component missing
> > > > in context");
> > > >         }
> > > >     }
> > > >     . . .
> > > >   }
> > > >
> > > > What do you think of creating a new ContextException and have the
> > > > contextualize(Context) method throw it?
> > > >
> > > > Regards,
> > > >
> > > > Ricardo
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: avalon-dev-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: avalon-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Mime
View raw message