You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by an...@apache.org on 2003/07/28 19:59:28 UTC

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

antoine     2003/07/28 10:59:28

  Modified:    src/main/org/apache/tools/ant/taskdefs Java.java
  Log:
  style
  
  Revision  Changes    Path
  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 -0000	1.65
  +++ Java.java	28 Jul 2003 17:59:28 -0000	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 @@
       /**
        * Adds a set of properties as system properties.
        *
  +     * @param sysp set of properties to add
  +     *
        * @since Ant 1.6
        */
       public void addSyspropertyset(PropertySet sysp) {
  @@ -328,6 +367,9 @@
       /**
        * If true, then fail if the command exits with a
        * returncode other than 0
  +     *
  +     * @param fail if true fail the build when the command exits with a non
  +     * zero returncode
        */
       public void setFailonerror(boolean fail) {
           failOnError = fail;
  @@ -335,6 +377,9 @@
   
       /**
        * The working directory of the process
  +     *
  +     * @param d working directory
  +     *
        */
       public void setDir(File d) {
           this.dir = d;
  @@ -342,6 +387,8 @@
   
       /**
        * File the output of the process is redirected to.
  +     *
  +     * @param out name of the output file
        */
       public void setOutput(File out) {
           redirector.setOutput(out);
  @@ -349,6 +396,8 @@
   
       /**
        * Set the input to use for the task
  +     *
  +     * @param input name of the input file
        */
       public void setInput(File input) {
           redirector.setInput(input);
  @@ -367,6 +416,9 @@
        * Controls whether error output of exec is logged. This is only useful
        * when output is being redirected and error output is desired in the
        * Ant log
  +     *
  +     * @param logError get in the ant log the messages coming from stderr
  +     * in the case that fork = true
        */
       public void setLogError(boolean logError) {
           redirector.setLogError(logError);
  @@ -375,6 +427,8 @@
       /**
        * File the error stream of the process is redirected to.
        *
  +     * @param error file getting the error stream
  +     *
        * @since ant 1.6
        */
       public void setError(File error) {
  @@ -384,6 +438,9 @@
       /**
        * Property name whose value should be set to the output of
        * the process.
  +     *
  +     * @param outputProp property name
  +     *
        */
       public void setOutputproperty(String outputProp) {
           redirector.setOutputProperty(outputProp);
  @@ -393,6 +450,8 @@
        * Property name whose value should be set to the error of
        * the process.
        *
  +     * @param errorProperty property name
  +     *
        * @since ant 1.6
        */
       public void setErrorProperty(String errorProperty) {
  @@ -401,6 +460,8 @@
   
       /**
        * Corresponds to -mx or -Xmx depending on VM version.
  +     *
  +     * @param max max memory parameter
        */
       public void setMaxmemory(String max) {
           cmdl.setMaxmemory(max);
  @@ -419,6 +480,8 @@
        *
        * <p>Will be ignored if we are not forking a new VM.
        *
  +     * @param var new environment variable
  +     *
        * @since Ant 1.5
        */
       public void addEnv(Environment.Variable var) {
  @@ -430,6 +493,8 @@
        *
        * <p>Will be ignored if we are not forking a new VM.
        *
  +     * @param newenv if true, use a completely new environment.
  +     *
        * @since Ant 1.5
        */
       public void setNewenvironment(boolean newenv) {
  @@ -439,6 +504,8 @@
       /**
        * If true, append output to existing file.
        *
  +     * @param append if true, append output to existing file
  +     *
        * @since Ant 1.5
        */
       public void setAppend(boolean append) {
  @@ -448,6 +515,8 @@
       /**
        * Timeout in milliseconds after which the process will be killed.
        *
  +     * @param value time out in milliseconds
  +     *
        * @since Ant 1.5
        */
       public void setTimeout(Long value) {
  @@ -457,6 +526,8 @@
       /**
        * Pass output sent to System.out to specified output file.
        *
  +     * @param output a string of output on its way to the handlers
  +     *
        * @since Ant 1.5
        */
       protected void handleOutput(String output) {
  @@ -467,6 +538,18 @@
           }
       }
   
  +    /**
  +     * Handle an input request by this task
  +     *
  +     * @param buffer the buffer into which data is to be read.
  +     * @param offset the offset into the buffer at which data is stored.
  +     * @param length the amount of data to read
  +     *
  +     * @return the number of bytes read
  +     *
  +     * @exception IOException if the data cannot be read
  +     * @since Ant 1.6
  +     */
       public int handleInput(byte[] buffer, int offset, int length)
           throws IOException {
           if (redirector.getInputStream() != null) {
  @@ -479,6 +562,8 @@
       /**
        * Pass output sent to System.out to specified output file.
        *
  +     * @param output string of output on its way to its handlers
  +     *
        * @since Ant 1.5.2
        */
       protected void handleFlush(String output) {
  @@ -492,6 +577,8 @@
       /**
        * Pass output sent to System.err to specified output file.
        *
  +     * @param output string of stderr
  +     *
        * @since Ant 1.5
        */
       protected void handleErrorOutput(String output) {
  @@ -505,6 +592,8 @@
       /**
        * Pass output sent to System.err to specified output file.
        *
  +     * @param output string of stderr
  +     *
        * @since Ant 1.5.2
        */
       protected void handleErrorFlush(String output) {
  @@ -579,6 +668,10 @@
       /**
        * Executes the given classname with the given arguments as it
        * was a command line application.
  +     *
  +     * @param classname the name of the class to run
  +     * @param args  arguments for the class
  +     * @throws BuildException in case of IO Exception in the execution
        */
       protected void run(String classname, Vector args) throws BuildException {
           CommandlineJava cmdj = new CommandlineJava();
  @@ -598,6 +691,10 @@
   
       /**
        * Create the Watchdog to kill a runaway process.
  +     *
  +     * @return new watchdog
  +     *
  +     * @throws BuildException under unknown circumnstances
        *
        * @since Ant 1.5
        */
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


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

Posted by Antoine Levy-Lambert <an...@antbuild.com>.
----- Original Message ----- 
From: "Steve Loughran" <st...@iseran.com>
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: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


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

Posted by Steve Loughran <st...@iseran.com>.
antoine@apache.org wrote:

> antoine     2003/07/28 10:59:28
> 
>   Modified:    src/main/org/apache/tools/ant/taskdefs Java.java
>   Log:
>   style
>   
>   Revision  Changes    Path
>   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 <assertion> 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: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org