Skip to content

Commit 63f0053

Browse files
committed
add zip corruption handler to javax detection
1 parent ff923f5 commit 63f0053

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

springboot/detect_javax_classes.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,15 @@ def _check_for_javax_classes(springbootzip_filepath, ignorelisted_jars, output_f
4444
# Starting the search....
4545
# iterate through the springboot jar file, and find inner jars,
4646
# open each inner jar and catalog each .class file found
47-
springbootzip = zipfile.ZipFile(springbootzip_filepath)
47+
try:
48+
springbootzip = zipfile.ZipFile(springbootzip_filepath)
49+
except zipfile.BadZipFile:
50+
# this error happened to me when my computer ran out of disk space during a build
51+
result = "Spring Boot javax detection has failed for %s because the generated jar file is corrupt, please delete this file.\n" % springbootzip_filepath
52+
print(result)
53+
_write_result_to_output_file(output_filepath, result)
54+
return True
55+
4856
sprintbootzipentries = springbootzip.infolist()
4957
for springbootzipentry in sprintbootzipentries:
5058
if springbootzipentry.filename.endswith(".jar"):

0 commit comments

Comments
 (0)