FindBugs corrections

Former-commit-id: 22dfeaeb1493fdf25e790018c5d8c1761e935153
This commit is contained in:
Jeremy Long
2014-03-29 05:58:56 -04:00
parent dfbcd616f2
commit be4d56f8d2

View File

@@ -99,11 +99,14 @@ public final class FileUtils {
* @param prefix the prefix for the file name to generate
* @param extension the extension of the generated file name
* @return a temporary File
* @throws java.io.IOException thrown if the temporary folder could not be created
*/
public static File getTempFile(String prefix, String extension) {
public static File getTempFile(String prefix, String extension) throws IOException {
final File dir = Settings.getTempDirectory();
if (!dir.exists()) {
dir.mkdirs();
if (!dir.mkdirs()) {
throw new IOException("Unable to create temporary folder");
}
}
final String tempFileName = String.format("%s%s.%s", prefix, UUID.randomUUID().toString(), extension);
final File tempFile = new File(dir, tempFileName);