Skip to content

Commit

Permalink
Handle malformed values in itunes module (#370)
Browse files Browse the repository at this point in the history
See commit 943c0db.
  • Loading branch information
mishako authored Nov 25, 2017
1 parent d77e944 commit 6e13670
Showing 1 changed file with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,22 +143,31 @@ public com.rometools.rome.feed.module.Module parse(final Element element, final
final Element order = element.getChild("order", ns);

if (order != null && order.getValue() != null) {
final Integer o = Integer.valueOf(order.getValue().trim());
entryInfo.setOrder(o);
try {
entryInfo.setOrder(Integer.valueOf(order.getValue().trim()));
} catch (NumberFormatException e) {
LOG.warn("Failed to parse order: {}", order.getValue());
}
}

final Element season = element.getChild("season", ns);

if (season != null && season.getValue() != null) {
final Integer o = Integer.valueOf(season.getValue().trim());
entryInfo.setSeason(o);
try {
entryInfo.setSeason(Integer.valueOf(season.getValue().trim()));
} catch (NumberFormatException e) {
LOG.warn("Failed to parse season: {}", season.getValue());
}
}

final Element episode = element.getChild("episode", ns);

if (episode != null && episode.getValue() != null) {
final Integer o = Integer.valueOf(episode.getValue().trim());
entryInfo.setEpisode(o);
try {
entryInfo.setEpisode(Integer.valueOf(episode.getValue().trim()));
} catch (NumberFormatException e) {
LOG.warn("Failed to parse episode: {}", episode.getValue());
}
}

final Element episodeType = element.getChild("episodeType", ns);
Expand Down

0 comments on commit 6e13670

Please sign in to comment.