cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Java.java

2005-04-15 Thread bodewig
bodewig 2005/04/15 01:11:09

  Modified:src/main/org/apache/tools/ant/taskdefs Tag: ANT_16_BRANCH
Java.java
  Log:
  merge
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.77.2.14 +4 -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.77.2.13
  retrieving revision 1.77.2.14
  diff -u -r1.77.2.13 -r1.77.2.14
  --- Java.java 18 Mar 2005 17:29:31 -  1.77.2.13
  +++ Java.java 15 Apr 2005 08:11:09 -  1.77.2.14
  @@ -182,6 +182,9 @@
   }
   }
   } catch (BuildException e) {
  +if (e.getLocation() == null && getLocation() != null) {
  +e.setLocation(getLocation());
  +}
   if (failOnError) {
   throw e;
   } else {
  @@ -190,7 +193,7 @@
   }
   } catch (Throwable t) {
   if (failOnError) {
  -throw new BuildException(t);
  +throw new BuildException(t, getLocation());
   } else {
   log(t);
   return 0;
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Java.java

2005-04-15 Thread bodewig
bodewig 2005/04/15 01:10:39

  Modified:src/main/org/apache/tools/ant/taskdefs Java.java
  Log:
  Make sure we add a location when  fails
  
  Revision  ChangesPath
  1.104 +4 -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.103
  retrieving revision 1.104
  diff -u -r1.103 -r1.104
  --- Java.java 18 Mar 2005 17:32:14 -  1.103
  +++ Java.java 15 Apr 2005 08:10:39 -  1.104
  @@ -194,6 +194,9 @@
   }
   }
   } catch (BuildException e) {
  +if (e.getLocation() == null && getLocation() != null) {
  +e.setLocation(getLocation());
  +}
   if (failOnError) {
   throw e;
   } else {
  @@ -202,7 +205,7 @@
   }
   } catch (Throwable t) {
   if (failOnError) {
  -throw new BuildException(t);
  +throw new BuildException(t, getLocation());
   } else {
   log(t);
   return 0;
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Java.java

2005-03-18 Thread mbenson
mbenson 2005/03/18 09:32:14

  Modified:src/main/org/apache/tools/ant/taskdefs Java.java
  Log:
  getSysProperties() and getCommandLine() to 1.6.3
  
  Revision  ChangesPath
  1.103 +2 -2  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.102
  retrieving revision 1.103
  diff -u -r1.102 -r1.103
  --- Java.java 14 Mar 2005 20:09:54 -  1.102
  +++ Java.java 18 Mar 2005 17:32:14 -  1.103
  @@ -905,7 +905,7 @@
* Accessor to the command line.
*
* @return the current command line.
  - * @since 1.7
  + * @since 1.6.3
*/
   public CommandlineJava getCommandLine() {
   return cmdl;
  @@ -915,7 +915,7 @@
* Get the system properties of the command line.
*
* @return the current properties of this java invocation.
  - * @since 1.7
  + * @since 1.6.3
*/
   public CommandlineJava.SysProperties getSysProperties() {
   return cmdl.getSystemProperties();
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Java.java

2005-03-18 Thread mbenson
mbenson 2005/03/18 09:29:31

  Modified:src/main/org/apache/tools/ant/taskdefs Tag: ANT_16_BRANCH
Java.java
  Log:
  Merging changes from v1.95
  PR: 27154
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.77.2.13 +20 -0 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.77.2.12
  retrieving revision 1.77.2.13
  diff -u -r1.77.2.12 -r1.77.2.13
  --- Java.java 16 Mar 2005 16:52:27 -  1.77.2.12
  +++ Java.java 18 Mar 2005 17:29:31 -  1.77.2.13
  @@ -842,4 +842,24 @@
   w.close();
   log(sw.toString(), Project.MSG_ERR);
   }
  +
  +/**
  + * accessor to the command line
  + *
  + * @return the current command line
  + * @since 1.6.3
  + */
  +public CommandlineJava getCommandLine() {
  +return cmdl;
  +}
  +
  +/**
  + * get the system properties of the command line
  + *
  + * @return the current properties of this java invocation
  + * @since 1.6.3
  + */
  +public CommandlineJava.SysProperties getSysProperties() {
  +return cmdl.getSystemProperties();
  +}
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Java.java PumpStreamHandler.java Redirector.java StreamPumper.java

2005-03-16 Thread jglick
jglick  2005/03/16 08:52:27

  Modified:.Tag: ANT_16_BRANCH WHATSNEW
   docs/manual/CoreTasks Tag: ANT_16_BRANCH java.html
   src/main/org/apache/tools/ant/taskdefs Tag: ANT_16_BRANCH
Java.java PumpStreamHandler.java Redirector.java
StreamPumper.java
  Log:
  Merging  console input fix to Ant 1.6.3.
  PR: 24918
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.503.2.200 +4 -0  ant/WHATSNEW
  
  Index: WHATSNEW
  ===
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.503.2.199
  retrieving revision 1.503.2.200
  diff -u -r1.503.2.199 -r1.503.2.200
  --- WHATSNEW  15 Mar 2005 20:57:30 -  1.503.2.199
  +++ WHATSNEW  16 Mar 2005 16:52:25 -  1.503.2.200
  @@ -129,6 +129,10 @@
   Fixed bugs:
   ---
   
  +* Programs run with  can now accept standard input
  +  from the Ant console.  (Programs run with  could
  +  already do so.)  Bugzilla 24918.
  +
   * AbstractCvsTask prematurely closed its outputStream and errorStream.
 Bugzilla 30097.
   
  
  
  
  No   revision
  No   revision
  1.24.2.12 +7 -7  ant/docs/manual/CoreTasks/java.html
  
  Index: java.html
  ===
  RCS file: /home/cvs/ant/docs/manual/CoreTasks/java.html,v
  retrieving revision 1.24.2.11
  retrieving revision 1.24.2.12
  diff -u -r1.24.2.11 -r1.24.2.12
  --- java.html 10 Mar 2005 13:07:43 -  1.24.2.11
  +++ java.html 16 Mar 2005 16:52:26 -  1.24.2.12
  @@ -16,10 +16,9 @@
   If odd things go wrong when you run this task, set fork="true" to use a new
   JVM.
   
  -Note that you cannot interact with a forked VM, the only way to
  -send input to it is via the input and inputstring attributes. Also note that
  -in Ant 1.6, any attempt to read input in the forked VM will receive an
  -EOF (-1). This is a change from Ant 1.5, where such an attempt would 
block.
  +As of Ant 1.6.3, you can interact with a forked VM, as well as
  +sending input to it via the input and inputstring
  +attributes.
   
   Parameters
   
  @@ -156,14 +155,16 @@
   A file from which the executed command's standard input
is taken. This attribute is mutually exclusive with the
inputstring attribute
  -No
  +No; default is to take standard input 
from console
  +(unless spawn="true")
 
 
   inputstring
   A string which serves as the input stream for the
executed command. This attribute is mutually exclusive 
with the
input attribute.
  -No
  +No; default is to take standard input 
from console
  +(unless spawn="true")
 
 
   newenvironment
  @@ -314,4 +315,3 @@
   
   
   
  -
  
  
  
  No   revision
  No   revision
  1.77.2.12 +8 -6  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.77.2.11
  retrieving revision 1.77.2.12
  diff -u -r1.77.2.11 -r1.77.2.12
  --- Java.java 23 Jun 2004 19:17:12 -  1.77.2.11
  +++ Java.java 16 Mar 2005 16:52:27 -  1.77.2.12
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2000-2004 The Apache Software Foundation
  + * Copyright  2000-2005 The Apache Software Foundation
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
  @@ -35,6 +35,7 @@
   import org.apache.tools.ant.types.Assertions;
   import org.apache.tools.ant.types.Permissions;
   import org.apache.tools.ant.types.RedirectorElement;
  +import org.apache.tools.ant.util.KeepAliveInputStream;
   
   /**
* Launcher for Java applications. Allows use of
  @@ -624,11 +625,8 @@
*/
   public int handleInput(byte[] buffer, int offset, int length)
   throws IOException {
  -if (redirector.getInputStream() != null) {
  -return redirector.handleInput(buffer, offset, length);
  -} else {
  -return super.handleInput(buffer, offset, length);
  -}
  +// Should work whether or not redirector.inputStream == null:
  +return redirector.handleInput(buffer, offset, length);
   }
   
   /**
  @@ -687,6 +685,10 @@
   if (redirectorElement != null) {
   redirectorElement.configure(redirector);
   }
  +if (!spawn && input == null && inputString == null) {
  +// #24918: send standard input to the process by default.
  +redirector.setInputStream(new 
KeepAliveInputStream(getProject().getDefaultInputStream()));
  +}

cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Java.java

2005-03-14 Thread jkf
jkf 2005/03/14 12:09:54

  Modified:.WHATSNEW
   docs/manual/CoreTasks java.html
   src/main/org/apache/tools/ant/taskdefs Java.java
  Log:
  PR: 33361
  
  In ant 1.7 the security manager will, unless explicitly created to allow
  System.exit veto a System.exit. This allows ant to continue its run when
  a java program started via the java tasks in nonforked mode without
  failonerror set calls System.exit. For java tasks in forked mode nothing
  changes. For java tasks with failonerror set this was already the existing
  behaviour.
  
  Revision  ChangesPath
  1.779 +5 -0  ant/WHATSNEW
  
  Index: WHATSNEW
  ===
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.778
  retrieving revision 1.779
  diff -u -r1.778 -r1.779
  --- WHATSNEW  14 Mar 2005 14:58:54 -  1.778
  +++ WHATSNEW  14 Mar 2005 20:09:54 -  1.779
  @@ -27,6 +27,11 @@
 volumes can still be specified without an intervening separator.
 UNC pathnames on Windows must include a server and share name, i.e.
 "\\a\b" to be considered valid absolute paths.
  +  
  +* The  now as per default installs a security manager
  +  using the default permissions. This is now independent of the 
  +  failonerror attribute.
  +  Bugzilla report 33361.
   
   Fixed bugs:
   ---
  
  
  
  1.39  +7 -4  ant/docs/manual/CoreTasks/java.html
  
  Index: java.html
  ===
  RCS file: /home/cvs/ant/docs/manual/CoreTasks/java.html,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- java.html 10 Mar 2005 13:01:55 -  1.38
  +++ java.html 14 Mar 2005 20:09:54 -  1.39
  @@ -239,10 +239,13 @@
   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.
  -Note:
  -if you specify failonerror="true" and you do not 
specify permissions,
  -a set of default permissions will be added to your Java invocation to make 
sure that
  -a non-zero return code will lead to a BuildException.
  +Note:
  +If you do not specify permissions,
  +a set of default permissions will be added to your Java invocation to make 
  +sure that the ant run will continue or terminated as indicated by
  +failonerror. All permissions not granted per default will be 
  +checked by whatever security manager was already in place. exitVM will be
  +disallowed.
   
   Settings will be ignored if fork is enabled.
   
  
  
  
  1.102 +3 -3  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.101
  retrieving revision 1.102
  diff -u -r1.101 -r1.102
  --- Java.java 18 Feb 2005 22:09:44 -  1.101
  +++ Java.java 14 Mar 2005 20:09:54 -  1.102
  @@ -36,7 +36,6 @@
   import org.apache.tools.ant.types.Permissions;
   import org.apache.tools.ant.types.RedirectorElement;
   import org.apache.tools.ant.taskdefs.condition.Os;
  -import org.apache.tools.ant.util.JavaEnvUtils;
   import org.apache.tools.ant.util.KeepAliveInputStream;
   
   /**
  @@ -117,7 +116,8 @@
* Do the execution and return a return code.
*
* @return the return code from the execute java class if it was
  - * executed in a separate VM (fork = "yes").
  + * executed in a separate VM (fork = "yes") or a security manager was 
  + * installed that prohibits ExitVM (default).
*
* @throws BuildException if required parameters are missing.
*/
  @@ -168,7 +168,7 @@
   log("bootclasspath ignored when same JVM is used.",
   Project.MSG_WARN);
   }
  -if (perm == null && failOnError) {
  +if (perm == null) {
   perm = new Permissions(true);
   log("running " + this.cmdl.getClassname()
   + " with default permissions (exit forbidden)", 
Project.MSG_VERBOSE);
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Java.java

2005-02-04 Thread mbenson
mbenson 2005/02/04 07:38:19

  Modified:src/main/org/apache/tools/ant/taskdefs Java.java
  Log:
  Javadoc
  
  Revision  ChangesPath
  1.100 +115 -122  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.99
  retrieving revision 1.100
  diff -u -r1.99 -r1.100
  --- Java.java 2 Feb 2005 12:52:47 -   1.99
  +++ Java.java 4 Feb 2005 15:38:19 -   1.100
  @@ -72,10 +72,11 @@
   
   private boolean spawn = false;
   private boolean incompatibleWithSpawn = false;
  +
   /**
* Do the execution.
* @throws BuildException if failOnError is set to true and the 
application
  - * returns a non 0 result code
  + * returns a nonzero result code.
*/
   public void execute() throws BuildException {
   File savedDir = dir;
  @@ -104,14 +105,13 @@
* @return the return code from the execute java class if it was
* executed in a separate VM (fork = "yes").
*
  - * @throws BuildException if required parameters are missing
  + * @throws BuildException if required parameters are missing.
*/
   public int executeJava() throws BuildException {
   String classname = cmdl.getClassname();
   if (classname == null && cmdl.getJar() == null) {
   throw new BuildException("Classname must not be null.");
   }
  -
   if (!fork && cmdl.getJar() != null) {
   throw new BuildException("Cannot execute a jar in non-forked 
mode."
+ " Please set fork='true'. ");
  @@ -132,7 +132,6 @@
   if (cmdl.getAssertions() != null && !fork) {
   log("Assertion statements are currently ignored in non-forked 
mode");
   }
  -
   if (fork) {
   if (perm != null) {
   log("Permissions can not be set this way in forked mode.", 
Project.MSG_WARN);
  @@ -147,12 +146,10 @@
   log("Working directory ignored when same JVM is used.",
   Project.MSG_WARN);
   }
  -
   if (newEnvironment || null != env.getVariables()) {
   log("Changes to environment variables are ignored when same "
   + "JVM is used.", Project.MSG_WARN);
   }
  -
   if (cmdl.getBootclasspath() != null) {
   log("bootclasspath ignored when same JVM is used.",
   Project.MSG_WARN);
  @@ -165,7 +162,6 @@
   log("Running in same VM " + cmdl.describeJavaCommand(),
   Project.MSG_VERBOSE);
   }
  -
   setupRedirector();
   try {
   if (fork) {
  @@ -201,17 +197,17 @@
   }
   
   /**
  - * set whether or not you want the process to be spawned
  - * default is not spawned
  - * @param spawn if true you do not want ant to wait for the end of the 
process
  - * @since ant 1.6
  + * Set whether or not you want the process to be spawned;
  + * default is not spawned.
  + * @param spawn if true you do not want Ant to wait for the end of the 
process.
  + * @since Ant 1.6
*/
   public void setSpawn(boolean spawn) {
   this.spawn = spawn;
   }
   
   /**
  - * Set the classpath to be used when running the Java class
  + * Set the classpath to be used when running the Java class.
*
* @param s an Ant Path object containing the classpath.
*/
  @@ -220,51 +216,49 @@
   }
   
   /**
  - * Adds a path to the classpath.
  + * Add a path to the classpath.
*
  - * @return created classpath
  + * @return created classpath.
*/
   public Path createClasspath() {
   return cmdl.createClasspath(getProject()).createPath();
   }
   
   /**
  - * Adds a path to the bootclasspath.
  + * Add a path to the bootclasspath.
* @since Ant 1.6
*
  - * @return created bootclasspath
  + * @return created bootclasspath.
*/
   public Path createBootclasspath() {
   return cmdl.createBootclasspath(getProject()).createPath();
   }
   
   /**
  - * Sets the permissions for the application run inside the same JVM.
  + * Set the permissions for the application run inside the same JVM.
* @since Ant 1.6
  - * @return .
  + * @return Permissions.
*/
   public Permissions createPermissions() {
  -if (perm == null) {
  -perm = new Permissions();
  -}
  +perm = (perm == null) ? new Permissions() : perm;
   return perm;
   }
   
   /**
  - * Classpath to use, by reference.
  + * Set the classpath to use by reference.
*
  - * @param r a reference

cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Java.java

2005-01-28 Thread peterreilly
peterreilly2005/01/28 02:11:16

  Modified:src/main/org/apache/tools/ant/taskdefs Java.java
  Log:
  checkstyle
  
  Revision  ChangesPath
  1.98  +4 -3  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.97
  retrieving revision 1.98
  diff -u -r1.97 -r1.98
  --- Java.java 27 Jan 2005 16:36:11 -  1.97
  +++ Java.java 28 Jan 2005 10:11:16 -  1.98
  @@ -157,7 +157,7 @@
   log("bootclasspath ignored when same JVM is used.",
   Project.MSG_WARN);
   }
  -if (perm == null && failOnError == true) {
  +if (perm == null && failOnError) {
   perm = new Permissions(true);
   log("running " + this.cmdl.getClassname()
   + " with default permissions (exit forbidden)", 
Project.MSG_VERBOSE);
  @@ -309,7 +309,7 @@
* a bootclaspath.
*
* Doesn't have any effect unless fork is true.
  - *
  + * @param cloneVm if true copy system properties.
* @since Ant 1.7
*/
   public void setCloneVm(boolean cloneVm) {
  @@ -702,7 +702,8 @@
   }
   if (!spawn && input == null && inputString == null) {
   // #24918: send standard input to the process by default.
  -redirector.setInputStream(new 
KeepAliveInputStream(getProject().getDefaultInputStream()));
  +redirector.setInputStream(
  +new 
KeepAliveInputStream(getProject().getDefaultInputStream()));
   }
   }
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Java.java PumpStreamHandler.java Redirector.java StreamPumper.java

2005-01-27 Thread jglick
jglick  2005/01/27 08:36:11

  Modified:.WHATSNEW
   docs/manual/CoreTasks java.html
   src/main/org/apache/tools/ant/taskdefs Java.java
PumpStreamHandler.java Redirector.java
StreamPumper.java
  Log:
  Permit  to accept standard input from console.
  PR: 24918
  
  Revision  ChangesPath
  1.731 +4 -0  ant/WHATSNEW
  
  Index: WHATSNEW
  ===
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.730
  retrieving revision 1.731
  diff -u -r1.730 -r1.731
  --- WHATSNEW  27 Jan 2005 12:42:09 -  1.730
  +++ WHATSNEW  27 Jan 2005 16:36:11 -  1.731
  @@ -24,6 +24,10 @@
   Fixed bugs:
   ---
   
  +* Programs run with  can now accept standard input
  +  from the Ant console.  (Programs run with  could
  +  already do so.)  Bugzilla Report 24918.
  +
   * Translate task does not remove tokens when a key is not found.
 It logs a verbose message.  Bugzilla Report 13936.
   
  
  
  
  1.36  +7 -7  ant/docs/manual/CoreTasks/java.html
  
  Index: java.html
  ===
  RCS file: /home/cvs/ant/docs/manual/CoreTasks/java.html,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- java.html 10 Jan 2005 10:59:31 -  1.35
  +++ java.html 27 Jan 2005 16:36:11 -  1.36
  @@ -15,10 +15,9 @@
   If odd things go wrong when you run this task, set fork="true" to use a new
   JVM.
   
  -Note that you cannot interact with a forked VM, the only way to
  -send input to it is via the input and inputstring attributes. Also note that
  -in Ant 1.6, any attempt to read input in the forked VM will receive an
  -EOF (-1). This is a change from Ant 1.5, where such an attempt would 
block.
  +As of Ant 1.7, you can interact with a forked VM, as well as
  +sending input to it via the input and inputstring
  +attributes.
   
   Parameters
   
  @@ -157,14 +156,16 @@
   A file from which the executed command's standard input
is taken. This attribute is mutually exclusive with the
inputstring attribute
  -No
  +No; default is to take standard input 
from console
  +(unless spawn="true")
 
 
   inputstring
   A string which serves as the input stream for the
executed command. This attribute is mutually exclusive 
with the
input attribute.
  -No
  +No; default is to take standard input 
from console
  +(unless spawn="true")
 
 
   newenvironment
  @@ -353,4 +354,3 @@
   
   
   
  -
  
  
  
  1.97  +8 -6  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.96
  retrieving revision 1.97
  diff -u -r1.96 -r1.97
  --- Java.java 22 Nov 2004 09:23:27 -  1.96
  +++ Java.java 27 Jan 2005 16:36:11 -  1.97
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2000-2004 The Apache Software Foundation
  + * Copyright  2000-2005 The Apache Software Foundation
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
  @@ -37,6 +37,7 @@
   import org.apache.tools.ant.types.RedirectorElement;
   import org.apache.tools.ant.taskdefs.condition.Os;
   import org.apache.tools.ant.util.JavaEnvUtils;
  +import org.apache.tools.ant.util.KeepAliveInputStream;
   
   /**
* Launcher for Java applications. Allows use of
  @@ -639,11 +640,8 @@
*/
   public int handleInput(byte[] buffer, int offset, int length)
   throws IOException {
  -if (redirector.getInputStream() != null) {
  -return redirector.handleInput(buffer, offset, length);
  -} else {
  -return super.handleInput(buffer, offset, length);
  -}
  +// Should work whether or not redirector.inputStream == null:
  +return redirector.handleInput(buffer, offset, length);
   }
   
   /**
  @@ -702,6 +700,10 @@
   if (redirectorElement != null) {
   redirectorElement.configure(redirector);
   }
  +if (!spawn && input == null && inputString == null) {
  +// #24918: send standard input to the process by default.
  +redirector.setInputStream(new 
KeepAliveInputStream(getProject().getDefaultInputStream()));
  +}
   }
   
   /**
  
  
  
  1.21  +20 -10
ant/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java
  
  Index: PumpStreamHandler.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/PumpStream

cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Java.java

2004-10-08 Thread stevel
stevel  2004/10/08 02:34:41

  Modified:src/main/org/apache/tools/ant/taskdefs Java.java
  Log:
  accessors to command line are occasionally useful when working with java
  
  Revision  ChangesPath
  1.95  +20 -0 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.94
  retrieving revision 1.95
  diff -u -r1.94 -r1.95
  --- Java.java 6 Oct 2004 22:41:52 -   1.94
  +++ Java.java 8 Oct 2004 09:34:40 -   1.95
  @@ -906,4 +906,24 @@
   w.close();
   log(sw.toString(), Project.MSG_ERR);
   }
  +
  +/**
  + * accessor to the command line
  + *
  + * @return the current command line
  + * @since 1.7
  + */
  +public CommandlineJava getCommandLine() {
  +return cmdl;
  +}
  +
  +/**
  + * get the system properties of the command line
  + *
  + * @return the current properties of this java invocation
  + * @since 1.7
  + */
  +public CommandlineJava.SysProperties getSysProperties() {
  +return cmdl.getSystemProperties();
  +}
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Java.java

2004-03-29 Thread stevel
stevel  2004/03/29 09:02:13

  Modified:src/main/org/apache/tools/ant/taskdefs Java.java
  Log:
  I do not like the current process of marking incompatibility, as it is a dog 
to use from programmatic task access. We should validate immediatly before 
execution instead. This commit is not a fix, merely a partial workaround.
  
  Revision  ChangesPath
  1.90  +1 -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.89
  retrieving revision 1.90
  diff -u -r1.89 -r1.90
  --- Java.java 27 Mar 2004 21:22:58 -  1.89
  +++ Java.java 29 Mar 2004 17:02:13 -  1.90
  @@ -578,7 +578,7 @@
*/
   public void setTimeout(Long value) {
   timeout = value;
  -incompatibleWithSpawn = true;
  +incompatibleWithSpawn |= timeout!=null;
   }
   
   /**
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Java.java

2004-03-15 Thread bodewig
bodewig 2004/03/15 03:29:13

  Modified:.Tag: ANT_16_BRANCH WHATSNEW
   src/main/org/apache/tools/ant/taskdefs Tag: ANT_16_BRANCH
Java.java
  Log:
  merge
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.503.2.60 +3 -0  ant/WHATSNEW
  
  Index: WHATSNEW
  ===
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.503.2.59
  retrieving revision 1.503.2.60
  diff -u -r1.503.2.59 -r1.503.2.60
  --- WHATSNEW  12 Mar 2004 09:01:48 -  1.503.2.59
  +++ WHATSNEW  15 Mar 2004 11:29:13 -  1.503.2.60
  @@ -35,6 +35,9 @@
   
   * NPE when running commons listener. Bugzilla Report 27373.
   
  +*  swallowed the stack trace of exceptions thrown by the
  +  executed program if run in the same VM.
  +
   Other changes:
   --
   
  
  
  
  No   revision
  No   revision
  1.77.2.8  +74 -62ant/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.77.2.7
  retrieving revision 1.77.2.8
  diff -u -r1.77.2.7 -r1.77.2.8
  --- Java.java 9 Mar 2004 17:01:33 -   1.77.2.7
  +++ Java.java 15 Mar 2004 11:29:13 -  1.77.2.8
  @@ -19,6 +19,8 @@
   
   import java.io.File;
   import java.io.IOException;
  +import java.io.PrintWriter;
  +import java.io.StringWriter;
   import java.util.Vector;
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.ExitException;
  @@ -169,14 +171,14 @@
   if (failOnError) {
   throw e;
   } else {
  -log(e.getMessage(), Project.MSG_ERR);
  +log(e);
   return 0;
   }
   } catch (Throwable t) {
   if (failOnError) {
   throw new BuildException(t);
   } else {
  -log(t.getMessage(), Project.MSG_ERR);
  +log(t);
   return 0;
   }
   }
  @@ -667,41 +669,41 @@
*/
   private int fork(String[] command) throws BuildException {
   
  -Execute exe
  -= new Execute(redirector.createHandler(), createWatchdog());
  -exe.setAntRun(getProject());
  -
  -if (dir == null) {
  -dir = getProject().getBaseDir();
  -} else if (!dir.exists() || !dir.isDirectory()) {
  -throw new BuildException(dir.getAbsolutePath()
  - + " is not a valid directory",
  - getLocation());
  -}
  -
  -exe.setWorkingDirectory(dir);
  -
  -String[] environment = env.getVariables();
  -if (environment != null) {
  -for (int i = 0; i < environment.length; i++) {
  -log("Setting environment variable: " + environment[i],
  -Project.MSG_VERBOSE);
  -}
  +Execute exe
  += new Execute(redirector.createHandler(), createWatchdog());
  +exe.setAntRun(getProject());
  +
  +if (dir == null) {
  +dir = getProject().getBaseDir();
  +} else if (!dir.exists() || !dir.isDirectory()) {
  +throw new BuildException(dir.getAbsolutePath()
  + + " is not a valid directory",
  + getLocation());
  +}
  +
  +exe.setWorkingDirectory(dir);
  +
  +String[] environment = env.getVariables();
  +if (environment != null) {
  +for (int i = 0; i < environment.length; i++) {
  +log("Setting environment variable: " + environment[i],
  +Project.MSG_VERBOSE);
   }
  -exe.setNewenvironment(newEnvironment);
  -exe.setEnvironment(environment);
  +}
  +exe.setNewenvironment(newEnvironment);
  +exe.setEnvironment(environment);
   
  -exe.setCommandline(command);
  -try {
  -int rc = exe.execute();
  -redirector.complete();
  -if (exe.killedProcess()) {
  -throw new BuildException("Timeout: killed the 
sub-process");
  -}
  -return rc;
  -} catch (IOException e) {
  -throw new BuildException(e, getLocation());
  +exe.setCommandline(command);
  +try {
  +int rc = exe.execute();
  +redirector.complete();
  +if (exe.killedProcess()) {
  +throw new BuildException("Timeout: killed the sub-process");
   }
  +ret

cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Java.java

2004-03-15 Thread bodewig
bodewig 2004/03/15 03:27:04

  Modified:src/main/org/apache/tools/ant/taskdefs Java.java
  Log:
  White-space changes only
  
  Revision  ChangesPath
  1.88  +65 -65ant/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.87
  retrieving revision 1.88
  diff -u -r1.87 -r1.88
  --- Java.java 15 Mar 2004 11:23:48 -  1.87
  +++ Java.java 15 Mar 2004 11:27:04 -  1.88
  @@ -681,41 +681,41 @@
*/
   private int fork(String[] command) throws BuildException {
   
  -Execute exe
  -= new Execute(redirector.createHandler(), createWatchdog());
  -exe.setAntRun(getProject());
  -
  -if (dir == null) {
  -dir = getProject().getBaseDir();
  -} else if (!dir.exists() || !dir.isDirectory()) {
  -throw new BuildException(dir.getAbsolutePath()
  - + " is not a valid directory",
  - getLocation());
  -}
  -
  -exe.setWorkingDirectory(dir);
  -
  -String[] environment = env.getVariables();
  -if (environment != null) {
  -for (int i = 0; i < environment.length; i++) {
  -log("Setting environment variable: " + environment[i],
  -Project.MSG_VERBOSE);
  -}
  -}
  -exe.setNewenvironment(newEnvironment);
  -exe.setEnvironment(environment);
  -
  -exe.setCommandline(command);
  -try {
  -int rc = exe.execute();
  -redirector.complete();
  -if (exe.killedProcess()) {
  -throw new BuildException("Timeout: killed the 
sub-process");
  -}
  -return rc;
  -} catch (IOException e) {
  -throw new BuildException(e, getLocation());
  -}
  +Execute exe
  += new Execute(redirector.createHandler(), createWatchdog());
  +exe.setAntRun(getProject());
  +
  +if (dir == null) {
  +dir = getProject().getBaseDir();
  +} else if (!dir.exists() || !dir.isDirectory()) {
  +throw new BuildException(dir.getAbsolutePath()
  + + " is not a valid directory",
  + getLocation());
  +}
  +
  +exe.setWorkingDirectory(dir);
  +
  +String[] environment = env.getVariables();
  +if (environment != null) {
  +for (int i = 0; i < environment.length; i++) {
  +log("Setting environment variable: " + environment[i],
  +Project.MSG_VERBOSE);
  +}
  +}
  +exe.setNewenvironment(newEnvironment);
  +exe.setEnvironment(environment);
  +
  +exe.setCommandline(command);
  +try {
  +int rc = exe.execute();
  +redirector.complete();
  +if (exe.killedProcess()) {
  +throw new BuildException("Timeout: killed the sub-process");
  +}
  +return rc;
  +} catch (IOException e) {
  +throw new BuildException(e, getLocation());
  +}
   }
   
   /**
  @@ -723,36 +723,36 @@
*/
   private void spawn(String[] command) throws BuildException {
   
  -Execute exe
  -= new Execute();
  -exe.setAntRun(getProject());
  -
  -if (dir == null) {
  -dir = getProject().getBaseDir();
  -} else if (!dir.exists() || !dir.isDirectory()) {
  -throw new BuildException(dir.getAbsolutePath()
  - + " is not a valid directory",
  - getLocation());
  -}
  -
  -exe.setWorkingDirectory(dir);
  -
  -String[] environment = env.getVariables();
  -if (environment != null) {
  -for (int i = 0; i < environment.length; i++) {
  -log("Setting environment variable: " + environment[i],
  -Project.MSG_VERBOSE);
  -}
  -}
  -exe.setNewenvironment(newEnvironment);
  -exe.setEnvironment(environment);
  -
  -exe.setCommandline(command);
  -try {
  -exe.spawn();
  -} catch (IOException e) {
  -throw new BuildException(e, getLocation());
  -}
  +Execute exe
  += new Execute();
  +exe.setAntRun(getProject());
  +
  +if (dir == null) {
  +dir = getProject().getBaseDir()

cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Java.java

2004-02-25 Thread stevel
stevel  2004/02/25 06:38:51

  Modified:src/main/org/apache/tools/ant/taskdefs Java.java
  Log:
  nothing wrong with setFailOnError(false) and spawn.
  
  Revision  ChangesPath
  1.85  +1 -2  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.84
  retrieving revision 1.85
  diff -u -r1.84 -r1.85
  --- Java.java 9 Feb 2004 21:05:19 -   1.84
  +++ Java.java 25 Feb 2004 14:38:51 -  1.85
  @@ -405,9 +405,8 @@
*/
   public void setFailonerror(boolean fail) {
   failOnError = fail;
  -incompatibleWithSpawn = true;
  +incompatibleWithSpawn |= fail;
   }
  -
   /**
* The working directory of the process
*
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Java.java

2004-01-30 Thread bodewig
bodewig 2004/01/30 06:14:43

  Modified:src/main/org/apache/tools/ant/taskdefs Tag: ANT_16_BRANCH
Java.java
  Log:
  Merge from HEAD
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.77.2.3  +1 -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.77.2.2
  retrieving revision 1.77.2.3
  diff -u -r1.77.2.2 -r1.77.2.3
  --- Java.java 30 Jan 2004 13:59:43 -  1.77.2.2
  +++ Java.java 30 Jan 2004 14:14:43 -  1.77.2.3
  @@ -392,7 +392,7 @@
   }
   
   /**
  - * Set the command used to start the VM (only if not forking).
  + * Set the command used to start the VM (only if forking).
*
* @param s command to start the VM
*/
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Java.java

2004-01-30 Thread bodewig
bodewig 2004/01/30 06:14:21

  Modified:src/main/org/apache/tools/ant/taskdefs Java.java
  Log:
  fix wrong javadoc comment.
  
  PR: 25939
  Submitted by: Jesse Glick 
  
  Revision  ChangesPath
  1.81  +1 -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.80
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  --- Java.java 30 Jan 2004 13:58:58 -  1.80
  +++ Java.java 30 Jan 2004 14:14:21 -  1.81
  @@ -405,7 +405,7 @@
   }
   
   /**
  - * Set the command used to start the VM (only if not forking).
  + * Set the command used to start the VM (only if forking).
*
* @param s command to start the VM
*/
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Java.java

2004-01-30 Thread bodewig
bodewig 2004/01/30 05:59:43

  Modified:.Tag: ANT_16_BRANCH WHATSNEW
   src/main/org/apache/tools/ant/taskdefs Tag: ANT_16_BRANCH
Java.java
  Log:
  Merge from HEAD
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.503.2.32 +2 -0  ant/WHATSNEW
  
  Index: WHATSNEW
  ===
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.503.2.31
  retrieving revision 1.503.2.32
  diff -u -r1.503.2.31 -r1.503.2.32
  --- WHATSNEW  28 Jan 2004 23:15:45 -  1.503.2.31
  +++ WHATSNEW  30 Jan 2004 13:59:43 -  1.503.2.32
  @@ -23,6 +23,8 @@
   * fixed case handling of macrodef attributes and elements. Bugzilla
 Reports 25687 and 26225.
   
  +*  ignored the append attribute, Bugzilla Report 26137.
  +
   Other changes:
   --
   
  
  
  
  No   revision
  No   revision
  1.77.2.2  +2 -3  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.77.2.1
  retrieving revision 1.77.2.2
  diff -u -r1.77.2.1 -r1.77.2.2
  --- Java.java 27 Sep 2003 03:20:13 -  1.77.2.1
  +++ Java.java 30 Jan 2004 13:59:43 -  1.77.2.2
  @@ -1,7 +1,7 @@
   /*
* The Apache Software License, Version 1.1
*
  - * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
  + * Copyright (c) 2000-2004 The Apache Software Foundation.  All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
  @@ -93,7 +93,6 @@
   private boolean newEnvironment = false;
   private File dir = null;
   private boolean failOnError = false;
  -private boolean append = false;
   private Long timeout = null;
   private Redirector redirector = new Redirector(this);
   private String resultProperty;
  @@ -574,7 +573,7 @@
* @since Ant 1.5
*/
   public void setAppend(boolean append) {
  -this.append = append;
  +redirector.setAppend(append);
   incompatibleWithSpawn = true;
   }
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Java.java

2004-01-30 Thread bodewig
bodewig 2004/01/30 05:58:58

  Modified:.WHATSNEW
   src/main/org/apache/tools/ant/taskdefs Java.java
  Log:
   ignored the append attribute.
  
  PR: 26137
  Submitted by: Emmanuel Rayzal 
  
  Revision  ChangesPath
  1.533 +2 -0  ant/WHATSNEW
  
  Index: WHATSNEW
  ===
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.532
  retrieving revision 1.533
  diff -u -r1.532 -r1.533
  --- WHATSNEW  28 Jan 2004 22:47:14 -  1.532
  +++ WHATSNEW  30 Jan 2004 13:58:58 -  1.533
  @@ -26,6 +26,8 @@
   * fixed case handling of macrodef attributes and elements. Bugzilla
 Reports 25687 and 26225.
   
  +*  ignored the append attribute, Bugzilla Report 26137.
  +
   Other changes:
   --
   * Translate task logs a debug message specifying the number of files
  
  
  
  1.80  +2 -3  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.79
  retrieving revision 1.80
  diff -u -r1.79 -r1.80
  --- Java.java 12 Dec 2003 09:41:46 -  1.79
  +++ Java.java 30 Jan 2004 13:58:58 -  1.80
  @@ -1,7 +1,7 @@
   /*
* The Apache Software License, Version 1.1
*
  - * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
  + * Copyright (c) 2000-2004 The Apache Software Foundation.  All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
  @@ -93,7 +93,6 @@
   private boolean newEnvironment = false;
   private File dir = null;
   private boolean failOnError = false;
  -private boolean append = false;
   private Long timeout = null;
   private Redirector redirector = new Redirector(this);
   private String resultProperty;
  @@ -587,7 +586,7 @@
* @since Ant 1.5
*/
   public void setAppend(boolean append) {
  -this.append = append;
  +redirector.setAppend(append);
   incompatibleWithSpawn = true;
   }
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Java.java

2003-08-01 Thread stevel
stevel  2003/07/31 23:44:36

  Modified:src/main/org/apache/tools/ant/types Assertions.java
Commandline.java CommandlineJava.java
   src/main/org/apache/tools/ant/taskdefs Java.java
  Log:
  I always worry when I change something fundamental, and the amount of 
refactoring here to get assertions in 'cleanly' means the change here is larger 
than one would expect. The key problem is that the existing code created 
presized arrays, but sizing these arrays meant resolving every single option 
and counting the #of commands -effectively creating the command line twice. 
Once to size it, once to save the results. this was silly and unwieldy, though 
it made sense given how this command grew and grew.
  
  Most of the diff is changing CommandLine and CommmandLineJava to append their 
info to a supplied ListIterator, so that we dont need to create string arrays 
and keep on appending them. All the old stuff is still there, but used less 
-certainly not used at all by CommandLineJava.
  
  No assertion tests yet...
  
  Revision  ChangesPath
  1.5   +55 -1 ant/src/main/org/apache/tools/ant/types/Assertions.java
  
  Index: Assertions.java
  ===
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/Assertions.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Assertions.java   19 Jul 2003 08:11:07 -  1.4
  +++ Assertions.java   1 Aug 2003 06:44:35 -   1.5
  @@ -111,7 +111,7 @@
   /**
* list of type BaseAssertion
*/
  -private List assertionList = new ArrayList();
  +private ArrayList assertionList = new ArrayList();
   
   
   /**
  @@ -173,6 +173,47 @@
   }
   
   /**
  + * how many assertions are made...will resolve references before 
returning
  + * @return total # of commands to make
  + */
  +public int size() {
  +Assertions clause = getFinalReference();
  +return clause.getFinalSize();
  +}
  +
  +
  +/**
  + * what is the final size of this object
  + * @return
  + */
  +private int getFinalSize() {
  +return assertionList.size()+ (enableSystemAssertions!=null?1:0);
  +}
  +
  +/**
  + * add the assertions to a list in a format suitable
  + * for adding to a command line
  + * @param commandList
  + */
  +public void applyAssertions(List commandList) {
  +Assertions clause = getFinalReference();
  +//do the system assertions
  +if (Boolean.TRUE.equals(clause.enableSystemAssertions)) {
  +commandList.add("-enablesystemassertions");
  +} else if (Boolean.FALSE.equals(clause.enableSystemAssertions)) {
  +commandList.add("-disablesystemassertions");
  +}
  +
  +//now any inner assertions
  +Iterator it = clause.assertionList.iterator();
  +while (it.hasNext()) {
  +BaseAssertion assertion = (BaseAssertion) it.next();
  +String arg = assertion.toCommand();
  +commandList.add(arg);
  +}
  +}
  +
  +/**
* apply all the assertions to the command.
* @param command
*/
  @@ -203,6 +244,19 @@
   Commandline.Argument argument;
   argument = command.createVmArgument();
   argument.setValue(arg);
  +}
  +
  +/**
  + * clone the objects.
  + * This is not a full depth clone; the list of assertions is cloned,
  + * but it does not clone the underlying assertions.
  + * @return a cli
  + * @throws CloneNotSupportedException
  + */
  +protected Object clone() throws CloneNotSupportedException {
  +Assertions that=(Assertions) super.clone();
  +that.assertionList=(ArrayList) assertionList.clone();
  + return that;
   }
   
   /**
  
  
  
  1.31  +93 -25ant/src/main/org/apache/tools/ant/types/Commandline.java
  
  Index: Commandline.java
  ===
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/Commandline.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- Commandline.java  19 Jul 2003 08:11:07 -  1.30
  +++ Commandline.java  1 Aug 2003 06:44:36 -   1.31
  @@ -57,6 +57,11 @@
   import java.io.File;
   import java.util.StringTokenizer;
   import java.util.Vector;
  +import java.util.ArrayList;
  +import java.util.List;
  +import java.util.ListIterator;
  +import java.util.LinkedList;
  +
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.ProjectComponent;
   import org.apache.tools.ant.util.StringUtils;
  @@ -86,7 +91,14 @@
*/
   public class Commandline implements Cloneable {
   
  +/**
  + * The arguments of the command
  + */
   private Vector arguments = new Vector();
  +
  +/**

Re: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Java.java

2003-07-28 Thread Antoine Levy-Lambert
- Original Message - 
From: "Steve Loughran" <[EMAIL PROTECTED]>
Sent: Monday, July 28, 2003 10:01 PM

> Can I take out an optimistic lock on CommandLineJava and 
> commandline.java for the next few days.
> 

No problem with me.

Cheers,

Antoine

Cheers,

Antoine


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Java.java

2003-07-28 Thread Steve Loughran
[EMAIL PROTECTED] wrote:
antoine 2003/07/28 10:59:28
  Modified:src/main/org/apache/tools/ant/taskdefs Java.java
  Log:
  style
  
  Revision  ChangesPath
  1.66  +97 -0 ant/src/main/org/apache/tools/ant/taskdefs/Java.java
  
  Index: Java.java
oh, that reminds me:
Can I take out an optimistic lock on CommandLineJava and 
commandline.java for the next few days.

I've been adding the  facility, but have ended up doing more 
refactoring than planned, on account of I am eliminating all the 
String[] array stuff and working with lists right up until the end. 
String[] may appear higher performance, but with the size() operators 
all triggering evaluation and each subcomponent calling size() before 
creating the subsidiary String[] array, we are doing about 4x the amount 
of work we need. adding command to a list is a lot easier...

Anyhows, I will check everything with with checkstyle cleanup once it is 
 running through all the tests and regressing against my own apps.

-steve


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Java.java

2003-07-28 Thread antoine
antoine 2003/07/28 10:59:28

  Modified:src/main/org/apache/tools/ant/taskdefs Java.java
  Log:
  style
  
  Revision  ChangesPath
  1.66  +97 -0 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.65
  retrieving revision 1.66
  diff -u -r1.65 -r1.66
  --- Java.java 25 Jul 2003 12:14:42 -  1.65
  +++ Java.java 28 Jul 2003 17:59:28 -  1.66
  @@ -96,6 +96,8 @@
   private String resultProperty;
   /**
* Do the execution.
  + * @throws BuildException if failOnError is set to true and the 
application
  + * returns a non 0 result code
*/
   public void execute() throws BuildException {
   File savedDir = dir;
  @@ -121,6 +123,8 @@
*
* @return the return code from the execute java class if it was
* executed in a separate VM (fork = "yes").
  + *
  + * @throws BuildException if required parameters are missing
*/
   public int executeJava() throws BuildException {
   String classname = cmdl.getClassname();
  @@ -198,6 +202,8 @@
   
   /**
* Adds a path to the classpath.
  + *
  + * @return created classpath
*/
   public Path createClasspath() {
   return cmdl.createClasspath(getProject()).createPath();
  @@ -206,6 +212,8 @@
   /**
* Adds a path to the bootclasspath.
* @since Ant 1.6
  + *
  + * @return created bootclasspath
*/
   public Path createBootclasspath() {
   return cmdl.createBootclasspath(getProject()).createPath();
  @@ -213,6 +221,8 @@
   
   /**
* Classpath to use, by reference.
  + *
  + * @param r a reference to an existing classpath
*/
   public void setClasspathRef(Reference r) {
   createClasspath().setRefid(r);
  @@ -220,6 +230,10 @@
   
   /**
* The location of the JAR file to execute.
  + *
  + * @param jarfile the jarfile that one wants to execute
  + *
  + * @throws BuildException if there is also a main class specified
*/
   public void setJar(File jarfile) throws BuildException {
   if (cmdl.getClassname() != null) {
  @@ -231,6 +245,10 @@
   
   /**
* Sets the Java class to execute.
  + *
  + * @param s the name of the main class
  + *
  + * @throws BuildException if the jar attribute has been set
*/
   public void setClassname(String s) throws BuildException {
   if (cmdl.getJar() != null) {
  @@ -243,6 +261,9 @@
   /**
* Deprecated: use nested arg instead.
* Set the command line arguments for the class.
  + *
  + * @param s arguments
  + *
* @ant.attribute ignore="true"
*/
   public void setArgs(String s) {
  @@ -253,6 +274,8 @@
   
   /**
* Adds a command-line argument.
  + *
  + * @return created argument
*/
   public Commandline.Argument createArg() {
   return cmdl.createArgument();
  @@ -262,6 +285,8 @@
* The name of a property in which the return code of the
* command should be stored. Only of interest if failonerror=false.
*
  + * @param resultProperty name of property
  + *
* @since Ant 1.6
*/
   public void setResultProperty(String resultProperty) {
  @@ -271,6 +296,8 @@
   /**
* helper method to set result property to the
* passed in value if appropriate
  + *
  + * @param result the exit code
*/
   protected void maybeSetResultPropertyValue(int result) {
   String res = Integer.toString(result);
  @@ -281,6 +308,8 @@
   
   /**
* If true, execute in a new VM.
  + *
  + * @param s do you want to run Java in a new VM.
*/
   public void setFork(boolean s) {
   this.fork = s;
  @@ -288,6 +317,8 @@
   
   /**
* Set the command line arguments for the JVM.
  + *
  + * @param s jvmargs
*/
   public void setJvmargs(String s) {
   log("The jvmargs attribute is deprecated. "
  @@ -297,6 +328,8 @@
   
   /**
* Adds a JVM argument.
  + *
  + * @return JVM argument created
*/
   public Commandline.Argument createJvmarg() {
   return cmdl.createVmArgument();
  @@ -304,6 +337,8 @@
   
   /**
* Set the command used to start the VM (only if not forking).
  + *
  + * @param s command to start the VM
*/
   public void setJvm(String s) {
   cmdl.setVm(s);
  @@ -311,6 +346,8 @@
   
   /**
* Adds a system property.
  + *
  + * @param sysp system property
*/
   public void addSysproperty(Environment.Variable sysp) {
   cmdl.addSysproperty(sysp);
  @@ -319,6 +356,8 @@