Class FalsePositiveAnalyzer

  • All Implemented Interfaces:
    Analyzer

    @ThreadSafe
    public class FalsePositiveAnalyzer
    extends AbstractAnalyzer
    This analyzer attempts to remove some well known false positives - specifically regarding the java runtime.
    Author:
    Jeremy Long
    • Field Detail

      • CORE_JAVA

        public static final java.util.regex.Pattern CORE_JAVA
        Regex to identify core java libraries and a few other commonly misidentified ones.
      • CORE_JAVA_JSF

        public static final java.util.regex.Pattern CORE_JAVA_JSF
        Regex to identify core jsf libraries.
      • CORE_FILES

        public static final java.util.regex.Pattern CORE_FILES
        Regex to identify core java library files. This is currently incomplete.
      • CORE_JSF_FILES

        public static final java.util.regex.Pattern CORE_JSF_FILES
        Regex to identify core jsf java library files. This is currently incomplete.
    • Constructor Detail

      • FalsePositiveAnalyzer

        public FalsePositiveAnalyzer()
    • Method Detail

      • getName

        public java.lang.String getName()
        Returns the name of the analyzer.
        Returns:
        the name of the analyzer.
      • getAnalysisPhase

        public AnalysisPhase getAnalysisPhase()
        Returns the phase that the analyzer is intended to run in.
        Returns:
        the phase that the analyzer is intended to run in.
      • getAnalyzerEnabledSettingKey

        protected java.lang.String getAnalyzerEnabledSettingKey()

        Returns the setting key to determine if the analyzer is enabled.

        Specified by:
        getAnalyzerEnabledSettingKey in class AbstractAnalyzer
        Returns:
        the key for the analyzer's enabled property
      • analyzeDependency

        protected void analyzeDependency​(Dependency dependency,
                                         Engine engine)
                                  throws AnalysisException
        Analyzes the dependencies and removes bad/incorrect CPE associations based on various heuristics.
        Specified by:
        analyzeDependency in class AbstractAnalyzer
        Parameters:
        dependency - the dependency to analyze.
        engine - the engine that is scanning the dependencies
        Throws:
        AnalysisException - is thrown if there is an error reading the JAR file.
      • removeBadMatches

        protected void removeBadMatches​(Dependency dependency)
        Removes bad CPE matches for a dependency. Unfortunately, right now these are hard-coded patches for specific problems identified when testing this on a LARGE volume of jar files.
        Parameters:
        dependency - the dependency to analyze