git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275490 13f79535-47bb-0310-9956-ffa450edef68master
@@ -404,6 +404,7 @@ public class FixCRLF extends MatchingTask { | |||||
// Set up the output Writer | // Set up the output Writer | ||||
try { | try { | ||||
tmpFile = fileUtils.createTempFile("fixcrlf", "", null); | tmpFile = fileUtils.createTempFile("fixcrlf", "", null); | ||||
tmpFile.deleteOnExit(); | |||||
Writer writer = (encoding == null) ? new FileWriter(tmpFile) | Writer writer = (encoding == null) ? new FileWriter(tmpFile) | ||||
: new OutputStreamWriter(new FileOutputStream(tmpFile), | : new OutputStreamWriter(new FileOutputStream(tmpFile), | ||||
encoding); | encoding); | ||||
@@ -1919,6 +1919,7 @@ public class Javadoc extends Task { | |||||
if (useExternalFile) { | if (useExternalFile) { | ||||
if (tmpList == null) { | if (tmpList == null) { | ||||
tmpList = fileUtils.createTempFile("javadoc", "", null); | tmpList = fileUtils.createTempFile("javadoc", "", null); | ||||
tmpList.deleteOnExit(); | |||||
toExecute.createArgument() | toExecute.createArgument() | ||||
.setValue("@" + tmpList.getAbsolutePath()); | .setValue("@" + tmpList.getAbsolutePath()); | ||||
} | } | ||||
@@ -399,6 +399,7 @@ public class Replace extends MatchingTask { | |||||
File temp = fileUtils.createTempFile("rep", ".tmp", | File temp = fileUtils.createTempFile("rep", ".tmp", | ||||
fileUtils.getParentFile(src)); | fileUtils.getParentFile(src)); | ||||
temp.deleteOnExit(); | |||||
Reader reader = null; | Reader reader = null; | ||||
Writer writer = null; | Writer writer = null; | ||||
@@ -416,6 +416,7 @@ public class Zip extends MatchingTask { | |||||
renamedFile = | renamedFile = | ||||
fileUtils.createTempFile("zip", ".tmp", | fileUtils.createTempFile("zip", ".tmp", | ||||
fileUtils.getParentFile(zipFile)); | fileUtils.getParentFile(zipFile)); | ||||
renamedFile.deleteOnExit(); | |||||
try { | try { | ||||
fileUtils.rename(zipFile, renamedFile); | fileUtils.rename(zipFile, renamedFile); | ||||
@@ -445,6 +445,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||||
userDir = new File(userDirName); | userDir = new File(userDirName); | ||||
} | } | ||||
tmpFile = fileUtils.createTempFile("files", "", userDir); | tmpFile = fileUtils.createTempFile("files", "", userDir); | ||||
tmpFile.deleteOnExit(); | |||||
out = new PrintWriter(new FileWriter(tmpFile)); | out = new PrintWriter(new FileWriter(tmpFile)); | ||||
for (int i = firstFileName; i < args.length; i++) { | for (int i = firstFileName; i < args.length; i++) { | ||||
if (quoteFiles && args[i].indexOf(" ") > -1) { | if (quoteFiles && args[i].indexOf(" ") > -1) { | ||||
@@ -245,6 +245,7 @@ public class CvsTagDiff extends AbstractCvsTask { | |||||
File tmpFile = null; | File tmpFile = null; | ||||
try { | try { | ||||
tmpFile = myfileUtils.createTempFile("cvstagdiff", ".log", null); | tmpFile = myfileUtils.createTempFile("cvstagdiff", ".log", null); | ||||
tmpFile.deleteOnExit(); | |||||
setOutput(tmpFile); | setOutput(tmpFile); | ||||
// run the cvs command | // run the cvs command | ||||
@@ -192,6 +192,7 @@ public class Cab extends MatchingTask { | |||||
protected File createListFile(Vector files) | protected File createListFile(Vector files) | ||||
throws IOException { | throws IOException { | ||||
File listFile = fileUtils.createTempFile("ant", "", null); | File listFile = fileUtils.createTempFile("ant", "", null); | ||||
listFile.deleteOnExit(); | |||||
PrintWriter writer = new PrintWriter(new FileOutputStream(listFile)); | PrintWriter writer = new PrintWriter(new FileOutputStream(listFile)); | ||||
@@ -322,6 +323,7 @@ public class Cab extends MatchingTask { | |||||
if (!doVerbose) { | if (!doVerbose) { | ||||
outFile = fileUtils.createTempFile("ant", "", null); | outFile = fileUtils.createTempFile("ant", "", null); | ||||
outFile.deleteOnExit(); | |||||
exec.setOutput(outFile); | exec.setOutput(outFile); | ||||
} | } | ||||
@@ -322,6 +322,7 @@ public class ReplaceRegExp extends Task { | |||||
protected void doReplace(File f, int options) | protected void doReplace(File f, int options) | ||||
throws IOException { | throws IOException { | ||||
File temp = fileUtils.createTempFile("replace", ".txt", null); | File temp = fileUtils.createTempFile("replace", ".txt", null); | ||||
temp.deleteOnExit(); | |||||
Reader r = null; | Reader r = null; | ||||
Writer w = null; | Writer w = null; | ||||
@@ -769,6 +769,7 @@ public class JUnitTask extends Task { | |||||
File propsFile = | File propsFile = | ||||
FileUtils.newFileUtils().createTempFile("junit", ".properties", | FileUtils.newFileUtils().createTempFile("junit", ".properties", | ||||
tmpDir != null ? tmpDir : getProject().getBaseDir()); | tmpDir != null ? tmpDir : getProject().getBaseDir()); | ||||
propsFile.deleteOnExit(); | |||||
cmd.createArgument().setValue("propsfile=" | cmd.createArgument().setValue("propsfile=" | ||||
+ propsFile.getAbsolutePath()); | + propsFile.getAbsolutePath()); | ||||
Hashtable p = getProject().getProperties(); | Hashtable p = getProject().getProperties(); | ||||
@@ -320,7 +320,10 @@ public abstract class AbstractMetamataTask extends Task { | |||||
} | } | ||||
protected final File createTmpFile() { | protected final File createTmpFile() { | ||||
return FileUtils.newFileUtils().createTempFile("metamata", ".tmp", getProject().getBaseDir()); | |||||
File tmpFile = FileUtils.newFileUtils() | |||||
.createTempFile("metamata", ".tmp", getProject().getBaseDir()); | |||||
tmpFile.deleteOnExit(); | |||||
return tmpFile; | |||||
} | } | ||||
/** | /** | ||||
@@ -1576,6 +1576,7 @@ public class FTP | |||||
throw new BuildException(ioe, getLocation()); | throw new BuildException(ioe, getLocation()); | ||||
} | } | ||||
if (!found) { | if (!found) { | ||||
localFile.deleteOnExit(); | |||||
return localFile; | return localFile; | ||||
} | } | ||||
} | } | ||||
@@ -196,6 +196,7 @@ public class CovMerge extends CovBase { | |||||
protected File createParamFile() throws BuildException { | protected File createParamFile() throws BuildException { | ||||
File[] snapshots = getSnapshots(); | File[] snapshots = getSnapshots(); | ||||
File file = createTempFile("jpcovm"); | File file = createTempFile("jpcovm"); | ||||
file.deleteOnExit(); | |||||
FileWriter fw = null; | FileWriter fw = null; | ||||
try { | try { | ||||
fw = new FileWriter(file); | fw = new FileWriter(file); | ||||
@@ -449,6 +449,7 @@ public class Coverage extends CovBase { | |||||
protected File createParamFile() throws BuildException { | protected File createParamFile() throws BuildException { | ||||
//@todo change this when switching to JDK 1.2 and use File.createTmpFile() | //@todo change this when switching to JDK 1.2 and use File.createTmpFile() | ||||
File file = createTempFile("jpcov"); | File file = createTempFile("jpcov"); | ||||
file.deleteOnExit(); | |||||
log("Creating parameter file: " + file, Project.MSG_VERBOSE); | log("Creating parameter file: " + file, Project.MSG_VERBOSE); | ||||
// options need to be one per line in the parameter file | // options need to be one per line in the parameter file | ||||
@@ -417,6 +417,7 @@ public class Symlink extends Task { | |||||
File parentDir = new File(parentStr); | File parentDir = new File(parentStr); | ||||
FileUtils fu = FileUtils.newFileUtils(); | FileUtils fu = FileUtils.newFileUtils(); | ||||
File temp = fu.createTempFile("symlink", ".tmp", parentDir); | File temp = fu.createTempFile("symlink", ".tmp", parentDir); | ||||
temp.deleteOnExit(); | |||||
try { | try { | ||||
try { | try { | ||||
fu.rename(canfil, temp); | fu.rename(canfil, temp); | ||||