package com.codicesoftware.plugins.hudson;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;

public class OutputTempFile {
    private static final Logger LOGGER = Logger.getLogger(OutputTempFile.class.getName());

    private OutputTempFile() { }

    public static String getPathForXml() {
        return Paths
            .get(System.getProperty("java.io.tmpdir"))
            .resolve(UUID.randomUUID().toString() + ".xml")
            .toString();
    }

    public static void safeDelete(String path) {
        try {
            Files.deleteIfExists(Paths.get(path));
        } catch (IOException e) {
            LOGGER.log(
                Level.SEVERE, String.format("Unable to remove file '%s'", path), e);
        }
    }
}

@@ -48,84 +48,25 @@
 ort 
-java.io.IOException;%0Aimport java.nio.file.Files;%0Aimport java.nio.f
+hudson.F
 ile
-.
 Path
-s
 ;
+%0A
 %0Aimp
@@ -78,17 +78,22 @@
 ava.
-util.UUID
+io.IOException
 ;%0Aim
@@ -330,22 +330,24 @@
  static 
-String
+FilePath
  getPath
@@ -357,170 +357,136 @@
 Xml(
-) %7B%0A        return Paths%0A            .get(System.getProperty(%22java.io.tmpdir%22))%0A            .resolve(UUID.randomUUID().toString() + %22.xml%22)%0A            .toString(
+FilePath workspacePath) throws IOException, InterruptedException %7B%0A        return workspacePath.createTempFile(%22output_%22, %22.xml%22
 );%0A 
@@ -525,22 +525,24 @@
 eDelete(
-String
+FilePath
  path) %7B
@@ -572,46 +572,73 @@
     
-Files.deleteIfExists(Paths.get(path));
+if (path.exists()) %7B%0A                path.delete();%0A            %7D
 %0A   
@@ -651,18 +651,16 @@
  catch (
-IO
 Exceptio

Update OutputTempFile to use a FilePath