From 2e12a611526919d196ff6f7e127acaf3c0d42c7b Mon Sep 17 00:00:00 2001 From: Colm O hEigeartaigh Date: Wed, 31 Jul 2024 12:09:32 +0100 Subject: [PATCH] fix(java): Return error when trying to find a remote pom to avoid segfault --- pkg/dependency/parser/java/pom/parse.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/dependency/parser/java/pom/parse.go b/pkg/dependency/parser/java/pom/parse.go index 550c5761c6ee..c0ee28d94d8b 100644 --- a/pkg/dependency/parser/java/pom/parse.go +++ b/pkg/dependency/parser/java/pom/parse.go @@ -681,7 +681,7 @@ func (p *Parser) remoteRepoRequest(repo string, paths []string) (*http.Request, repoURL, err := url.Parse(repo) if err != nil { p.logger.Error("URL parse error", log.String("repo", repo)) - return nil, nil + return nil, err } paths = append([]string{repoURL.Path}, paths...) @@ -691,7 +691,7 @@ func (p *Parser) remoteRepoRequest(repo string, paths []string) (*http.Request, req, err := http.NewRequest("GET", repoURL.String(), http.NoBody) if err != nil { logger.Debug("HTTP request failed") - return nil, nil + return nil, err } if repoURL.User != nil { password, _ := repoURL.User.Password()