make junitlauncher and friends use FileUtils.createTempFile
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/AbstractJUnitResultFormatter.java b/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/AbstractJUnitResultFormatter.java
index 833ae0f..dc9847d 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/AbstractJUnitResultFormatter.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/AbstractJUnitResultFormatter.java
@@ -260,8 +260,9 @@
}
private FileOutputStream createFileStore() throws IOException {
- this.filePath = Files.createTempFile(null, this.tmpFileSuffix);
- this.filePath.toFile().deleteOnExit();
+ this.filePath = FileUtils.getFileUtils()
+ .createTempFile(null, this.tmpFileSuffix, null, true, true)
+ .toPath();
return new FileOutputStream(this.filePath.toFile());
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/confined/JUnitLauncherTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/confined/JUnitLauncherTask.java
index 3e0e671..0d16ed0 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/confined/JUnitLauncherTask.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/confined/JUnitLauncherTask.java
@@ -28,6 +28,7 @@
import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.Environment;
import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.util.FileUtils;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamWriter;
@@ -224,8 +225,9 @@
}
private java.nio.file.Path dumpProjectProperties() throws IOException {
- final java.nio.file.Path propsPath = Files.createTempFile(null, "properties");
- propsPath.toFile().deleteOnExit();
+ final java.nio.file.Path propsPath = FileUtils.getFileUtils()
+ .createTempFile(null, "properties", null, true, true)
+ .toPath();
final Hashtable<String, Object> props = this.getProject().getProperties();
final Properties projProperties = new Properties();
projProperties.putAll(props);
@@ -364,14 +366,9 @@
}
private java.nio.file.Path newLaunchDefinitionXml() {
- final java.nio.file.Path xmlFilePath;
- try {
- xmlFilePath = Files.createTempFile(null, ".xml");
- } catch (IOException e) {
- throw new BuildException("Failed to construct command line for test", e);
- }
- xmlFilePath.toFile().deleteOnExit();
- return xmlFilePath;
+ return FileUtils.getFileUtils()
+ .createTempFile(null, ".xml", null, true, true)
+ .toPath();
}
private final class InVMLaunch implements LaunchDefinition {