Skip to content

Commit

Permalink
Merge branch 'dependabot/maven/commons-io-commons-io-2.9.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylong committed May 28, 2021
2 parents 79f8cc5 + 356b327 commit d1932c6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,9 @@ private void loadHintRules() throws HintParseException {
try (InputStream fromClasspath = FileUtils.getResourceAsStream(filePath)) {
deleteTempFile = true;
file = getSettings().getTempFile("hint", "xml");
try {
org.apache.commons.io.FileUtils.copyInputStreamToFile(fromClasspath, file);
} catch (IOException ex) {
throw new HintParseException("Unable to locate hints file in classpath", ex);
}
org.apache.commons.io.FileUtils.copyInputStreamToFile(fromClasspath, file);
} catch (IOException ex) {
throw new HintParseException("Unable to locate hints file in classpath", ex);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ public void write(String outputLocation, Format format) throws ReportException {
final String templateName = format.toString().toLowerCase() + "Report";
processTemplate(templateName, out);
if (settings.getBoolean(Settings.KEYS.PRETTY_PRINT, false)) {
if (format == Format.JSON || format == Format.SARIF) {
if (format == Format.JSON || format == Format.SARIF) {
pretifyJson(out.getPath());
} else if (format == Format.XML || format == Format.JUNIT) {
pretifyXml(out.getPath());
Expand Down Expand Up @@ -450,9 +450,9 @@ protected void processTemplate(String templateName, OutputStream outputStream) t
writer.flush();
} catch (UnsupportedEncodingException ex) {
throw new ReportException("Unable to generate the report using UTF-8", ex);
} catch (IOException ex) {
throw new ReportException("Unable to write the report", ex);
}
} catch (IOException ex) {
throw new ReportException("Unable to write the report", ex);
} finally {
if (input != null) {
try {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ Copyright (c) 2012 - Jeremy Long

<com.h2database.version>1.4.199</com.h2database.version>
<commons-cli.version>1.4</commons-cli.version>
<commons-io.version>2.8.0</commons-io.version>
<commons-io.version>2.9.0</commons-io.version>
<commons-lang3.version>3.12.0</commons-lang3.version>
<commons-text.version>1.9</commons-text.version>
<commons-jcs-core.version>2.2.1</commons-jcs-core.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,20 +154,17 @@ public static void close(@Nullable final Closeable closeable) {
*
* @param resource path
* @return the input stream for the given resource
* @throws FileNotFoundException if the file could not be found
*/
@Nullable
public static InputStream getResourceAsStream(@NotNull String resource) {
public static InputStream getResourceAsStream(@NotNull String resource) throws FileNotFoundException {
final ClassLoader classLoader = FileUtils.class.getClassLoader();
final InputStream inputStream = classLoader != null
? classLoader.getResourceAsStream(resource)
: ClassLoader.getSystemResourceAsStream(resource);

if (inputStream == null) {
try {
return new FileInputStream(resource);
} catch (final FileNotFoundException e) {
LOGGER.error("Unable to create an Input Stream for " + resource, e);
}
return new FileInputStream(resource);
}
return inputStream;
}
Expand Down

0 comments on commit d1932c6

Please sign in to comment.