PLEASE DO NOT REPLY TO THIS MESSAGE. TO FURTHER COMMENT ON THE STATUS OF THIS BUG PLEASE FOLLOW THE LINK BELOW AND USE THE ON-LINE APPLICATION. REPLYING TO THIS MESSAGE DOES NOT UPDATE THE DATABASE, AND SO YOUR COMMENT WILL BE LOST SOMEWHERE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2942 *** shadow/2942 Wed Aug 1 06:29:28 2001 --- shadow/2942.tmp.22563 Wed Aug 1 11:11:53 2001 *************** *** 2,9 **** | Build Event Listener does not catch exception | +----------------------------------------------------------------------------+ | Bug #: 2942 Product: Ant | ! | Status: RESOLVED Version: Nightly build | ! | Resolution: WORKSFORME Platform: Sun | | Severity: Blocker OS/Version: Other | | Priority: Other Component: Build Process | +----------------------------------------------------------------------------+ --- 2,9 ---- | Build Event Listener does not catch exception | +----------------------------------------------------------------------------+ | Bug #: 2942 Product: Ant | ! | Status: REOPENED Version: Nightly build | ! | Resolution: Platform: Sun | | Severity: Blocker OS/Version: Other | | Priority: Other Component: Build Process | +----------------------------------------------------------------------------+ *************** *** 77,79 **** --- 77,156 ---- Total time: 1 second Listener: build finished with exception = org.apache.tools.ant.BuildException F:\antdev\bugs\bug2942> + + ------- Additional Comments From [EMAIL PROTECTED] 2001-08-01 11:11 ------- + Thanks Conor for your prompt response. + + I am not sure if I am seeing normal behaviour from the BuildEvent Listener. + Here is what I tried. + + C:\play>ant -listener BuildValidate -f test.xml + + C:\play>type test.xml + <project default="X" > + <target name="X"> + <copy file="doesnotexist.txt" tofile="doesnotexist2.txt" /> + </target> + </project> + + C:\play>dir does* + Volume in drive C has no label. + Volume Serial Number is 07D1-0208 + + Directory of C:\play + + File Not Found + + C:\play>ant -listener BuildValidate -f test.xml + Buildfile: test.xml + + X: + [copy] Could not find file C:\play\doesnotexist.txt to copy. + Task has completed successfully + + <mycomment> getException() = null in taskFinished() in BuildValidate</mycomment> + + Target has finished successfully + + <mycomment> getException() = null in targetFinished() in + BuildValidate</mycomment> + + BUILD SUCCESSFUL + + Total time: 1 second + + C:\play>type test.xml + <project default="X" > + <target name="X"> + <copy file="doesnotexist.txt" tofile="doesnotexist2.txt" /> + <ant antfile="test.xml" target="build" /> + </target> + </project> + + C:\play>ant -listener BuildValidate -f test.xml + Buildfile: test.xml + + X: + [copy] Could not find file C:\play\doesnotexist.txt to copy. + Task has completed successfully + Task has completed successfully + Target has finished unsuccessfully + <mycomment> Both tasks are successful, but the target isn't! </mycomment> + + + BUILD FAILED + + C:\play\test.xml:4: Target `build' does not exist in this project. + + Total time: 1 second + + ------------- + I think, an unsuccessful task is not caught in the taskFinished() method, but + is caught in the targetFinished() method which is why you were able to catch + the exception since you implemented it in the targetFinished() method. + I intend to catch errors in individual tasks within a target. + + Correct me if I am mistaken. + + Thanks, + Shankar \ No newline at end of file
