Catch exception while parsing invalid link in the HTML parser
@@ -1450,11 +1450,18 @@ public class PaginaURL {
protected String resolveHttpLink(HttpUrl base, String link) {
HttpUrl resolvedUrl;
+ try {
if (base == null) {
resolvedUrl = HttpUrl.parse(link);
} else {
resolvedUrl = base.resolve(link);
}
+ } catch (Exception e) {
+ // The link is invalid or malformed
+ resolvedUrl = null;
+ // logger.debug(String.format("Failed to resolve URL: base={%s} link={%s}",
+ // base.toString(), link), e);
+ }
if (resolvedUrl == null) {
return null;
} else {
