Program: 166394
Project: 166394
Buggy source:
@Override public ServiceTags getServiceTagsIfUpdated(String serviceName,Long lastKnownVersion) throws Exception {
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str" + serviceName + "String_Node_Str"+ lastKnownVersion+ "String_Node_Str");
  }
  ServiceTags ret=new ServiceTags();
  boolean tagsChanged=true;
  RangerService service=null;
  try {
    service=svcStore.getServiceByName(serviceName);
    ret.setServiceName(serviceName);
  }
 catch (  Exception exception) {
    LOG.error("String_Node_Str" + serviceName);
    tagsChanged=false;
  }
  if (lastKnownVersion != null && service != null && service.getTagVersion() != null && lastKnownVersion.compareTo(service.getTagVersion()) >= 0) {
    tagsChanged=false;
  }
  if (tagsChanged) {
    SearchFilter filter=new SearchFilter();
    filter.setParam(SearchFilter.TAG_RESOURCE_SERVICE_NAME,serviceName);
    List<RangerServiceResource> serviceResources=getServiceResources(filter);
    Map<Long,RangerTag> tagsMap=new HashMap<Long,RangerTag>();
    Map<Long,List<Long>> resourceToTagIdsMap=new HashMap<Long,List<Long>>();
    for (    RangerServiceResource serviceResource : serviceResources) {
      List<RangerTag> tagList=getTagsForServiceResourceObject(serviceResource);
      if (CollectionUtils.isNotEmpty(tagList)) {
        List<Long> tagIdList=new ArrayList<Long>();
        for (        RangerTag tag : tagList) {
          tagsMap.put(tag.getId(),tag);
          tagIdList.add(tag.getId());
        }
        resourceToTagIdsMap.put(serviceResource.getId(),tagIdList);
      }
    }
    if (MapUtils.isEmpty(resourceToTagIdsMap)) {
      serviceResources.clear();
    }
    ret.setServiceResources(serviceResources);
    ret.setResourceToTagIds(resourceToTagIdsMap);
    ret.setTags(tagsMap);
    if (service != null && service.getTagVersion() != null) {
      ret.setTagVersion(service.getTagVersion());
    }
    if (service != null && service.getTagUpdateTime() != null) {
      ret.setTagUpdateTime(service.getTagUpdateTime());
    }
    if (LOG.isDebugEnabled()) {
      LOG.debug("String_Node_Str" + (service == null ? null : service.getTagVersion()) + "String_Node_Str"+ lastKnownVersion);
    }
  }
 else {
    if (LOG.isDebugEnabled()) {
      LOG.debug("String_Node_Str" + (service == null ? null : service.getTagVersion()) + "String_Node_Str"+ lastKnownVersion);
    }
    ret.setTagVersion(lastKnownVersion);
  }
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str" + serviceName + "String_Node_Str"+ lastKnownVersion+ "String_Node_Str"+ ret);
  }
  return ret;
}

Fixed version (ground truth):
@Override public ServiceTags getServiceTagsIfUpdated(String serviceName,Long lastKnownVersion) throws Exception {
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str" + serviceName + "String_Node_Str"+ lastKnownVersion+ "String_Node_Str");
  }
  ServiceTags ret=new ServiceTags();
  boolean tagsChanged=true;
  RangerService service=null;
  try {
    service=svcStore.getServiceByName(serviceName);
    ret.setServiceName(serviceName);
  }
 catch (  Exception exception) {
    LOG.error("String_Node_Str" + serviceName);
    tagsChanged=false;
  }
  if (lastKnownVersion != null && service != null && service.getTagVersion() != null && lastKnownVersion.compareTo(service.getTagVersion()) >= 0) {
    tagsChanged=false;
  }
  if (tagsChanged) {
    SearchFilter filter=new SearchFilter();
    filter.setParam(SearchFilter.TAG_RESOURCE_SERVICE_NAME,serviceName);
    List<RangerServiceResource> serviceResources=getServiceResources(filter);
    List<RangerServiceResource> filteredServiceResources=new ArrayList<RangerServiceResource>();
    Map<Long,RangerTag> tagsMap=new HashMap<Long,RangerTag>();
    Map<Long,List<Long>> resourceToTagIdsMap=new HashMap<Long,List<Long>>();
    for (    RangerServiceResource serviceResource : serviceResources) {
      List<RangerTag> tagList=getTagsForServiceResourceObject(serviceResource);
      if (CollectionUtils.isNotEmpty(tagList)) {
        List<Long> tagIdList=new ArrayList<Long>();
        for (        RangerTag tag : tagList) {
          tagsMap.put(tag.getId(),tag);
          tagIdList.add(tag.getId());
        }
        resourceToTagIdsMap.put(serviceResource.getId(),tagIdList);
        filteredServiceResources.add(serviceResource);
      }
    }
    ret.setServiceResources(filteredServiceResources);
    ret.setResourceToTagIds(resourceToTagIdsMap);
    ret.setTags(tagsMap);
    if (service != null && service.getTagVersion() != null) {
      ret.setTagVersion(service.getTagVersion());
    }
    if (service != null && service.getTagUpdateTime() != null) {
      ret.setTagUpdateTime(service.getTagUpdateTime());
    }
    if (LOG.isDebugEnabled()) {
      LOG.debug("String_Node_Str" + (service == null ? null : service.getTagVersion()) + "String_Node_Str"+ lastKnownVersion);
    }
  }
 else {
    if (LOG.isDebugEnabled()) {
      LOG.debug("String_Node_Str" + (service == null ? null : service.getTagVersion()) + "String_Node_Str"+ lastKnownVersion);
    }
    ret.setTagVersion(lastKnownVersion);
  }
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str" + serviceName + "String_Node_Str"+ lastKnownVersion+ "String_Node_Str"+ ret);
  }
  return ret;
}