git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@574360 13f79535-47bb-0310-9956-ffa450edef68master
@@ -341,8 +341,7 @@ public class FixCRLF extends MatchingTask implements ChainableReader { | |||||
fcv = new Vector(1); | fcv = new Vector(1); | ||||
fcv.add(fc); | fcv.add(fc); | ||||
} | } | ||||
File tmpFile = FILE_UTILS.createTempFile("fixcrlf", "", null); | |||||
tmpFile.deleteOnExit(); | |||||
File tmpFile = FILE_UTILS.createTempFileName("fixcrlf", "", null, true); | |||||
try { | try { | ||||
FILE_UTILS.copyFile(srcFile, tmpFile, null, fcv, false, false, | FILE_UTILS.copyFile(srcFile, tmpFile, null, fcv, false, false, | ||||
encoding, outputEncoding == null ? encoding : outputEncoding, | encoding, outputEncoding == null ? encoding : outputEncoding, | ||||
@@ -577,9 +577,8 @@ public class Zip extends MatchingTask { | |||||
/** rename the zip file. */ | /** rename the zip file. */ | ||||
private File renameFile() { | private File renameFile() { | ||||
File renamedFile = FILE_UTILS.createTempFile( | |||||
"zip", ".tmp", zipFile.getParentFile()); | |||||
renamedFile.deleteOnExit(); | |||||
File renamedFile = FILE_UTILS.createTempFileName( | |||||
"zip", ".tmp", zipFile.getParentFile(), true); | |||||
try { | try { | ||||
FILE_UTILS.rename(zipFile, renamedFile); | FILE_UTILS.rename(zipFile, renamedFile); | ||||
} catch (SecurityException e) { | } catch (SecurityException e) { | ||||
@@ -412,8 +412,8 @@ public class Symlink extends DispatchTask { | |||||
File canfil = linkfil.getCanonicalFile(); | File canfil = linkfil.getCanonicalFile(); | ||||
// rename the resource, thus breaking the link: | // rename the resource, thus breaking the link: | ||||
File temp = FILE_UTILS.createTempFile("symlink", ".tmp", | |||||
canfil.getParentFile()); | |||||
File temp = FILE_UTILS.createTempFileName("symlink", ".tmp", | |||||
canfil.getParentFile(), false); | |||||
try { | try { | ||||
try { | try { | ||||
FILE_UTILS.rename(canfil, temp); | FILE_UTILS.rename(canfil, temp); | ||||
@@ -445,7 +445,7 @@ public class ModifiedSelector extends BaseExtendSelector | |||||
// How to handle non-file-Resources? I copy temporarily the | // How to handle non-file-Resources? I copy temporarily the | ||||
// resource to a file and use the file-implementation. | // resource to a file and use the file-implementation. | ||||
FileUtils fu = FileUtils.getFileUtils(); | FileUtils fu = FileUtils.getFileUtils(); | ||||
File tmpFile = fu.createTempFile("modified-", ".tmp", null); | |||||
File tmpFile = fu.createTempFileName("modified-", ".tmp", null, true); | |||||
Resource tmpResource = new FileResource(tmpFile); | Resource tmpResource = new FileResource(tmpFile); | ||||
ResourceUtils.copyResource(resource, tmpResource); | ResourceUtils.copyResource(resource, tmpResource); | ||||
boolean isSelected = isSelected(tmpFile.getParentFile(), | boolean isSelected = isSelected(tmpFile.getParentFile(), | ||||
@@ -347,7 +347,7 @@ public class ExecTaskTest extends BuildFileTest { | |||||
return; | return; | ||||
} | } | ||||
myBuild = new MonitoredBuild(new File(System.getProperty("root"), BUILD_FILE), "spawn"); | myBuild = new MonitoredBuild(new File(System.getProperty("root"), BUILD_FILE), "spawn"); | ||||
logFile = FILE_UTILS.createTempFile("spawn","log", project.getBaseDir()); | |||||
logFile = FILE_UTILS.createTempFileName("spawn","log", project.getBaseDir(), false); | |||||
// this is guaranteed by FileUtils#createTempFile | // this is guaranteed by FileUtils#createTempFile | ||||
assertTrue("log file not existing", !logFile.exists()); | assertTrue("log file not existing", !logFile.exists()); | ||||
// make the spawned process run 4 seconds | // make the spawned process run 4 seconds | ||||
@@ -175,7 +175,7 @@ public class JavaTest extends BuildFileTest { | |||||
} | } | ||||
public void testSpawn() { | public void testSpawn() { | ||||
File logFile = FILE_UTILS.createTempFile("spawn","log", project.getBaseDir()); | |||||
File logFile = FILE_UTILS.createTempFileName("spawn","log", project.getBaseDir(), false); | |||||
// this is guaranteed by FileUtils#createTempFile | // this is guaranteed by FileUtils#createTempFile | ||||
assertTrue("log file not existing", !logFile.exists()); | assertTrue("log file not existing", !logFile.exists()); | ||||
project.setProperty("logFile", logFile.getAbsolutePath()); | project.setProperty("logFile", logFile.getAbsolutePath()); | ||||
@@ -391,7 +391,7 @@ public class ModifiedSelectorTest extends BaseSelectorTest { | |||||
* configure() method of ModifiedSelector. This testcase tests that. | * configure() method of ModifiedSelector. This testcase tests that. | ||||
*/ | */ | ||||
public void testCreatePropertiesCacheViaCustomSelector() { | public void testCreatePropertiesCacheViaCustomSelector() { | ||||
File cachefile = FILE_UTILS.createTempFile("tmp-cache-", ".properties", null); | |||||
File cachefile = FILE_UTILS.createTempFileName("tmp-cache-", ".properties", null, false); | |||||
try { | try { | ||||
// initialize test environment (called "bed") | // initialize test environment (called "bed") | ||||
makeBed(); | makeBed(); | ||||