tempfile.deleteOnExit();
if(owner.isDebug()) { owner.log("Application temporary files is "+tempfile); owner.log("This is not deleted in debug mode"); } else {  tempfile.deleteOnExit(); }
        public void addText(String text) {            //convert properties            text = owner.getProject().replaceProperties(text);            this.text=text;            //create a temp file            File tempfile = FileUtils.newFileUtils().createTempFile("deploy",                    ".sf", null);            //mark for cleanup later            tempfile.deleteOnExit();            owner.log("Saving to temporary file "+tempfile,Project.MSG_VERBOSE);            owner.log(text, Project.MSG_VERBOSE);            OutputStream out = null;            OutputStreamWriter writer = null;            PrintWriter printer = null;            try {                out = new BufferedOutputStream(new FileOutputStream(tempfile));                writer = new OutputStreamWriter(out, APPLICATION_ENCODING);                printer = new PrintWriter(writer);                printer.write(this.text);                printer.flush();                //remember our name                setFile(tempfile);            } catch (IOException e) {                throw new BuildException(ERROR_NO_WRITE + tempfile, e);            } finally {                if (writer != null) {                    try {                        writer.close();                    } catch (IOException ignored) {                    }                }            }        }