From 62f6c7c5a9155543fff2dc6c9f6229248b0d3687 Mon Sep 17 00:00:00 2001 From: Anthony Whitford Date: Mon, 28 Dec 2015 13:05:45 -0800 Subject: [PATCH] Rather than using instanceOf, just add a specific catch for AnalysisException. --- .../analyzer/AssemblyAnalyzer.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.java index bb51d133b..91488e9b3 100644 --- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.java +++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.java @@ -235,16 +235,14 @@ public class AssemblyAnalyzer extends AbstractFileTypeAnalyzer { this.setEnabled(false); throw new AnalysisException("Could not execute .NET AssemblyAnalyzer"); } + } catch (AnalysisException e) { + throw e; } catch (Throwable e) { - if (e instanceof AnalysisException) { - throw (AnalysisException) e; - } else { - LOGGER.warn("An error occurred with the .NET AssemblyAnalyzer;\n" - + "this can be ignored unless you are scanning .NET DLLs. Please see the log for more details."); - LOGGER.debug("Could not execute GrokAssembly {}", e.getMessage()); - this.setEnabled(false); - throw new AnalysisException("An error occurred with the .NET AssemblyAnalyzer", e); - } + LOGGER.warn("An error occurred with the .NET AssemblyAnalyzer;\n" + + "this can be ignored unless you are scanning .NET DLLs. Please see the log for more details."); + LOGGER.debug("Could not execute GrokAssembly {}", e.getMessage()); + this.setEnabled(false); + throw new AnalysisException("An error occurred with the .NET AssemblyAnalyzer", e); } builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); }