rubys       00/01/13 18:13:20

  Modified:    src/main/org/apache/tools/ant/taskdefs Echo.java Expand.java
                        Get.java Property.java Taskdef.java
  Log:
  Misc doc, scoping, style and error recovery issues
  Submitted by: Kare Nuorteva <[EMAIL PROTECTED]>
  
  Revision  Changes    Path
  1.2       +13 -3     
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Echo.java
  
  Index: Echo.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Echo.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Echo.java 2000/01/13 10:41:41     1.1
  +++ Echo.java 2000/01/14 02:13:19     1.2
  @@ -63,13 +63,23 @@
    * @author [EMAIL PROTECTED]
    */
   public class Echo extends Task {
  -    String message; // required
  +    private String message; // required
       
  +    /**
  +     * Does the work.
  +     *
  +     * @exception BuildException if someting goes wrong with the build
  +     */
       public void execute() throws BuildException {
        System.out.println(message);
       }
   
  -    public void setMessage(String d) {
  -     this.message=d;
  +    /**
  +     * Sets the message variable.
  +     *
  +     * @param msg Sets the value for the message variable.
  +     */
  +    public void setMessage(String msg) {
  +     this.message = msg;
       }
   }
  
  
  
  1.2       +18 -2     
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Expand.java
  
  Index: Expand.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Expand.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Expand.java       2000/01/13 10:41:41     1.1
  +++ Expand.java       2000/01/14 02:13:19     1.2
  @@ -63,9 +63,14 @@
    * @author [EMAIL PROTECTED]
    */
   public class Expand extends Task {
  -    String dest; // req
  -    String source; // req
  +    private String dest; // req
  +    private String source; // req
       
  +    /**
  +     * Do the work.
  +     *
  +     * @exception BuildException Thrown in unrecoverable error.
  +     */
       // XXX move it to util or tools
       public void execute() throws BuildException {
        try {
  @@ -108,10 +113,21 @@
        }
       }
   
  +    /**
  +     * Set the destination directory. File will be unzipped into the
  +     * destination directory.
  +     *
  +     * @param d Path to the directory.
  +     */
       public void setDest(String d) {
        this.dest=d;
       }
   
  +    /**
  +     * Set the path to zip-file.
  +     *
  +     * @param s Path to zip-file.
  +     */
       public void setSrc(String s) {
        this.source = s;
       }
  
  
  
  1.2       +34 -7     
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Get.java
  
  Index: Get.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Get.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Get.java  2000/01/13 10:41:41     1.1
  +++ Get.java  2000/01/14 02:13:19     1.2
  @@ -63,24 +63,36 @@
    * @author [EMAIL PROTECTED]
    */
   public class Get extends Task {
  -    String source; // required
  -    String dest; // required
  -    String verbose;
  +    private String source; // required
  +    private String dest; // required
  +    private String verbose = "";
       
  +    /**
  +     * Does the work.
  +     *
  +     * @exception BuildException Thrown in unrecovrable error.
  +     */
       public void execute() throws BuildException {
        try {
  -         URL url=new URL( source );
  +            URL url = null;
  +            try {
  +                url = new URL(source);
  +            } catch (MalformedURLException e) {
  +                throw new BuildException(e.toString());
  +            }
  +
            project.log("Getting: " + source);
  +
            File destF=new File(dest);
            FileOutputStream fos = new FileOutputStream(destF);
   
  -         InputStream is=url.openStream();
  +         InputStream is = url.openStream();
            byte[] buffer = new byte[100 * 1024];
            int length;
            
            while ((length = is.read(buffer)) >= 0) {
                fos.write(buffer, 0, length);
  -             if( "true".equals(verbose)) System.out.print(".");
  +             if ("true".equals(verbose)) System.out.print(".");
            }
            if( "true".equals(verbose)) System.out.println();
            fos.close();
  @@ -91,15 +103,30 @@
        }
       }
   
  +    /**
  +     * Set the URL.
  +     *
  +     * @param d URL for the file.
  +     */
       public void setSrc(String d) {
        this.source=d;
       }
   
  +    /**
  +     * Where to copy the source file.
  +     *
  +     * @param dest Path to file.
  +     */
       public void setDest(String dest) {
        this.dest = dest;
       }
   
  +    /**
  +     * Be verbose, if set to "<CODE>true</CODE>".
  +     *
  +     * @param v if "true" then be verbose
  +     */
       public void setVerbose(String v) {
  -     verbose=v;
  +     verbose = v;
       }
   }
  
  
  
  1.2       +12 -7     
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Property.java
  
  Index: Property.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Property.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Property.java     2000/01/13 10:41:41     1.1
  +++ Property.java     2000/01/14 02:13:19     1.2
  @@ -63,18 +63,23 @@
    * @author [EMAIL PROTECTED]
    */
   public class Property extends Task {
  -    String name;
  -    String value;
  -    String file;
  -    String resource;
  +    private String name;
  +    private String value;
  +    private String file;
  +    private String resource;
   
  -    // needs to be set at XML-reading time,
  -    // no runtime action
  +    /**
  +     * Needs to be set at XML-reading time,
  +     * no runtime action.
  +     *
  +     * @exception BuildException Thrown in unrecoverable error.
  +     */
       public void execute() throws BuildException {
       }
   
       // XXX ugly - needs to be fixed
  -    /** Called after each setter, will set the property at read-time
  +    /**
  +     * Called after each setter, will set the property at read-time
        */
       private void initTimeSetProperty()  {
        try {
  
  
  
  1.2       +5 -6      
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Taskdef.java
  
  Index: Taskdef.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Taskdef.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Taskdef.java      2000/01/13 10:41:41     1.1
  +++ Taskdef.java      2000/01/14 02:13:19     1.2
  @@ -55,16 +55,15 @@
   package org.apache.tools.ant.taskdefs;
   
   import org.apache.tools.ant.*;
  -import java.io.*;
  -import java.util.*;
  +
   /**
    * Define a new task - name and class
    *
    * @author [EMAIL PROTECTED]
    */
   public class Taskdef extends Task {
  -    String name;
  -    String value;
  +    private String name;
  +    private String value;
       
       public void execute() throws BuildException {
        try {
  @@ -87,10 +86,10 @@
       }
   
       public void setName( String name) {
  -     this.name=name;
  +     this.name = name;
       }
   
       public void setClass(String v) {
  -     value=v;
  +     value = v;
       }
   }
  
  
  

Reply via email to