Skip to content

fix: add None checks to run_java_checker #1630

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cve_bin_tool/version_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,13 @@ def run_java_checker(self, filename: str) -> Iterator[ScanInfo]:
if parent is None:
product = root.find(schema + "artifactId").text
version = root.find(schema + "version").text
if version is None:
if version is None and parent is not None:
version = parent.find(schema + "version").text
# Check valid version identifier (i.e. starts with a digit)
if not version[0].isdigit():
self.logger.debug(f"Invalid {version} detected in {filename}")
version = None
if product is None:
if product is None and parent is not None:
product = parent.find(schema + "artifactId").text
if product is not None and version is not None:
product_info, file_path = self.find_java_vendor(product, version)
Expand Down