Program: 41527
Project: 41527
Buggy source:
private String injectBPELVariables(String targetPropertyRef,PropertyMap propMap){
  String testQuery=targetPropertyRef.trim();
  if (!testQuery.endsWith("String_Node_Str")) {
    return null;
  }
  int functionOpeningBracket=testQuery.indexOf("String_Node_Str");
  String functionString=testQuery.substring(0,functionOpeningBracket);
  if (!functionString.equals("String_Node_Str")) {
    return null;
  }
  String functionContent=testQuery.substring(functionOpeningBracket + 1,testQuery.lastIndexOf("String_Node_Str")).trim();
  String[] functionParts=functionContent.split("String_Node_Str");
  List<String> augmentedFunctionParts=new ArrayList<String>();
  for (  String functionPart : functionParts) {
    if (functionPart.startsWith("String_Node_Str")) {
      augmentedFunctionParts.add(functionPart);
    }
 else     if (functionPart.split("String_Node_Str").length == 3) {
      String[] queryParts=functionPart.split("String_Node_Str");
      if (!queryParts[1].equals("String_Node_Str")) {
        return null;
      }
      String nodeTemplateName=queryParts[0];
      String propertyName=queryParts[2];
      Map<String,String> propertyName2BPELVarMap=propMap.getPropertyMappingMap(nodeTemplateName);
      if (propertyName2BPELVarMap == null) {
        return null;
      }
 else       if (propertyName2BPELVarMap.isEmpty()) {
        return null;
      }
      String bpelVarName=propertyName2BPELVarMap.get(propertyName);
      if (bpelVarName == null) {
        return null;
      }
      augmentedFunctionParts.add("String_Node_Str" + bpelVarName);
    }
  }
  String resultString=functionString + "String_Node_Str";
  for (  String functionPart : augmentedFunctionParts) {
    resultString+=functionPart + "String_Node_Str";
  }
  resultString=resultString.substring(0,resultString.length() - 1) + "String_Node_Str";
  return resultString;
}

Fixed version (ground truth):
private String injectBPELVariables(String targetPropertyRef,PropertyMap propMap){
  String testQuery=targetPropertyRef.trim();
  if (!testQuery.endsWith("String_Node_Str")) {
    return null;
  }
  int functionOpeningBracket=testQuery.indexOf("String_Node_Str");
  String functionString=testQuery.substring(0,functionOpeningBracket);
  if (!functionString.equals("String_Node_Str")) {
    return null;
  }
  String functionContent=testQuery.substring(functionOpeningBracket + 1,testQuery.lastIndexOf("String_Node_Str")).trim();
  String[] functionParts=functionContent.split("String_Node_Str");
  List<String> augmentedFunctionParts=new ArrayList<String>();
  for (  String functionPart : functionParts) {
    if (functionPart.trim().startsWith("String_Node_Str")) {
      augmentedFunctionParts.add(functionPart);
    }
 else     if (functionPart.trim().split("String_Node_Str").length == 3) {
      String[] queryParts=functionPart.trim().split("String_Node_Str");
      if (!queryParts[1].equals("String_Node_Str")) {
        return null;
      }
      String nodeTemplateName=queryParts[0];
      String propertyName=queryParts[2];
      Map<String,String> propertyName2BPELVarMap=propMap.getPropertyMappingMap(nodeTemplateName);
      if (propertyName2BPELVarMap == null) {
        return null;
      }
 else       if (propertyName2BPELVarMap.isEmpty()) {
        return null;
      }
      String bpelVarName=propertyName2BPELVarMap.get(propertyName);
      if (bpelVarName == null) {
        return null;
      }
      augmentedFunctionParts.add("String_Node_Str" + bpelVarName);
    }
  }
  String resultString=functionString + "String_Node_Str";
  for (  String functionPart : augmentedFunctionParts) {
    resultString+=functionPart + "String_Node_Str";
  }
  resultString=resultString.substring(0,resultString.length() - 1) + "String_Node_Str";
  return resultString;
}