Skip to content

Commit 24316cd

Browse files
committed
Throw an error when fetching binary list
1 parent cb7568b commit 24316cd

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

src/fosslight_binary/_binary.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ def get_oss_report(self):
115115
exclude = _EXCLUDE_TRUE_VALUE if (self.exclude or oss.exclude) else ""
116116
nvd_url = self.get_vulnerability_items()
117117
yield from [self.binary_strip_root, oss.name, oss.version,
118-
oss.license, oss.dl_url, '', '', exclude, oss.comment, nvd_url]
118+
oss.license, oss.dl_url, '', '', exclude, oss.comment, nvd_url]
119119
else:
120120
exclude = _EXCLUDE_TRUE_VALUE if self.exclude else ""
121121
yield from [self.binary_strip_root, '',
122-
'', '', '', '', '', exclude, '']
122+
'', '', '', '', '', exclude, '']
123123

124124
def set_checksum_tlsh(self):
125125
self.checksum, self.tlsh, error, msg = get_checksum_and_tlsh(

src/fosslight_binary/binary_analysis.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,19 @@ def find_binaries(path_to_find_bin, output_dir, format, dburl=""):
142142
content_list = []
143143
result_file = ""
144144

145+
if not os.path.isdir(path_to_find_bin):
146+
error_occured(error_msg=f"Can't find the directory : {path_to_find_bin}",
147+
result_log=_result_log,
148+
exit=True)
145149
try:
146-
if not os.path.isdir(path_to_find_bin):
147-
error_occured(error_msg=f"Can't find the directory : {path_to_find_bin}",
148-
result_log=_result_log,
149-
exit=True)
150-
151150
total_file_cnt, file_list, found_jar = get_file_list(path_to_find_bin)
152151
return_list = list(return_bin_only(file_list))
153-
total_bin_cnt = len(return_list)
154-
152+
except Exception as ex:
153+
error_occured(error_msg=f"Failed to check whether it is binary or not : {ex}",
154+
result_log=_result_log,
155+
exit=True)
156+
total_bin_cnt = len(return_list)
157+
try:
155158
# Run OWASP Dependency-check
156159
if found_jar:
157160
logger.info("Run OWASP Dependency-check to analyze .jar file")

0 commit comments

Comments
 (0)