umagesh 01/12/28 12:27:43
Modified: src/main/org/apache/tools/ant/taskdefs Expand.java
Log:
1. setSrc(File) deprecated and replaced with setSrc(SrcFile)
2. setDest(File) deprecated and replaced with setDest(DestDir)
Revision Changes Path
1.21 +37 -13
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.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- Expand.java 2001/12/14 14:51:34 1.20
+++ Expand.java 2001/12/28 20:27:43 1.21
@@ -57,8 +57,10 @@
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.DestDir;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.PatternSet;
+import org.apache.tools.ant.types.SrcFile;
import org.apache.tools.ant.util.FileUtils;
import java.io.File;
import java.io.FileInputStream;
@@ -76,7 +78,7 @@
*
* @author [EMAIL PROTECTED]
* @author <a href="mailto:[EMAIL PROTECTED]">Stefan Bodewig</a>
- * @author <a href="mailto:[EMAIL PROTECTED]">Magesh Umasankar</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Magesh Umasankar</a>
*/
public class Expand extends MatchingTask {
private File dest; //req
@@ -104,19 +106,10 @@
"Dest attribute must be specified");
}
- if (dest.exists() && !dest.isDirectory()) {
- throw new BuildException("Dest must be a directory.", location);
- }
-
FileUtils fileUtils = FileUtils.newFileUtils();
if (source != null) {
- if (source.isDirectory()) {
- throw new BuildException("Src must not be a directory." +
- " Use nested filesets instead.", location);
- } else {
- expandFile(fileUtils, source, dest);
- }
+ expandFile(fileUtils, source, dest);
}
if (filesets.size() > 0) {
for (int j=0; j < filesets.size(); j++) {
@@ -253,18 +246,49 @@
* destination directory.
*
* @param d Path to the directory.
+ * @deprecated setDest(File) is deprecated and is replaced with
+ * setDest(DestDir) to let Ant's core perform validation
*/
public void setDest(File d) {
- this.dest=d;
+ log("DEPRECATED - The setDest(File) method has been deprecated."
+ + " Use setDest(DestDir) instead.");
+ DestDir dd = new DestDir();
+ dd.setFile(d);
+ setDest(dd);
}
/**
+ * Set the destination directory. File will be unzipped into the
+ * destination directory.
+ *
+ * @param d Path to the directory.
+ */
+ public void setDest(DestDir d) {
+ this.dest=d.getFile();
+ }
+
+ /**
* Set the path to zip-file.
*
* @param s Path to zip-file.
+ * @deprecated setSrc(File) is deprecated and is replaced with
+ * setSrc(SrcFile) to let Ant's core perform validation
*/
public void setSrc(File s) {
- this.source = s;
+ log("DEPRECATED - The setSrc(File) method has been deprecated."
+ + " Use setSrc(SrcFile) instead.");
+ SrcFile sf = new SrcFile();
+ sf.setFile(s);
+ setSrc(sf);
+ }
+
+ /**
+ * Set the path to zip-file.
+ *
+ * @param s Path to zip-file.
+ */
+ public void setSrc(SrcFile s) {
+ this.source = s.getFile();
}
/**
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>