/**
  * This method try to delete the temporary file, If it fails it will just log a warning msg.
  *
  * @param file
  * @throws IOException
  */
 private void delete(File file) throws IOException {
   if (file != null && file.exists() && !file.delete()) {
     log.warn("Failed to delete file/directory at path: " + file.getAbsolutePath());
   }
 }