Program: 166376
Project: 166376
Buggy source:
@Override public void init(){
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str");
  }
  String errorText="String_Node_Str";
  if (policyResources != null && policyResources.size() > 0 && serviceDef != null) {
    Set<String> policyResourceKeySet=policyResources.keySet();
    RangerServiceDefHelper serviceDefHelper=new RangerServiceDefHelper(serviceDef,false);
    Set<List<RangerResourceDef>> validResourceHierarchies=serviceDefHelper.getResourceHierarchies();
    for (    List<RangerResourceDef> validResourceHierarchy : validResourceHierarchies) {
      Set<String> resourceDefNameSet=serviceDefHelper.getAllResourceNames(validResourceHierarchy);
      if ((Sets.difference(policyResourceKeySet,resourceDefNameSet)).isEmpty()) {
        firstValidResourceDefHierarchy=validResourceHierarchy;
        break;
      }
    }
    if (firstValidResourceDefHierarchy != null) {
      List<String> resourceDefNameOrderedList=serviceDefHelper.getAllResourceNamesOrdered(firstValidResourceDefHierarchy);
      boolean foundGapsInResourceSpecs=false;
      boolean skipped=false;
      for (      String resourceDefName : resourceDefNameOrderedList) {
        RangerPolicyResource policyResource=policyResources.get(resourceDefName);
        if (policyResource == null) {
          skipped=true;
        }
 else         if (skipped) {
          foundGapsInResourceSpecs=true;
          break;
        }
      }
      if (foundGapsInResourceSpecs) {
        errorText="String_Node_Str";
        if (LOG.isDebugEnabled()) {
          LOG.debug("String_Node_Str");
        }
        firstValidResourceDefHierarchy=null;
      }
 else {
        matchers=new HashMap<String,RangerResourceMatcher>();
        for (        RangerResourceDef resourceDef : firstValidResourceDefHierarchy) {
          String resourceName=resourceDef.getName();
          RangerPolicyResource policyResource=policyResources.get(resourceName);
          if (policyResource != null) {
            RangerResourceMatcher matcher=createResourceMatcher(resourceDef,policyResource);
            if (matcher != null) {
              matchers.put(resourceName,matcher);
            }
 else {
              LOG.error("String_Node_Str" + resourceName);
            }
          }
 else {
            if (LOG.isDebugEnabled()) {
              LOG.debug("String_Node_Str" + resourceName + "String_Node_Str");
            }
          }
        }
      }
    }
 else {
      errorText="String_Node_Str";
    }
  }
 else {
    errorText="String_Node_Str";
  }
  if (matchers == null) {
    Set<String> policyResourceKeys=policyResources == null ? null : policyResources.keySet();
    String keysString="String_Node_Str";
    if (CollectionUtils.isNotEmpty(policyResourceKeys)) {
      for (      String policyResourceKeyName : policyResourceKeys) {
        keysString+="String_Node_Str" + policyResourceKeyName + "String_Node_Str";
      }
    }
    String serviceDefName=serviceDef == null ? "String_Node_Str" : serviceDef.getName();
    String validHierarchy="String_Node_Str";
    if (CollectionUtils.isNotEmpty(firstValidResourceDefHierarchy)) {
      RangerServiceDefHelper serviceDefHelper=new RangerServiceDefHelper(serviceDef,false);
      List<String> resourceDefNameOrderedList=serviceDefHelper.getAllResourceNamesOrdered(firstValidResourceDefHierarchy);
      for (      String resourceDefName : resourceDefNameOrderedList) {
        validHierarchy+="String_Node_Str" + resourceDefName + "String_Node_Str";
      }
    }
    LOG.warn("String_Node_Str" + errorText + "String_Node_Str"+ serviceDefName+ "String_Node_Str"+ keysString+ "String_Node_Str"+ validHierarchy+ "String_Node_Str");
  }
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void init(){
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str");
  }
  String errorText="String_Node_Str";
  if (policyResources != null && policyResources.size() > 0 && serviceDef != null) {
    Set<String> policyResourceKeySet=policyResources.keySet();
    RangerServiceDefHelper serviceDefHelper=new RangerServiceDefHelper(serviceDef,false);
    Set<List<RangerResourceDef>> validResourceHierarchies=serviceDefHelper.getResourceHierarchies();
    for (    List<RangerResourceDef> validResourceHierarchy : validResourceHierarchies) {
      Set<String> resourceDefNameSet=serviceDefHelper.getAllResourceNames(validResourceHierarchy);
      if ((Sets.difference(policyResourceKeySet,resourceDefNameSet)).isEmpty()) {
        firstValidResourceDefHierarchy=validResourceHierarchy;
        break;
      }
    }
    if (firstValidResourceDefHierarchy != null) {
      List<String> resourceDefNameOrderedList=serviceDefHelper.getAllResourceNamesOrdered(firstValidResourceDefHierarchy);
      boolean foundGapsInResourceSpecs=false;
      boolean skipped=false;
      for (      String resourceDefName : resourceDefNameOrderedList) {
        RangerPolicyResource policyResource=policyResources.get(resourceDefName);
        if (policyResource == null) {
          skipped=true;
        }
 else         if (skipped) {
          foundGapsInResourceSpecs=true;
          break;
        }
      }
      if (foundGapsInResourceSpecs) {
        errorText="String_Node_Str";
        if (LOG.isDebugEnabled()) {
          LOG.debug("String_Node_Str");
        }
        firstValidResourceDefHierarchy=null;
      }
 else {
        matchers=new HashMap<String,RangerResourceMatcher>();
        for (        RangerResourceDef resourceDef : firstValidResourceDefHierarchy) {
          String resourceName=resourceDef.getName();
          RangerPolicyResource policyResource=policyResources.get(resourceName);
          if (policyResource != null) {
            RangerResourceMatcher matcher=createResourceMatcher(resourceDef,policyResource);
            if (matcher != null) {
              matchers.put(resourceName,matcher);
            }
 else {
              LOG.error("String_Node_Str" + resourceName);
            }
          }
 else {
            if (LOG.isDebugEnabled()) {
              LOG.debug("String_Node_Str" + resourceName + "String_Node_Str");
            }
          }
        }
      }
    }
 else {
      errorText="String_Node_Str";
    }
  }
 else {
    errorText="String_Node_Str";
  }
  if (matchers == null) {
    Set<String> policyResourceKeys=policyResources == null ? null : policyResources.keySet();
    StringBuffer sb=new StringBuffer();
    if (CollectionUtils.isNotEmpty(policyResourceKeys)) {
      for (      String policyResourceKeyName : policyResourceKeys) {
        sb.append("String_Node_Str").append(policyResourceKeyName).append("String_Node_Str");
      }
    }
    String keysString=sb.toString();
    String serviceDefName=serviceDef == null ? "String_Node_Str" : serviceDef.getName();
    String validHierarchy="String_Node_Str";
    if (CollectionUtils.isNotEmpty(firstValidResourceDefHierarchy)) {
      RangerServiceDefHelper serviceDefHelper=new RangerServiceDefHelper(serviceDef,false);
      List<String> resourceDefNameOrderedList=serviceDefHelper.getAllResourceNamesOrdered(firstValidResourceDefHierarchy);
      for (      String resourceDefName : resourceDefNameOrderedList) {
        validHierarchy+="String_Node_Str" + resourceDefName + "String_Node_Str";
      }
    }
    LOG.warn("String_Node_Str" + errorText + "String_Node_Str"+ serviceDefName+ "String_Node_Str"+ keysString+ "String_Node_Str"+ validHierarchy+ "String_Node_Str");
  }
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str");
  }
}