Class DependencyCheckUtil
- java.lang.Object
-
- com.github.toolarium.dependency.check.DependencyCheckUtil
-
public final class DependencyCheckUtil extends java.lang.Object
Dependency check reader util
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DependecyCheckResult
filter(DependecyCheckResult dependecyCheckResult)
Filter out not relevant findings<T> java.util.List<T>
formatRuntimeRelevantVulneabilityReport(DependecyCheckResult dependecyCheckResult, IVulnerabilityReportFormatter<T> formatter)
Format a runtime relevant vulnerability report<T> java.util.List<T>
formatRuntimeRelevantVulneabilityReport(VulnerabilityReport vulnerabilityReport, IVulnerabilityReportFormatter<T> formatter)
Format a runtime relevant vulnerability report<T> java.util.List<T>
formatVulneabilityReport(DependecyCheckResult dependecyCheckResult, IVulnerabilityReportFormatter<T> formatter)
Format a dependency check result<T> java.util.List<T>
formatVulneabilityReport(DependecyCheckResult dependecyCheckResult, IVulnerabilityReportFormatter<T> formatter, java.lang.String... configurationFilter)
Format a dependency check result<T> java.util.List<T>
formatVulneabilityReport(VulnerabilityReport vulnerabilityReport, IVulnerabilityReportFormatter<T> formatter)
Format a vulnerability report<T> java.util.List<T>
formatVulneabilityReport(VulnerabilityReport vulnerabilityReport, IVulnerabilityReportFormatter<T> formatter, java.lang.String... configurationFilter)
Format a dependency check result intostatic DependencyCheckUtil
getInstance()
Get the instanceDependecyCheckResult
readFile(java.io.File file)
Read a dependency check resultDependecyCheckResult
readFile(java.lang.String filename)
Read a dependency check resultDependecyCheckResult
simplify(DependecyCheckResult dependecyCheckResult)
Simplify a dependecy check result and remove attributes.java.lang.String
toJsonString(DependecyCheckResult dependecyCheckResult)
Read a dependency check resultVulnerabilityReport
toVulnerabilityReport(DependecyCheckResult dependecyCheckResult)
Format a dependency check result into a vulnerability reportvoid
writeFile(java.io.File file, DependecyCheckResult dependecyCheckResult)
Read a dependency check resultvoid
writeFile(java.lang.String filename, DependecyCheckResult dependecyCheckResult)
Read a dependency check result
-
-
-
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 namedependecyCheckResult
- 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 filedependecyCheckResult
- 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 writeformatter
- 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 reportformatter
- 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 writeformatter
- 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 reportformatter
- 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 writeformatter
- the formatterconfigurationFilter
- 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 reportformatter
- the formatterconfigurationFilter
- 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
-
-