Fix some bugs in JSON+LD-heuristics for pub date.

This commit is contained in:
Viktor Lofgren 2023-06-12 17:16:47 +02:00 committed by Viktor
parent 44b1fe0e6d
commit 21125206b4

View File

@ -45,7 +45,7 @@ public class PubDateHeuristicJSONLD implements PubDateHeuristic {
return Optional.ofNullable(model.getDatePublished()); return Optional.ofNullable(model.getDatePublished());
} }
catch (JsonSyntaxException ex) { catch (JsonSyntaxException|NumberFormatException|NullPointerException ex) {
return Optional.empty(); return Optional.empty();
} }
} }
@ -60,7 +60,7 @@ class JsonModel {
for (var item : Objects.requireNonNullElse(graph, for (var item : Objects.requireNonNullElse(graph,
Collections.<JsonModelGraphItem>emptyList())) Collections.<JsonModelGraphItem>emptyList()))
{ {
if (!item.isRelevant()) if (null == item || !item.isRelevant())
continue; continue;
if (item.datePublished != null) if (item.datePublished != null)