Source:
<code>public void deserialize(org.atlasapi.content.Content content, Content internal) { Episode episode = (Episode) content; Long episodeId = internal.getId(); episode.setSeriesNumber(internal.getSeriesNumber()); episode.setEpisodeNumber(internal.getEpisodeNumber()); episode.setPartNumber(internal.getPartNumber()); episode.setSpecial(internal.getSpecial()); Map<Ref, SeriesRef> seriesRefs = internal.getSeriesRefs(); if (seriesRefs != null && !seriesRefs.isEmpty()) { if (seriesRefs.size() > 1) { log.error("Episode with id has more than one series ref", episodeId); try { pdIntegrationKey = System.getenv("PD_INTEGRATION_KEY"); pdRaiseIncidents = Boolean.parseBoolean(System.getenv("PD_RAISE_INCIDENTS")); PagerDutyClientWithKey pagerDutyClient = new PagerDutyClientWithKey( PagerDutyEventsClient.create(), pdIntegrationKey, pdRaiseIncidents ); Payload payload = Payload.Builder.newBuilder() .setSummary( String.format( "Episode with id %s has more than one series ref", episodeId ) ) .setSource("atlas-deer") .setSeverity(Severity.WARNING) .setTimestamp(OffsetDateTime.now()) .build(); pagerDutyClient.trigger(payload, String.valueOf(episodeId)); <START> } catch (NullPointerException e) { <END> log.warn("Cannot throw PagerDuty alert because no config found for it."); } } Map.Entry<Ref, SeriesRef> entry = Iterables.getOnlyElement(seriesRefs.entrySet()); Ref ref = entry.getKey(); SeriesRef seriesRef = entry.getValue(); org.atlasapi.content.SeriesRef deserialized = seriesRefSerialization.deserialize(seriesRef); episode.setSeriesRef(new org.atlasapi.content.SeriesRef( Id.valueOf(ref.getId()), Publisher.fromKey(ref.getSource()).requireValue(), deserialized.getTitle(), deserialized.getSeriesNumber(), deserialized.getUpdated(), deserialized.getReleaseYear(), deserialized.getCertificates() )); } }</code><technical_language>catch exceptions</technical_language>

Target:
public void deserialize(org.atlasapi.content.Content content, Content internal) { Episode episode = (Episode) content; Long episodeId = internal.getId(); episode.setSeriesNumber(internal.getSeriesNumber()); episode.setEpisodeNumber(internal.getEpisodeNumber()); episode.setPartNumber(internal.getPartNumber()); episode.setSpecial(internal.getSpecial()); Map<Ref, SeriesRef> seriesRefs = internal.getSeriesRefs(); if (seriesRefs != null && !seriesRefs.isEmpty()) { if (seriesRefs.size() > 1) { log.error("Episode with id has more than one series ref", episodeId); try { String pdIntegrationKey = System.getenv("PD_INTEGRATION_KEY"); boolean pdRaiseIncidents = Boolean.parseBoolean(System.getenv( "PD_RAISE_INCIDENTS")); PagerDutyClientWithKey pagerDutyClient = new PagerDutyClientWithKey( PagerDutyEventsClient.create(), pdIntegrationKey, pdRaiseIncidents ); Payload payload = Payload.Builder.newBuilder() .setSummary( String.format( "Episode with id %s has multiple series refs; search" + "for 'seriesref' in Current Support Concerns", episodeId ) ) .setSource("atlas-deer-processing") .setSeverity(Severity.WARNING) .setTimestamp(OffsetDateTime.now()) .build(); pagerDutyClient.trigger(payload, String.valueOf(episodeId)); } catch (Exception e) { log.warn("Triggering PagerDuty incident failed for {}", episodeId, e); } } Map.Entry<Ref, SeriesRef> entry = Iterables.getOnlyElement(seriesRefs.entrySet()); Ref ref = entry.getKey(); SeriesRef seriesRef = entry.getValue(); org.atlasapi.content.SeriesRef deserialized = seriesRefSerialization.deserialize(seriesRef); episode.setSeriesRef(new org.atlasapi.content.SeriesRef( Id.valueOf(ref.getId()), Publisher.fromKey(ref.getSource()).requireValue(), deserialized.getTitle(), deserialized.getSeriesNumber(), deserialized.getUpdated(), deserialized.getReleaseYear(), deserialized.getCertificates() )); } }