Program: 22961
Project: 22961
Buggy source:
private Element getFromBundle(Element bundle,String ref,String fullUrl,List<ValidationMessage> errors,String path){
  String targetUrl=null;
  String version="String_Node_Str";
  if (ref.startsWith("String_Node_Str") || ref.startsWith("String_Node_Str")) {
    if (ref.contains("String_Node_Str")) {
      targetUrl=ref.substring(0,ref.indexOf("String_Node_Str") - 1);
      version=ref.substring(ref.indexOf("String_Node_Str") + 10);
    }
 else     targetUrl=ref;
  }
 else   if (fullUrl == null) {
    rule(errors,IssueType.REQUIRED,-1,-1,path,path.startsWith("String_Node_Str"),"String_Node_Str");
    return null;
  }
 else   if (ref.split("String_Node_Str").length != 2) {
    rule(errors,IssueType.INVALID,-1,-1,path,false,"String_Node_Str" + ref);
    return null;
  }
 else {
    String base="String_Node_Str";
    if (fullUrl.startsWith("String_Node_Str")) {
      String[] parts=fullUrl.split("String_Node_Str");
      for (int i=0; i < parts.length - 1; i++) {
        base=base + parts[i] + "String_Node_Str";
      }
    }
 else {
      String[] parts;
      parts=fullUrl.split("String_Node_Str");
      for (int i=0; i < parts.length - 2; i++) {
        base=base + parts[i] + "String_Node_Str";
      }
    }
    String id=null;
    if (ref.contains("String_Node_Str")) {
      version=ref.substring(ref.indexOf("String_Node_Str") + 10);
      id=ref.substring(0,ref.indexOf("String_Node_Str") - 1);
    }
 else     if (base.startsWith("String_Node_Str"))     id=ref.split("String_Node_Str")[1];
 else     id=ref;
    targetUrl=base + id;
  }
  List<Element> entries=new ArrayList<Element>();
  bundle.getNamedChildren("String_Node_Str",entries);
  Element match=null;
  for (  Element we : entries) {
    if (we.getChildValue("String_Node_Str").equals(targetUrl)) {
      Element r=we.getNamedChild("String_Node_Str");
      if (version.isEmpty()) {
        rule(errors,IssueType.FORBIDDEN,-1,-1,path,match == null,"String_Node_Str" + ref);
        match=r;
      }
 else {
        try {
          if (r.getChildren("String_Node_Str").get(0).getChildValue("String_Node_Str").equals(version)) {
            rule(errors,IssueType.FORBIDDEN,-1,-1,path,match == null,"String_Node_Str" + ref);
            match=r;
          }
        }
 catch (        Exception e) {
          warning(errors,IssueType.REQUIRED,-1,-1,path,r.getChildren("String_Node_Str").size() == 1 && r.getChildren("String_Node_Str").get(0).getChildValue("String_Node_Str") != null,"String_Node_Str" + targetUrl + "String_Node_Str");
        }
      }
    }
  }
  warning(errors,IssueType.REQUIRED,-1,-1,path,match != null || !targetUrl.startsWith("String_Node_Str"),"String_Node_Str" + ref);
  return match;
}

Fixed version (ground truth):
private Element getFromBundle(Element bundle,String ref,String fullUrl,List<ValidationMessage> errors,String path){
  String targetUrl=null;
  String version="String_Node_Str";
  if (ref.startsWith("String_Node_Str") || ref.startsWith("String_Node_Str")) {
    if (ref.contains("String_Node_Str")) {
      targetUrl=ref.substring(0,ref.indexOf("String_Node_Str") - 1);
      version=ref.substring(ref.indexOf("String_Node_Str") + 10);
    }
 else     targetUrl=ref;
  }
 else   if (fullUrl == null) {
    rule(errors,IssueType.REQUIRED,-1,-1,path,path.startsWith("String_Node_Str"),"String_Node_Str");
    return null;
  }
 else   if (ref.split("String_Node_Str").length != 2) {
    rule(errors,IssueType.INVALID,-1,-1,path,false,"String_Node_Str" + ref);
    return null;
  }
 else {
    String base="String_Node_Str";
    if (fullUrl.startsWith("String_Node_Str")) {
      String[] parts=fullUrl.split("String_Node_Str");
      for (int i=0; i < parts.length - 1; i++) {
        base=base + parts[i] + "String_Node_Str";
      }
    }
 else {
      String[] parts;
      parts=fullUrl.split("String_Node_Str");
      for (int i=0; i < parts.length - 2; i++) {
        base=base + parts[i] + "String_Node_Str";
      }
    }
    String id=null;
    if (ref.contains("String_Node_Str")) {
      version=ref.substring(ref.indexOf("String_Node_Str") + 10);
      id=ref.substring(0,ref.indexOf("String_Node_Str") - 1);
    }
 else     if (base.startsWith("String_Node_Str"))     id=ref.split("String_Node_Str")[1];
 else     id=ref;
    targetUrl=base + id;
  }
  List<Element> entries=new ArrayList<Element>();
  bundle.getNamedChildren("String_Node_Str",entries);
  Element match=null;
  for (  Element we : entries) {
    if (targetUrl.equals(we.getChildValue("String_Node_Str"))) {
      Element r=we.getNamedChild("String_Node_Str");
      if (version.isEmpty()) {
        rule(errors,IssueType.FORBIDDEN,-1,-1,path,match == null,"String_Node_Str" + ref);
        match=r;
      }
 else {
        try {
          if (version.equals(r.getChildren("String_Node_Str").get(0).getChildValue("String_Node_Str"))) {
            rule(errors,IssueType.FORBIDDEN,-1,-1,path,match == null,"String_Node_Str" + ref);
            match=r;
          }
        }
 catch (        Exception e) {
          warning(errors,IssueType.REQUIRED,-1,-1,path,r.getChildren("String_Node_Str").size() == 1 && r.getChildren("String_Node_Str").get(0).getChildValue("String_Node_Str") != null,"String_Node_Str" + targetUrl + "String_Node_Str");
        }
      }
    }
  }
  warning(errors,IssueType.REQUIRED,-1,-1,path,match != null || !targetUrl.startsWith("String_Node_Str"),"String_Node_Str" + ref);
  return match;
}