From be4d56f8d29b009cc4a402cbdf5873a7f5b7b0bd Mon Sep 17 00:00:00 2001 From: Jeremy Long Date: Sat, 29 Mar 2014 05:58:56 -0400 Subject: [PATCH] FindBugs corrections Former-commit-id: 22dfeaeb1493fdf25e790018c5d8c1761e935153 --- .../java/org/owasp/dependencycheck/utils/FileUtils.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/FileUtils.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/FileUtils.java index d7804986e..ecca59858 100644 --- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/FileUtils.java +++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/FileUtils.java @@ -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);