Skip to content
Snippets Groups Projects
Verified Commit 97c93381 authored by Antoine R. Dumont's avatar Antoine R. Dumont
Browse files

metadata/maven: Ignore ill-formed xml instead of failing

This fixes error instances [1]

[1] https://sentry.softwareheritage.org/share/issue/a5869f724a244fdab2e1cb0303a12fc1/
parent cf598baa
No related branches found
No related tags found
No related merge requests found
# Copyright (C) 2018-2019 The Software Heritage developers
# Copyright (C) 2018-2021 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
......@@ -36,6 +36,9 @@ class MavenMapping(DictMapping, SingleFileMapping):
# unknown encoding or multi-byte encoding
self.log.warning("Error detecting XML encoding from %s", self.log_suffix)
return None
if not isinstance(d, dict):
self.log.warning("Skipping ill-formed XML content: %s", content)
return None
metadata = self._translate_dict(d, normalize=False)
metadata[SCHEMA_URI + "codeRepository"] = self.parse_repositories(d)
metadata[SCHEMA_URI + "license"] = self.parse_licenses(d)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment