You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Steve Loughran <st...@apache.org> on 2010/10/27 12:01:34 UTC

class BuildTimeoutException extends BuildException

I'm thinking we need a specific class BuildTimeoutException that extends 
BuildException

-Java.java looks for the specific error message "Timeout: killed the 
sub-process" in Exec.java to recognise a timeout, and doesn't even share 
the constant string across classes.

-my own code looks for "Parallel execution timed out" in a test run and 
inserts a more meaningful message.

I propose

1. a new BuildTimeoutException
2. Exec, Parallel and other things that can timeout raise it.
3. Calling code in the Ant codebase can look for this.
4. we leave the error strings alone for fear of


#4 irritates me, I'd like some details about which subprocess got 
killed, but if we are searching for the string in Ant's own codebase, 
then we can be confident that others will be doing the same trick as well.

I'll do the coding...

-Steve

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


Re: class BuildTimeoutException extends BuildException

Posted by Jesse Glick <je...@oracle.com>.
On 10/28/2010 06:17 AM, Steve Loughran wrote:
> Ant uses getMessage() primarily to extract some text from BuildException
> to use in a log or other exception.

Probably this should be fixed to use getLocalizedMessage(), if only for consistency with Throwable.printStackTrace.


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


Re: class BuildTimeoutException extends BuildException

Posted by Steve Loughran <st...@apache.org>.
On 27/10/10 18:34, Jesse Glick wrote:
> On 10/27/2010 06:01 AM, Steve Loughran wrote:
>> 4. we leave the error strings alone for fear of [...fear itself?]
>>
>> #4 irritates me, I'd like some details about which subprocess got
>> killed, but if we are searching for the string in Ant's own codebase,
>> then we can be confident that others will be doing the same trick as
>> well.
>
> Possible hack: leave Throwable.detailMessage ~ getMessage() alone, but
> add extra fields & getters for the info about the subprocess, and
> override getLocalizedMessage() to include that information. Then the
> richer info will be shown in a stack trace, but other code checking
> e.getMessage() will not be broken. The only problem would be foreign
> code checking e.toString(), since this also uses getLocalizedMessage(),
> but I will bet people would naturally look at getMessage() instead.
>

good trick. All the places I've seen it do use getMessage() and would be 
brittle to change.

I think for my short-term needs (translation of a parallel exec timeout 
into a more meaningful message) in funtest, I just need the error class. 
I just noticed that java was playing the same trick with exec, and 
again, classtype is all it needs.

I'll look through the code to see where it looks for the toString() or 
getMessage() of buildexceptions


(pause)

Ant uses getMessage() primarily to extract some text from BuildException 
to use in a log or other exception.

Kaffe and Gcjh search the message for the string "failed with return 
code" when execing their apps and deciding whether to rethrow the 
exceptions. This is a bit naughty, again there should be a separate 
exception from Execute which signals that execution failed which these 
tasks should look for

-steve


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


Re: class BuildTimeoutException extends BuildException

Posted by Jesse Glick <je...@oracle.com>.
On 10/27/2010 06:01 AM, Steve Loughran wrote:
> 4. we leave the error strings alone for fear of [...fear itself?]
>
> #4 irritates me, I'd like some details about which subprocess got
> killed, but if we are searching for the string in Ant's own codebase,
> then we can be confident that others will be doing the same trick as well.

Possible hack: leave Throwable.detailMessage ~ getMessage() alone, but add extra fields & getters for the info about the subprocess, and override getLocalizedMessage() to 
include that information. Then the richer info will be shown in a stack trace, but other code checking e.getMessage() will not be broken. The only problem would be 
foreign code checking e.toString(), since this also uses getLocalizedMessage(), but I will bet people would naturally look at getMessage() instead.


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


Re: class BuildTimeoutException extends BuildException

Posted by Antoine Levy-Lambert <an...@gmx.de>.
On 10/27/10 12:33 PM, Steve Loughran wrote:
>
> I'm thinking of being ruthless and doing the move on the basis that
> that funtest task was never documented (my fault) and therefore
> doesn't exist, we can move it without guilt. Therefore I am now
> thinking of
>
> -move the existing BuildTimeoutException
> -upgrade Parallel, Exec and Java to use it, retaining the string
> -upgrade Funtest to catch it from Parallel and add a more useful error
> message (one that prints the timeout parameters).
>
> -steve
>
I
Sounds good,

Antoine

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


Re: class BuildTimeoutException extends BuildException

Posted by Steve Loughran <st...@apache.org>.
On 27/10/10 12:06, Stefan Bodewig wrote:
> On 2010-10-27, Steve Loughran wrote:
>
>> On 27/10/10 11:01, Steve Loughran wrote:
>>> I'm thinking we need a specific class BuildTimeoutException that extends
>>> BuildException
>
>>> I'll do the coding...
>
>> Of course, there is a well documented exception of just that name in
>> org.apache.tools.ant.taskdefs.optional.testing
>
> And I thought that was dead 8-)

I use my own precursor code, but it has to recognise problems from 
parallel timing out and handle it, which is is done by looking for strings.

>
>> Better to have some new Exception name
>
> +1
>
>> like BuildOperationTimeoutException to eliminate confusion
>
> TimeoutException?
>

I'm thinking of being ruthless and doing the move on the basis that that 
funtest task was never documented (my fault) and therefore doesn't 
exist, we can move it without guilt. Therefore I am now thinking of

-move the existing BuildTimeoutException
-upgrade Parallel, Exec and Java to use it, retaining the string
-upgrade Funtest to catch it from Parallel and add a more useful error 
message (one that prints the timeout parameters).

-steve

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


Re: class BuildTimeoutException extends BuildException

Posted by Stefan Bodewig <bo...@apache.org>.
On 2010-10-27, Steve Loughran wrote:

> On 27/10/10 11:01, Steve Loughran wrote:
>> I'm thinking we need a specific class BuildTimeoutException that extends
>> BuildException

>> I'll do the coding...

> Of course, there is a well documented exception of just that name in
> org.apache.tools.ant.taskdefs.optional.testing

And I thought that was dead 8-)

> Better to have some new Exception name

+1

> like BuildOperationTimeoutException to eliminate confusion

TimeoutException?

Stefan

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


Re: class BuildTimeoutException extends BuildException

Posted by Steve Loughran <st...@apache.org>.
On 27/10/10 11:01, Steve Loughran wrote:
> I'm thinking we need a specific class BuildTimeoutException that extends
> BuildException
>
> I'll do the coding...

Of course, there is a well documented exception of just that name in
org.apache.tools.ant.taskdefs.optional.testing

Which implies that I should really

  1. move that into the core codebase
  2. retain a subclass in that location, though that really confuses code:

class BuildTimeoutException extends 
org.apache.tools.ant.BuildTimeoutException

Better to have some new Exception name like 
BuildOperationTimeoutException to eliminate confusion

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