Class DescriptionEcosystemMapper


  • public class DescriptionEcosystemMapper
    extends java.lang.Object
    Helper utility for mapping CVEs to their ecosystems based on the description.
    Author:
    skjolber
    • Constructor Summary

      Constructors 
      Constructor Description
      DescriptionEcosystemMapper()
      Constructs a new description ecosystem mapper.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getEcosystem​(io.github.jeremylong.openvulnerability.client.nvd.DefCveItem cve)
      Returns the ecosystem if identified by English description from the CVE data.
      java.lang.String getEcosystem​(java.lang.String multicase)
      Determines the ecosystem for the given string.
      protected static boolean[] getPrefixesFor​(java.lang.String str)  
      protected void increment​(int i, int[] ecosystemMap)  
      protected static boolean isExtension​(java.lang.String str, int begin, int end)  
      protected static boolean isLowercaseAscii​(java.lang.String multicase, int start, int end)  
      static boolean isURL​(java.lang.String c, int begin)
      Tests if the string is a URL by looking for '://'.
      protected static StringAhoCorasickDoubleArrayTrie<EcosystemHint> toAhoCorasickDoubleArrayTrie()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DescriptionEcosystemMapper

        public DescriptionEcosystemMapper()
        Constructs a new description ecosystem mapper.
    • Method Detail

      • getPrefixesFor

        protected static boolean[] getPrefixesFor​(java.lang.String str)
      • isExtension

        protected static boolean isExtension​(java.lang.String str,
                                             int begin,
                                             int end)
      • isLowercaseAscii

        protected static boolean isLowercaseAscii​(java.lang.String multicase,
                                                  int start,
                                                  int end)
      • isURL

        public static boolean isURL​(java.lang.String c,
                                    int begin)
        Tests if the string is a URL by looking for '://'.
        Parameters:
        c - the text to test.
        begin - the position in the string to begin searching; note the search is decreasing to 0
        Returns:
        true if `://` is found; otherwise false
      • increment

        protected void increment​(int i,
                                 int[] ecosystemMap)
      • getEcosystem

        public java.lang.String getEcosystem​(io.github.jeremylong.openvulnerability.client.nvd.DefCveItem cve)
        Returns the ecosystem if identified by English description from the CVE data.
        Parameters:
        cve - the CVE data
        Returns:
        the ecosystem if identified
      • getEcosystem

        public java.lang.String getEcosystem​(java.lang.String multicase)
        Determines the ecosystem for the given string.
        Parameters:
        multicase - the string to test
        Returns:
        the ecosystem