diff --git a/src/main/org/apache/tools/ant/taskdefs/Echo.java b/src/main/org/apache/tools/ant/taskdefs/Echo.java index 6c0cf6c38..6f64b4630 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Echo.java +++ b/src/main/org/apache/tools/ant/taskdefs/Echo.java @@ -63,13 +63,23 @@ import java.net.*; * @author costin@dnt.ro */ 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; } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Expand.java b/src/main/org/apache/tools/ant/taskdefs/Expand.java index 51fe4b2b8..b354ce9aa 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Expand.java +++ b/src/main/org/apache/tools/ant/taskdefs/Expand.java @@ -63,9 +63,14 @@ import java.util.zip.*; * @author costin@dnt.ro */ 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 @@ public class Expand extends Task { } } + /** + * 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; } diff --git a/src/main/org/apache/tools/ant/taskdefs/Get.java b/src/main/org/apache/tools/ant/taskdefs/Get.java index 0a53b75a6..5a20bb2cc 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Get.java +++ b/src/main/org/apache/tools/ant/taskdefs/Get.java @@ -63,24 +63,36 @@ import java.net.*; * @author costin@dnt.ro */ 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 @@ public class Get extends Task { } } + /** + * 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 "true". + * + * @param v if "true" then be verbose + */ public void setVerbose(String v) { - verbose=v; + verbose = v; } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Property.java b/src/main/org/apache/tools/ant/taskdefs/Property.java index 357b8dff7..134addb55 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Property.java +++ b/src/main/org/apache/tools/ant/taskdefs/Property.java @@ -63,18 +63,23 @@ import java.util.*; * @author costin@dnt.ro */ 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 { diff --git a/src/main/org/apache/tools/ant/taskdefs/Taskdef.java b/src/main/org/apache/tools/ant/taskdefs/Taskdef.java index ad51bd812..d338bfcec 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Taskdef.java +++ b/src/main/org/apache/tools/ant/taskdefs/Taskdef.java @@ -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 costin@dnt.ro */ 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 class Taskdef extends Task { } public void setName( String name) { - this.name=name; + this.name = name; } public void setClass(String v) { - value=v; + value = v; } }