ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jose Alberto Fernandez" <>
Subject RE: How to deal with RuntimeExceptions thrown by tasks?
Date Fri, 04 Jun 2004 10:37:26 GMT
> From: Stefan Bodewig [] 
> I'm not sure I'm really able to capture the issue completely 
> but I'll try.  The discussion so far has been around <ant> 
> and friends, but maybe there is something deeper.

To me the issue goes beyound <ant>. It is more about having
a stricter invariant on what to expect as a result from
calling Task.perform(). The current signature really is:

public void  perform() throws BuildException, RuntimeException, Error;

I would prefer a tighter signature:

public void perform() throws BuildException, Error;

and here Error is a fatal condition that should just stop ANT.

> The code that handles the keepGoing mode explicitly only 
> handles BuildExceptions - all other exceptions cause Ant to 
> abort immediately.
> The questions I've seen so far:
> * should Ant continue in the presence of other RuntimeExceptions if
>   keepGoing is set?

Given my view point above, the question would be about Error.

> * or simply wrap any other RuntimeException into a BuildException?
This I want.

> * maybe even do this in Task#perform so that no RuntimeException ever
>   propagates outside of the Task execution?

Yes probably the correct place for it.

>   This may need to be done in Target#performTasks or even
>   Target#execute once again since tasks can override perform.

I guess this is not needed.

> * should Ant do this with all RuntimeExceptions or exclude some where
>   continuing may be wrong (SecurityException for example?)

ANT is stoping for these exceptions :-) but whether keepGoing should
I would settle here for simplicity and using the new signature say that
Error will stop and BuildException may continue.

Jose Alberto

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message