aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Srb <michal@redhat.com>2017-08-21 18:11:04 +0200
committerBryn M. Reeves <bmr@redhat.com>2017-10-10 10:36:50 +0100
commitd33c63a230092e94f966551968c51e8c5760742f (patch)
tree7352f3bee6525609664ad32ad75436af1af0c54e
parent6fc42802b87f95dba1d6bfda49ae158143e7799c (diff)
downloadsos-d33c63a230092e94f966551968c51e8c5760742f.tar.gz
[jars] Catch zipfile.BadZipfile exception
Bad ZIP files can raise zipfile.BadZipfile exception. Fixes: Traceback (most recent call last): File "/home/msrb/projects/sos/sos/sosreport.py", line 1252, in setup plug.setup() File "/home/msrb/projects/sos/sos/plugins/jars.py", line 72, in setup if Jars.is_jar(path): File "/home/msrb/projects/sos/sos/plugins/jars.py", line 98, in is_jar with zipfile.ZipFile(path) as f: File "/usr/lib64/python2.7/zipfile.py", line 770, in __init__ self._RealGetContents() File "/usr/lib64/python2.7/zipfile.py", line 842, in _RealGetContents raise BadZipfile("Bad magic number for central directory") BadZipfile: Bad magic number for central directory Signed-off-by: Michal Srb <michal@redhat.com>
-rw-r--r--sos/plugins/jars.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/sos/plugins/jars.py b/sos/plugins/jars.py
index 486ac05f..8c6b54f4 100644
--- a/sos/plugins/jars.py
+++ b/sos/plugins/jars.py
@@ -98,7 +98,7 @@ class Jars(Plugin, RedHatPlugin):
with zipfile.ZipFile(path) as f:
if "META-INF/MANIFEST.MF" in f.namelist():
return True
- except IOError:
+ except (IOError, zipfile.BadZipfile):
pass
return False