Source:
<code>public Response isHandOffComplete( @PathParam("dataSourceName") String dataSourceName, @QueryParam("interval") final String interval, @QueryParam("partitionNumber") final int partitionNumber, @QueryParam("version") final String version ) { try { final List<Rule> rules = databaseRuleManager.getRulesWithDefault(dataSourceName); final Interval theInterval = Intervals.of(interval); final SegmentDescriptor descriptor = new SegmentDescriptor(theInterval, version, partitionNumber); final DateTime now = DateTimes.nowUtc(); boolean dropped = true; for (Rule rule : rules) { if (rule.appliesTo(theInterval, now)) { if (rule instanceof LoadRule) { dropped = false; } break; } } if (dropped) { return Response.ok(true).build(); } TimelineLookup<String, SegmentLoadInfo> timeline = serverInventoryView.getTimeline( new TableDataSource(dataSourceName) ); if (timeline == null) { log.debug("No timeline found for datasource[%s]", dataSourceName); return Response.ok(false).build(); } Iterable<TimelineObjectHolder<String, SegmentLoadInfo>> lookup = timeline.lookupWithIncompletePartitions( theInterval); FunctionalIterable<ImmutableSegmentLoadInfo> loadInfoIterable = FunctionalIterable .create(lookup).transformCat( (TimelineObjectHolder<String, SegmentLoadInfo> input) -> Iterables.transform( input.getObject(), (PartitionChunk<SegmentLoadInfo> chunk) -> chunk.getObject().toImmutableSegmentLoadInfo() ) ); if (isSegmentLoaded(loadInfoIterable, descriptor)) { return Response.ok(true).build(); } return Response.ok(false).build(); } catch (Exception e) { <START> return Response.serverError().entity(ImmutableMap.of("error", e.toString())).build(); <END> } }</code><technical_language>logging full stack trace of exception well</technical_language>

Target:
public Response isHandOffComplete( @PathParam("dataSourceName") String dataSourceName, @QueryParam("interval") final String interval, @QueryParam("partitionNumber") final int partitionNumber, @QueryParam("version") final String version ) { try { final List<Rule> rules = databaseRuleManager.getRulesWithDefault(dataSourceName); final Interval theInterval = Intervals.of(interval); final SegmentDescriptor descriptor = new SegmentDescriptor(theInterval, version, partitionNumber); final DateTime now = DateTimes.nowUtc(); boolean dropped = true; for (Rule rule : rules) { if (rule.appliesTo(theInterval, now)) { if (rule instanceof LoadRule) { dropped = false; } break; } } if (dropped) { return Response.ok(true).build(); } TimelineLookup<String, SegmentLoadInfo> timeline = serverInventoryView.getTimeline( new TableDataSource(dataSourceName) ); if (timeline == null) { log.debug("No timeline found for datasource[%s]", dataSourceName); return Response.ok(false).build(); } Iterable<TimelineObjectHolder<String, SegmentLoadInfo>> lookup = timeline.lookupWithIncompletePartitions( theInterval); FunctionalIterable<ImmutableSegmentLoadInfo> loadInfoIterable = FunctionalIterable .create(lookup).transformCat( (TimelineObjectHolder<String, SegmentLoadInfo> input) -> Iterables.transform( input.getObject(), (PartitionChunk<SegmentLoadInfo> chunk) -> chunk.getObject().toImmutableSegmentLoadInfo() ) ); if (isSegmentLoaded(loadInfoIterable, descriptor)) { return Response.ok(true).build(); } return Response.ok(false).build(); } catch (Exception e) { log.error(e, "Error while handling hand off check request"); return Response.serverError().entity(ImmutableMap.of("error", e.toString())).build(); } }