chiark / gitweb /
Scanner: handle utf8 errors more gracefully
authorest31 <MTest31@outlook.com>
Wed, 2 Nov 2016 11:51:15 +0000 (12:51 +0100)
committerest31 <MTest31@outlook.com>
Wed, 2 Nov 2016 15:58:59 +0000 (16:58 +0100)
Fixes #226

fdroidserver/scanner.py

index 289e041a96433b416f3050e66aa756f89b3550f7..6e06f7c5558135168e63e43b05f5cd2fbed0c503 100644 (file)
@@ -199,7 +199,7 @@ def scan_source(build_dir, root_dir, build):
             elif ext == 'java':
                 if not os.path.isfile(fp):
                     continue
-                with open(fp, 'r', encoding='utf8') as f:
+                with open(fp, 'r', encoding='utf8', errors='replace') as f:
                     for line in f:
                         if 'DexClassLoader' in line:
                             count += handleproblem('DexClassLoader', fd, fp)
@@ -208,7 +208,7 @@ def scan_source(build_dir, root_dir, build):
             elif ext == 'gradle':
                 if not os.path.isfile(fp):
                     continue
-                with open(fp, 'r', encoding='utf8') as f:
+                with open(fp, 'r', encoding='utf8', errors='replace') as f:
                     lines = f.readlines()
                 for i, line in enumerate(lines):
                     if is_used_by_gradle(line):