[diffoscope] 02/03: comparators.xml: fixes test_no_android_manifest from test_apk

Juliana Oliveira R jwnx-guest at moszumanska.debian.org
Tue Jul 25 19:32:32 CEST 2017

This is an automated email from the git hooks/post-receive script.

jwnx-guest pushed a commit to branch master
in repository diffoscope.

commit 5c53955a9a25f2f8b348181c392409c30fce756b
Author: Juliana Rodrigues <juliana.orod at gmail.com>
Date:   Mon Jul 24 16:41:12 2017 -0300

    comparators.xml: fixes test_no_android_manifest from test_apk
    This patch handles UnicodeDecodeError exception, which is caused
    by decoding an invalid XML File. When this error is raised, XMLFile
    returns False for recognizes() method, indicating for other object
    calls that the given file is not a XMLFile.
    Signed-off-by: Juliana Rodrigues <juliana.orod at gmail.com>
 diffoscope/comparators/xml.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/diffoscope/comparators/xml.py b/diffoscope/comparators/xml.py
index 1e94c10..5ba5516 100644
--- a/diffoscope/comparators/xml.py
+++ b/diffoscope/comparators/xml.py
@@ -89,7 +89,7 @@ class XMLFile(File):
         with open(file.path) as f:
                 file.parsed = _parse(f)
-            except ExpatError:
+            except (ExpatError, UnicodeDecodeError) as e:
                 return False
         return True

Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git

More information about the diffoscope mailing list