bodewig 02/04/11 02:19:06
Modified: src/main/org/apache/tools/ant/taskdefs Copydir.java
Copyfile.java
Log:
reset state in <copydir>, cleanup
Revision Changes Path
1.21 +29 -21
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Copydir.java
Index: Copydir.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Copydir.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- Copydir.java 10 Jan 2002 13:59:31 -0000 1.20
+++ Copydir.java 11 Apr 2002 09:19:06 -0000 1.21
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * Copyright (c) 2000,2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -60,13 +60,16 @@
import java.util.Enumeration;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Project;
/**
* Copies a directory.
*
* @author James Davidson <a href="mailto:[EMAIL PROTECTED]">[EMAIL
PROTECTED]</a>
*
- * @deprecated The copydir task is deprecated. Use copy instead.
+ * @since Ant 1.1
+ *
+ * @deprecated The copydir task is deprecated since Ant 1.2. Use copy
instead.
*/
public class Copydir extends MatchingTask {
@@ -112,34 +115,39 @@
}
if (destDir == null) {
- throw new BuildException("The dest attribute must be set.",
location);
+ throw new BuildException("The dest attribute must be set.",
+ location);
}
if (srcDir.equals(destDir)) {
- log("Warning: src == dest");
+ log("Warning: src == dest", Project.MSG_WARN);
}
DirectoryScanner ds = super.getDirectoryScanner(srcDir);
- String[] files = ds.getIncludedFiles();
- scanDir(srcDir, destDir, files);
- if (filecopyList.size() > 0) {
- log("Copying " + filecopyList.size() + " file"
- + (filecopyList.size() == 1 ? "" : "s")
- + " to " + destDir.getAbsolutePath());
- Enumeration enum = filecopyList.keys();
- while (enum.hasMoreElements()) {
- String fromFile = (String) enum.nextElement();
- String toFile = (String) filecopyList.get(fromFile);
- try {
- project.copyFile(fromFile, toFile, filtering,
- forceOverwrite);
- } catch (IOException ioe) {
- String msg = "Failed to copy " + fromFile + " to " +
toFile
- + " due to " + ioe.getMessage();
- throw new BuildException(msg, ioe, location);
+ try {
+ String[] files = ds.getIncludedFiles();
+ scanDir(srcDir, destDir, files);
+ if (filecopyList.size() > 0) {
+ log("Copying " + filecopyList.size() + " file"
+ + (filecopyList.size() == 1 ? "" : "s")
+ + " to " + destDir.getAbsolutePath());
+ Enumeration enum = filecopyList.keys();
+ while (enum.hasMoreElements()) {
+ String fromFile = (String) enum.nextElement();
+ String toFile = (String) filecopyList.get(fromFile);
+ try {
+ project.copyFile(fromFile, toFile, filtering,
+ forceOverwrite);
+ } catch (IOException ioe) {
+ String msg = "Failed to copy " + fromFile + " to "
+ + toFile + " due to " + ioe.getMessage();
+ throw new BuildException(msg, ioe, location);
+ }
}
}
+ } finally {
+ filecopyList.clear();
}
}
1.13 +12 -6
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Copyfile.java
Index: Copyfile.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Copyfile.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- Copyfile.java 10 Jan 2002 13:59:31 -0000 1.12
+++ Copyfile.java 11 Apr 2002 09:19:06 -0000 1.13
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * Copyright (c) 2000,2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -66,7 +66,10 @@
*
* @author [EMAIL PROTECTED]
*
- * @deprecated The copyfile task is deprecated. Use copy instead.
+ * @since Ant 1.1
+ *
+ * @deprecated The copyfile task is deprecated since Ant 1.2. Use
+ * copy instead.
*/
public class Copyfile extends Task {
@@ -96,7 +99,8 @@
log("DEPRECATED - The copyfile task is deprecated. Use copy
instead.");
if (srcFile == null) {
- throw new BuildException("The src attribute must be present.",
location);
+ throw new BuildException("The src attribute must be present.",
+ location);
}
if (!srcFile.exists()) {
@@ -105,14 +109,16 @@
}
if (destFile == null) {
- throw new BuildException("The dest attribute must be present.",
location);
+ throw new BuildException("The dest attribute must be present.",
+ location);
}
if (srcFile.equals(destFile)) {
- log("Warning: src == dest");
+ log("Warning: src == dest", Project.MSG_WARN);
}
- if (forceOverwrite || srcFile.lastModified() >
destFile.lastModified()) {
+ if (forceOverwrite
+ || srcFile.lastModified() > destFile.lastModified()) {
try {
project.copyFile(srcFile, destFile, filtering,
forceOverwrite);
} catch (IOException ioe) {
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>