Rather than using instanceOf, just add a specific catch for AnalysisException.

This commit is contained in:
Anthony Whitford
2015-12-28 13:05:45 -08:00
parent 2294ed1ce1
commit 62f6c7c5a9

View File

@@ -235,16 +235,14 @@ public class AssemblyAnalyzer extends AbstractFileTypeAnalyzer {
this.setEnabled(false); this.setEnabled(false);
throw new AnalysisException("Could not execute .NET AssemblyAnalyzer"); throw new AnalysisException("Could not execute .NET AssemblyAnalyzer");
} }
} catch (AnalysisException e) {
throw e;
} catch (Throwable e) { } catch (Throwable e) {
if (e instanceof AnalysisException) { LOGGER.warn("An error occurred with the .NET AssemblyAnalyzer;\n"
throw (AnalysisException) e; + "this can be ignored unless you are scanning .NET DLLs. Please see the log for more details.");
} else { LOGGER.debug("Could not execute GrokAssembly {}", e.getMessage());
LOGGER.warn("An error occurred with the .NET AssemblyAnalyzer;\n" this.setEnabled(false);
+ "this can be ignored unless you are scanning .NET DLLs. Please see the log for more details."); throw new AnalysisException("An error occurred with the .NET AssemblyAnalyzer", e);
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(); builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
} }