Class DependencyCheckUtil


  • public final class DependencyCheckUtil
    extends java.lang.Object
    Dependency check reader util
    • Method Detail

      • getInstance

        public static DependencyCheckUtil getInstance()
        Get the instance
        Returns:
        the instance
      • readFile

        public DependecyCheckResult readFile​(java.lang.String filename)
                                      throws java.io.IOException
        Read a dependency check result
        Parameters:
        filename - the file name
        Returns:
        the result
        Throws:
        java.io.IOException - In case of a file read error
      • readFile

        public DependecyCheckResult readFile​(java.io.File file)
                                      throws java.io.IOException
        Read a dependency check result
        Parameters:
        file - the file
        Returns:
        the result
        Throws:
        java.io.IOException - In case of a file read error
      • writeFile

        public void writeFile​(java.lang.String filename,
                              DependecyCheckResult dependecyCheckResult)
                       throws java.io.IOException
        Read a dependency check result
        Parameters:
        filename - the file name
        dependecyCheckResult - the dependency check result to write
        Throws:
        java.io.IOException - In case of a file read error
      • writeFile

        public void writeFile​(java.io.File file,
                              DependecyCheckResult dependecyCheckResult)
                       throws java.io.IOException
        Read a dependency check result
        Parameters:
        file - the file
        dependecyCheckResult - the dependency check result to write
        Throws:
        java.io.IOException - In case of a file read error
      • simplify

        public DependecyCheckResult simplify​(DependecyCheckResult dependecyCheckResult)
        Simplify a dependecy check result and remove attributes.
        Parameters:
        dependecyCheckResult - the dependency check result
        Returns:
        the filtered and simplified dependency check result
      • filter

        public DependecyCheckResult filter​(DependecyCheckResult dependecyCheckResult)
        Filter out not relevant findings
        Parameters:
        dependecyCheckResult - the dependency check result
        Returns:
        the filtered and simplified dependency check result
      • toVulnerabilityReport

        public VulnerabilityReport toVulnerabilityReport​(DependecyCheckResult dependecyCheckResult)
        Format a dependency check result into a vulnerability report
        Parameters:
        dependecyCheckResult - the dependency check result to write
        Returns:
        the vulnerability report
        Throws:
        java.io.IOException - In case of a file read error
      • formatRuntimeRelevantVulneabilityReport

        public <T> java.util.List<T> formatRuntimeRelevantVulneabilityReport​(DependecyCheckResult dependecyCheckResult,
                                                                             IVulnerabilityReportFormatter<T> formatter)
        Format a runtime relevant vulnerability report
        Type Parameters:
        T - the generic type
        Parameters:
        dependecyCheckResult - the dependency check result to write
        formatter - the formatter
        Returns:
        the string representation of the object
        Throws:
        java.io.IOException - In case of a file read error
      • formatRuntimeRelevantVulneabilityReport

        public <T> java.util.List<T> formatRuntimeRelevantVulneabilityReport​(VulnerabilityReport vulnerabilityReport,
                                                                             IVulnerabilityReportFormatter<T> formatter)
        Format a runtime relevant vulnerability report
        Type Parameters:
        T - the generic type
        Parameters:
        vulnerabilityReport - the vulnerability report
        formatter - the formatter
        Returns:
        the string representation of the object
        Throws:
        java.io.IOException - In case of a file read error
      • formatVulneabilityReport

        public <T> java.util.List<T> formatVulneabilityReport​(DependecyCheckResult dependecyCheckResult,
                                                              IVulnerabilityReportFormatter<T> formatter)
        Format a dependency check result
        Type Parameters:
        T - the generic type
        Parameters:
        dependecyCheckResult - the dependency check result to write
        formatter - the formatter
        Returns:
        the string representation of the object
        Throws:
        java.io.IOException - In case of a file read error
      • formatVulneabilityReport

        public <T> java.util.List<T> formatVulneabilityReport​(VulnerabilityReport vulnerabilityReport,
                                                              IVulnerabilityReportFormatter<T> formatter)
        Format a vulnerability report
        Type Parameters:
        T - the generic type
        Parameters:
        vulnerabilityReport - the vulnerability report
        formatter - the formatter
        Returns:
        the string representation of the object
        Throws:
        java.io.IOException - In case of a file read error
      • formatVulneabilityReport

        public <T> java.util.List<T> formatVulneabilityReport​(DependecyCheckResult dependecyCheckResult,
                                                              IVulnerabilityReportFormatter<T> formatter,
                                                              java.lang.String... configurationFilter)
        Format a dependency check result
        Type Parameters:
        T - the generic type
        Parameters:
        dependecyCheckResult - the dependency check result to write
        formatter - the formatter
        configurationFilter - the configuration filter or null to format all configurations
        Returns:
        the string representation of the object
        Throws:
        java.io.IOException - In case of a file read error
      • formatVulneabilityReport

        public <T> java.util.List<T> formatVulneabilityReport​(VulnerabilityReport vulnerabilityReport,
                                                              IVulnerabilityReportFormatter<T> formatter,
                                                              java.lang.String... configurationFilter)
        Format a dependency check result into
        Type Parameters:
        T - the generic type
        Parameters:
        vulnerabilityReport - the vulnerability report
        formatter - the formatter
        configurationFilter - the configuration filter or null to format all configurations
        Returns:
        the string representation of the object
        Throws:
        java.io.IOException - In case of a file read error
      • toJsonString

        public java.lang.String toJsonString​(DependecyCheckResult dependecyCheckResult)
        Read a dependency check result
        Parameters:
        dependecyCheckResult - the dependency check result to write
        Returns:
        the string representation of the object
        Throws:
        java.io.IOException - In case of a file read error