Commit fc06ebcd authored by Thibault Ehrhart's avatar Thibault Ehrhart

NewsCollector: fix crash when media api query fails

parent 0028fb7a
......@@ -156,21 +156,21 @@ final class AgenceFrancePresseMethods {
public static List<ImageObject> getArticleImages(NewsArticle article) {
AgenceFrancePresseMethods.LOGGER.info("Querying Media API for article " + article.getId());
List<ImageObject> images = new ArrayList<>();
if (article.getDatePublished().isEqual(LocalDateTime.of(0000, Month.JANUARY, 01, 00, 00, 00))) {
AgenceFrancePresseMethods.LOGGER.info("getArticleImages: Article " + article.getId() + " has no published date");
return null;
return images;
}
if (article.getSubjects().isEmpty()) {
AgenceFrancePresseMethods.LOGGER.info("getArticleImages: Article " + article.getId() + " has no subjects");
return null;
return images;
}
if (article.getDateline().isEmpty()) {
AgenceFrancePresseMethods.LOGGER.info("getArticleImages: Article " + article.getId() + " has no dateline");
return null;
return images;
}
List<ImageObject> images = new ArrayList<>();
final String apiUrl = "http://medialab.afp.com/afp-4w";
URIBuilder uriBuilder = null;
final HttpGet req;
......@@ -213,7 +213,6 @@ final class AgenceFrancePresseMethods {
}
} catch (URISyntaxException | IOException e) {
AgenceFrancePresseMethods.LOGGER.error(e.toString());
return null;
}
return images;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment