Program: 126497
Project: 126497
Buggy source:
public static String splitQueryData(String oldName,String newName,String value){
  String regex="String_Node_Str";
  String[] split=value.split(regex);
  Map<String,String> replacedStrings=new HashMap<String,String>();
  String returnValue="String_Node_Str";
  for (  String s : split) {
    if (s.contains(oldName)) {
      replacedStrings.put(s,s.replaceAll("String_Node_Str" + oldName + "String_Node_Str",newName));
    }
  }
  java.util.regex.Pattern pattern=java.util.regex.Pattern.compile(regex);
  Matcher matcher=pattern.matcher(value);
  if (matcher.find()) {
    int x=matcher.start();
    int y=matcher.end();
    int curPos=0;
    int valueLength=value.length();
    String oldFill=null;
    String newFill=null;
    while (true) {
      if (curPos == valueLength) {
        break;
      }
      if (curPos < x) {
        oldFill=value.substring(curPos,x);
        if ((newFill=replacedStrings.get(oldFill)) != null) {
          returnValue+=newFill;
        }
 else {
          returnValue+=oldFill;
        }
        curPos=x;
        continue;
      }
      returnValue+=matcher.group();
      curPos=y;
      if (!matcher.find()) {
        x=valueLength;
      }
 else {
        x=matcher.start();
        y=matcher.end();
      }
    }
  }
  return returnValue;
}

Fixed version (ground truth):
public static String splitQueryData(String oldName,String newName,String value){
  final int length=value.length();
  LinkedHashMap<Integer,Integer> quotaStrings=new LinkedHashMap<Integer,Integer>();
  List<Point> functionNameAreas=new ArrayList<Point>();
  int start=-1;
  int end=-2;
  char ch;
  for (int i=0; i < length; i++) {
    ch=value.charAt(i);
    if (ch == '\"') {
      if (isEscapeSequence(value,i)) {
        continue;
      }
      if (0 <= start && end < start) {
        end=i;
        quotaStrings.put(start,end);
      }
 else {
        start=i;
      }
    }
  }
{
  }
  StringBuffer strBuffer=new StringBuffer();
  String subString=null;
  int vStart=0;
  int vEnd=0;
  int methodMaxIndex=0;
  int calcMaxIndex=0;
  start=0;
  end=0;
  for (  Entry<Integer,Integer> entry : quotaStrings.entrySet()) {
    start=entry.getKey();
    end=entry.getValue() + 1;
    vEnd=start;
    if (vStart == start) {
      subString=value.substring(start,end);
      if (start < methodMaxIndex) {
        subString=subString.replaceAll(oldName,newName);
      }
    }
 else {
      subString=value.substring(vStart,vEnd);
      calcMaxIndex=calcMethodArea(subString,value,vStart,functionNameAreas,methodMaxIndex);
      if (methodMaxIndex < calcMaxIndex) {
        methodMaxIndex=calcMaxIndex;
      }
      String replacedString=doVaribleReplace(oldName,newName,value,functionNameAreas,vStart,vEnd);
      strBuffer.append(replacedString);
      subString=value.substring(start,end);
      if (start < methodMaxIndex) {
        subString=subString.replaceAll(oldName,newName);
      }
    }
    strBuffer.append(subString);
    vStart=end;
  }
  if (vStart < length) {
    vEnd=length;
    String replacedString=doVaribleReplace(oldName,newName,value,functionNameAreas,vStart,vEnd);
    strBuffer.append(replacedString);
  }
  return strBuffer.toString();
}