You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2004/12/27 21:27:32 UTC
DO NOT REPLY [Bug 32853] New: -
with fork=true and failOnError=false shows exception stack trace on timeout
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=32853>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=32853
Summary: <java> with fork=true and failOnError=false shows
exception stack trace on timeout
Product: Ant
Version: 1.6.2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P3
Component: Core tasks
AssignedTo: dev@ant.apache.org
ReportedBy: bart_wauters@yahoo.com
Overview:
- In Ant 1.6.2 and a recent nightly build, the <java> task, with fork="true",
failOnError="false" and timeout="4000" (for instance), when the timeout expires,
correctly terminates the class specified, shows "Timeout: killed the
sub-process", but then also shows an exception stack trace.
- In Ant 1.6.1, no exception stack trace was shown, which seems appropriate in
this situation.
Steps:
1)create file Applet1c.java:
public class Applet1c {
public static void main(String[] args) {
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
}
}
}
2)create build.xml:
<project name="MyProject" default="Applet1c" basedir=".">
<target name="Applet1c">
<java
classname="Applet1c"
classpath="${basedir};${basedir}/.."
dir="."
error="tmp.txt"
failonerror="false"
fork="true"
timeout="4000"/>
</target>
</project>
3)run ant:
ant
Actual output:
Buildfile: build.xml
Applet1c:
[java] Timeout: killed the sub-process
[java] at org.apache.tools.ant.taskdefs.Java.fork(Java.java:749)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:170)
[java] at org.apache.tools.ant.taskdefs.Java.execute(Java.java:83)
[java] at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[java] at org.apache.tools.ant.Task.perform(Task.java:364)
[java] at org.apache.tools.ant.Target.execute(Target.java:341)
[java] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[java] at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
[java] at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
[java] at org.apache.tools.ant.Main.runBuild(Main.java:673)
[java] at org.apache.tools.ant.Main.startAnt(Main.java:188)
[java] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
[java] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
BUILD SUCCESSFUL
Total time: 13 seconds
Expected output:
Buildfile: build.xml
Applet1c:
[java] Timeout: killed the sub-process
BUILD SUCCESSFUL
Total time: 13 seconds
Suggested solution:
- This change in behavior from Ant 1.6.1 to 1.6.2 seems to be related to the bug
fix described in the release notes of Ant 1.6.2: "<java> swallowed the stack
trace of exceptions thrown by the executed program if run in the same VM.".
- A possible solution would be to change the file
org\apache\tools\ant\taskdefs\Java.java (Ant 1.6.2), line 183 and following, as
follows:
} catch (BuildException e) {
if (failOnError) {
throw e;
} else {
if (fork && (!spawn)) {
log(e.getMessage(), Project.MSG_ERR);
} else {
log(e);
}
return 0;
}
} catch (Throwable t) {
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org