Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 7366 invoked from network); 28 Aug 2003 14:01:05 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 28 Aug 2003 14:01:05 -0000 Received: (qmail 8105 invoked by uid 500); 28 Aug 2003 13:59:16 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 8046 invoked by uid 500); 28 Aug 2003 13:59:16 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 7815 invoked from network); 28 Aug 2003 13:59:12 -0000 Received: from unknown (HELO relay.t-online-com.de) (62.156.147.74) by daedalus.apache.org with SMTP; 28 Aug 2003 13:59:12 -0000 Received: from DJ0X820J (p5080ec42.dip0.t-ipconnect.de [80.128.236.66]) by relay.t-online-com.de (SMTPSVC(1.0.0.1)) with ESMTP id 2AAB7150046 for ; Thu, 28 Aug 2003 15:56:27 +0200 (CEST) Message-ID: <00bb01c36d6c$c6788ab0$020200c0@DJ0X820J> From: "Antoine Levy-Lambert" To: "Ant Developers List" References: <20030828134633.98523.qmail@minotaur.apache.org> Subject: Re: cvs commit: ant/src/testcases/org/apache/tools/ant/taskdefs JavaTest.java Date: Thu, 28 Aug 2003 16:00:44 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Steve, can you check that you are happy with this ? Cheers, Antoine ----- Original Message ----- From: To: Sent: Thursday, August 28, 2003 3:46 PM Subject: cvs commit: ant/src/testcases/org/apache/tools/ant/taskdefs JavaTest.java > antoine 2003/08/28 06:46:33 > > Modified: docs/manual/CoreTasks java.html > src/etc/testcases/taskdefs java.xml > src/main/org/apache/tools/ant/taskdefs Java.java > src/testcases/org/apache/tools/ant/taskdefs JavaTest.java > Log: > Set default permissions appropriate to fail the builds when failonerror is > true (and fork false) and no other permissions were set. > Suggestion of Steve Loughran. > > Revision Changes Path > 1.22 +6 -1 ant/docs/manual/CoreTasks/java.html > > Index: java.html > =================================================================== > RCS file: /home/cvs/ant/docs/manual/CoreTasks/java.html,v > retrieving revision 1.21 > retrieving revision 1.22 > diff -u -r1.21 -r1.22 > --- java.html 27 Aug 2003 14:23:16 -0000 1.21 > +++ java.html 28 Aug 2003 13:46:33 -0000 1.22 > @@ -88,7 +88,7 @@ > > failonerror > Stop the buildprocess if the command exits with a > - returncode other than 0. Default is "false" > + returncode other than 0. Default is "false"(see note) > No > > > @@ -220,6 +220,11 @@ >

When the permission RuntimePermission exitVM has not been granted (or has > been revoked) the System.exit() call will be intercepted > and treated like indicated in failonerror.

> +

> +If you specify failonerror="true" and you do not specify permissions, > +a set of default permissions will be added to your java invocation maki ng sure that > +a non zero return code will lead to a BuildException. > +

> >

Settings will be ignored if fork is enabled.

> > > > > 1.11 +16 -0 ant/src/etc/testcases/taskdefs/java.xml > > Index: java.xml > =================================================================== > RCS file: /home/cvs/ant/src/etc/testcases/taskdefs/java.xml,v > retrieving revision 1.10 > retrieving revision 1.11 > diff -u -r1.10 -r1.11 > --- java.xml 27 Aug 2003 19:12:42 -0000 1.10 > +++ java.xml 28 Aug 2003 13:46:33 -0000 1.11 > @@ -139,7 +139,23 @@ > > > > + > + + classpath="${tests-classpath.value}" > + failonerror="true" > + > > + > + > + > > + > + + classpath="${tests-classpath.value}" > + failonerror="true" > + > > + > + > + > > > > > > > 1.71 +8 -1 ant/src/main/org/apache/tools/ant/taskdefs/Java.java > > Index: Java.java > =================================================================== > RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Java.java,v > retrieving revision 1.70 > retrieving revision 1.71 > diff -u -r1.70 -r1.71 > --- Java.java 27 Aug 2003 14:23:16 -0000 1.70 > +++ Java.java 28 Aug 2003 13:46:33 -0000 1.71 > @@ -97,7 +97,7 @@ > private Long timeout = null; > private Redirector redirector = new Redirector(this); > private String resultProperty; > - private Permissions perm; > + private Permissions perm = null; > > private boolean spawn = false; > private boolean incompatibleWithSpawn = false; > @@ -108,6 +108,7 @@ > */ > public void execute() throws BuildException { > File savedDir = dir; > + Permissions savedPermissions = perm; > > int err = -1; > try { > @@ -122,6 +123,7 @@ > maybeSetResultPropertyValue(err); > } finally { > dir = savedDir; > + perm = savedPermissions; > } > } > > @@ -179,6 +181,11 @@ > Project.MSG_WARN); > } > > + if (perm == null && failOnError == true) { > + perm = new Permissions(); > + log("running " + this.cmdl.getClassname() > + + " with default permissions (exit forbidden)", Project.MSG_VERBOSE); > + } > log("Running in same VM " + cmdl.describeJavaCommand(), > Project.MSG_VERBOSE); > } > > > > 1.15 +9 -0 ant/src/testcases/org/apache/tools/ant/taskdefs/JavaTest.java > > Index: JavaTest.java > =================================================================== > RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/JavaTest.java,v > retrieving revision 1.14 > retrieving revision 1.15 > diff -u -r1.14 -r1.15 > --- JavaTest.java 27 Aug 2003 14:23:17 -0000 1.14 > +++ JavaTest.java 28 Aug 2003 13:46:33 -0000 1.15 > @@ -196,6 +196,15 @@ > assertEquals("-1",project.getProperty("exitcode")); > } > > + public void testRunFailWithFailOnError() { > + expectBuildExceptionContaining("testRunFailWithFailOnError", > + "non zero return code", > + "Java returned:"); > + } > + > + public void testRunSuccessWithFailOnError() { > + executeTarget("testRunSuccessWithFailOnError"); > + } > public void testSpawn() { > FileUtils fileutils = FileUtils.newFileUtils(); > File logFile = fileutils.createTempFile("spawn","log", project.getBaseDir()); > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org > For additional commands, e-mail: dev-help@ant.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org