If the OWASP dc XML does not exist, continue reporting after warning #580 (#582)

This commit is contained in:
Kota Kanbe
2018-01-16 17:08:12 +09:00
committed by GitHub
parent db43d55b2c
commit 4ccbee705b

View File

@@ -6,6 +6,8 @@ import (
"io/ioutil"
"os"
"strings"
log "github.com/sirupsen/logrus"
)
type analysis struct {
@@ -34,13 +36,15 @@ func appendIfMissing(slice []string, str string) []string {
func Parse(path string) ([]string, error) {
file, err := os.Open(path)
if err != nil {
return nil, fmt.Errorf("Failed to open: %s", err)
log.Warnf("OWASP Dependency Check XML is not found: %s", path)
return []string{}, nil
}
defer file.Close()
b, err := ioutil.ReadAll(file)
if err != nil {
return nil, fmt.Errorf("Failed to read: %s", err)
log.Warnf("Failed to read OWASP Dependency Check XML: %s", path)
return []string{}, nil
}
var anal analysis