Bug 50181 - Subclass BuildException with specific TimeoutException and ExecutedProgramFailedException exceptions
Summary: Subclass BuildException with specific TimeoutException and ExecutedProgramFai...
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core (show other bugs)
Version: nightly
Hardware: PC Linux
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Ant Notifications List
Depends on:
Reported: 2010-10-29 09:49 UTC by Steve Loughran
Modified: 2010-10-29 09:56 UTC (History)
0 users

patch to trunk (21.16 KB, patch)
2010-10-29 09:56 UTC, Steve Loughran
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Loughran 2010-10-29 09:49:14 UTC
It is easier for callers of ant tasks to determine the cause of some specific failures -namely test timeout and exec'd program failure by looking at the exception type, rather than for specific strings.

In the ant codebase we look for build timeouts by searching for the string "Timeout: killed the sub-process" in a Build Exception, and for executed programs to return with a non-zero result by looking for the string "failed with return code" in the BuildException test. This is bad style, and brittle.

This enhancement
 -adds specific subclasses to BuildException for these two events.
 -creates them at the right points in the code
   Timeout: ExecTask, Java, ParallelTask
   Execution failure: Execute
 -catches them in the code where needed
   Timeout: Java, the (effectively unreleased) funtest test runner
   Execution: Gcjh, kaffeh
The error strings are not changed, because of the risk that other code embedding Ant is looking the same strings; keeps everything backwards compatible.
Comment 1 Steve Loughran 2010-10-29 09:56:36 UTC
Created attachment 26226 [details]
patch to trunk