try {
//create directory (if it doesn't exist)
if (this.dir != null && !this.dir.exists()) {
boolean success = this.dir.mkdirs();
if (!success)
throw new ConversionException("Parent directory does not exist and could not be created");
}
//create file:
File file = new File(this.dir, tFile.getName());
if (file.exists())
file = FileUtil.createTempFile(tFile, this.dir);
FileUtil.copyTo(tFile, file);
if (logger.isDebugEnabled())
logger.debug("File written: " + file.getPath());
return file;
}
catch(Exception e) {
throw new ConversionException(e);
}
}
}