Program: 61739
Project: 61739
Buggy source:
@Override public Optional<ContentKey> getLatest(String channel,ContentKey limitKey,Traces traces,boolean stable){
  DateTime ttlTime=getCacheTtlTime(channel,channelService.getCachedChannelConfig(channel));
  Optional<ContentKey> latest=spokeContentDao.getLatest(channel,limitKey,traces);
  if (latest.isPresent()) {
    logger.info("String_Node_Str",channel,latest);
    lastContentPath.delete(channel,CHANNEL_LATEST_UPDATED);
    return latest;
  }
  ContentPath latestCache=lastContentPath.get(channel,null,CHANNEL_LATEST_UPDATED);
  if (latestCache != null) {
    if (latestCache.getTime().isBefore(ttlTime)) {
      lastContentPath.delete(channel,CHANNEL_LATEST_UPDATED);
    }
    logger.info("String_Node_Str",channel,latestCache);
    if (latestCache.equals(ContentKey.NONE)) {
      return Optional.absent();
    }
    return Optional.of((ContentKey)latestCache);
  }
  DirectionQuery query=DirectionQuery.builder().channelName(channel).contentKey(limitKey).next(false).stable(stable).count(1).build();
  Collection<ContentKey> keys=channelService.getKeys(query);
  if (keys.isEmpty()) {
    logger.debug("String_Node_Str",channel);
    lastContentPath.updateIncrease(ContentKey.NONE,channel,CHANNEL_LATEST_UPDATED);
    return Optional.absent();
  }
 else {
    ContentKey latestKey=keys.iterator().next();
    if (latestKey.getTime().isAfter(ttlTime)) {
      logger.debug("String_Node_Str",channel,latestKey);
      lastContentPath.delete(channel,CHANNEL_LATEST_UPDATED);
    }
 else {
      logger.debug("String_Node_Str",channel,latestKey);
      lastContentPath.update(latestKey,channel,CHANNEL_LATEST_UPDATED);
    }
    return Optional.of(latestKey);
  }
}

Fixed version (ground truth):
@Override public Optional<ContentKey> getLatest(String channel,ContentKey limitKey,Traces traces,boolean stable){
  final ChannelConfig cachedChannelConfig=channelService.getCachedChannelConfig(channel);
  DateTime cacheTtlTime=getCacheTtlTime(channel,cachedChannelConfig);
  Optional<ContentKey> latest=spokeContentDao.getLatest(channel,limitKey,traces);
  if (latest.isPresent()) {
    logger.info("String_Node_Str",channel,latest);
    lastContentPath.delete(channel,CHANNEL_LATEST_UPDATED);
    return latest;
  }
  ContentPath latestCache=lastContentPath.get(channel,null,CHANNEL_LATEST_UPDATED);
  if (latestCache != null) {
    DateTime channelTtlTime=TimeUtil.time(false).minusDays((int)cachedChannelConfig.getTtlDays());
    if (latestCache.getTime().isBefore(channelTtlTime)) {
      lastContentPath.update(ContentKey.NONE,channel,CHANNEL_LATEST_UPDATED);
    }
    logger.info("String_Node_Str",channel,latestCache);
    if (latestCache.equals(ContentKey.NONE)) {
      return Optional.absent();
    }
    return Optional.of((ContentKey)latestCache);
  }
  DirectionQuery query=DirectionQuery.builder().channelName(channel).contentKey(limitKey).next(false).stable(stable).count(1).build();
  Collection<ContentKey> keys=channelService.getKeys(query);
  if (keys.isEmpty()) {
    logger.debug("String_Node_Str",channel);
    lastContentPath.updateIncrease(ContentKey.NONE,channel,CHANNEL_LATEST_UPDATED);
    return Optional.absent();
  }
 else {
    ContentKey latestKey=keys.iterator().next();
    if (latestKey.getTime().isAfter(cacheTtlTime)) {
      logger.debug("String_Node_Str",channel,latestKey);
      lastContentPath.delete(channel,CHANNEL_LATEST_UPDATED);
    }
 else {
      logger.debug("String_Node_Str",channel,latestKey);
      lastContentPath.update(latestKey,channel,CHANNEL_LATEST_UPDATED);
    }
    return Optional.of(latestKey);
  }
}