Skip to content

Commit

Permalink
MET-6262 fix add null pointer exception guards (#704)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeortizquan authored Nov 28, 2024
1 parent 583683e commit 1c99afa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,15 @@ private void populateWithDateRanges(SolrInputDocument document, RdfWrapper rdfWr
final ProxyType europeanaProxy = rdfWrapper.getProxies().stream().filter(RdfWrapper::isEuropeanaProxy).findFirst()
.orElseThrow();

final List<String> proxyChoiceLinks = europeanaProxy.getChoiceList().stream().filter(choiceTypePredicate)
.map(choiceValueGetter).map(ResourceOrLiteralType::getResource)
.map(Resource::getResource).toList();
final List<String> proxyChoiceLinks = europeanaProxy.getChoiceList().stream()
.filter(choiceTypePredicate)
.map(choiceValueGetter)
.filter(Objects::nonNull)
.map(ResourceOrLiteralType::getResource)
.filter(Objects::nonNull)
.map(Resource::getResource)
.filter(Objects::nonNull)
.toList();

final List<TimeSpanType> proxyChoiceMatchingTimeSpans = normalizedTimeSpans.stream().filter(
timeSpanType -> proxyChoiceLinks.contains(timeSpanType.getAbout())).toList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private WebResource getOrCreateWebResource(String url) {
getRdf().setWebResourceList(new ArrayList<>());
}
for (WebResourceType resource : getRdf().getWebResourceList()) {
if (resource.getAbout().equals(url)) {
if (resource != null && resource.getAbout() !=null && resource.getAbout().equals(url)) {
return new WebResource(resource);
}
}
Expand Down

0 comments on commit 1c99afa

Please sign in to comment.