nus-yam/ex-repair huggingface dataset:
Program: 140852
Project: 140852
Buggy source:
private void uncachedFile(Integer index,String connID,File f,Integer extraLength,String extraHash,Triple[] data){
  try {
    f.createNewFile();
  }
 catch (  IOException e) {
    LOGGER.error("String_Node_Str" + f.getAbsolutePath(),e);
    return;
  }
  StringBuilder headerString=new StringBuilder();
  headerString.append("String_Node_Str").append(SEPERATOR);
  StringBuilder dataString=new StringBuilder();
  dataString.append(connID).append(SEPERATOR);
  for (index=extraLength; index < data.length - 1; index++) {
    Triple triple=data[index];
    headerString.append(triple.getPredicate()).append(SEPERATOR);
    dataString.append(triple.getObject()).append(SEPERATOR);
  }
  if (data.length != 0) {
    Triple triple=data[index];
    headerString.append(triple.getPredicate());
    dataString.append(triple.getObject());
  }
  try (PrintWriter pw=new PrintWriter(new FileOutputStream(f,true))){
    pw.println(headerString.toString());
    pw.println(dataString.toString());
  }
 catch (  IOException e) {
    LOGGER.error("String_Node_Str" + f.getAbsolutePath(),e);
    return;
  }
  taskFileExists.add(extraHash.toString());
}

Fixed version (ground truth):
private void uncachedFile(String connID,File f,Integer extraLength,String extraHash,Triple[] data){
  Integer index=0;
  try {
    f.createNewFile();
  }
 catch (  IOException e) {
    LOGGER.error("String_Node_Str" + f.getAbsolutePath(),e);
    return;
  }
  StringBuilder headerString=new StringBuilder();
  headerString.append("String_Node_Str").append(SEPERATOR);
  StringBuilder dataString=new StringBuilder();
  dataString.append(connID).append(SEPERATOR);
  for (index=extraLength; index < data.length - 1; index++) {
    Triple triple=data[index];
    headerString.append(triple.getPredicate()).append(SEPERATOR);
    dataString.append(triple.getObject()).append(SEPERATOR);
  }
  if (data.length != 0) {
    Triple triple=data[index];
    headerString.append(triple.getPredicate());
    dataString.append(triple.getObject());
  }
  try (PrintWriter pw=new PrintWriter(new FileOutputStream(f,true))){
    pw.println(headerString.toString());
    pw.println(dataString.toString());
  }
 catch (  IOException e) {
    LOGGER.error("String_Node_Str" + f.getAbsolutePath(),e);
    return;
  }
  taskFileExists.add(extraHash);
}
Program: 140853
Project: 140853
Buggy source:
@Override public void addData(Properties meta,Triple[] data){
  String taskID=meta.getProperty(COMMON.EXPERIMENT_TASK_ID_KEY);
  String[] strArr=taskToDir.get(taskID);
  StringBuilder dir=new StringBuilder(strArr[0]);
  Integer extraLength=(Integer)meta.get(CONSTANTS.LENGTH_EXTRA_META_KEY);
  Integer index=0;
  StringBuilder extraHash=createExtraHash(index,extraLength,data);
  File f=getFileForExtraHash(taskID,dir,meta,extraHash.toString());
  String connID=strArr[1];
  if (f.exists()) {
    cachedFile(index,connID,f,extraLength,data);
  }
 else {
    uncachedFile(index,connID,f,extraLength,extraHash.toString(),data);
  }
}

Fixed version (ground truth):
@Override public void addData(Properties meta,Triple[] data){
  String taskID=meta.getProperty(COMMON.EXPERIMENT_TASK_ID_KEY);
  String[] strArr=taskToDir.get(taskID);
  StringBuilder dir=new StringBuilder(strArr[0]);
  Integer extraLength=(Integer)meta.get(CONSTANTS.LENGTH_EXTRA_META_KEY);
  StringBuilder extraHash=new StringBuilder();
  createExtraHash(extraHash,extraLength,data);
  File f=getFileForExtraHash(dir,meta,extraHash.toString());
  String connID=strArr[1];
  if (f.exists()) {
    cachedFile(connID,f,extraLength,data);
  }
 else {
    uncachedFile(connID,f,extraLength,extraHash.toString(),data);
  }
}
Program: 140854
Project: 140854
Buggy source:
private File getFileForExtraHash(String taskID,StringBuilder dir,Properties meta,String extraHash){
  dir.append(meta.get(COMMON.METRICS_PROPERTIES_KEY));
  File dir1=new File(dir.toString());
  dir1.mkdirs();
  String fileName="String_Node_Str";
  if (extraHash.length() != 0) {
    fileName=extraHash.toString();
  }
 else {
    fileName=meta.get(COMMON.METRICS_PROPERTIES_KEY).toString();
  }
  File f=new File(dir.toString() + File.separator + fileName+ SUFFIX);
  return f;
}

Fixed version (ground truth):
private File getFileForExtraHash(StringBuilder dir,Properties meta,String extraHash){
  dir.append(meta.get(COMMON.METRICS_PROPERTIES_KEY));
  File dir1=new File(dir.toString());
  dir1.mkdirs();
  String fileName="String_Node_Str";
  if (extraHash.length() != 0) {
    fileName=extraHash;
  }
 else {
    fileName=meta.get(COMMON.METRICS_PROPERTIES_KEY).toString();
  }
  File f=new File(dir.toString() + File.separator + fileName+ SUFFIX);
  return f;
}
Program: 140855
Project: 140855
Buggy source:
private StringBuilder createExtraHash(Integer index,Integer extraLength,Triple[] data){
  StringBuilder extraHash=new StringBuilder();
  for (; index < extraLength - 1; index++) {
    extraHash.append(data[index].getPredicate().replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str")).append("String_Node_Str").append(data[index].getObject().toString().replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str")).append("String_Node_Str");
  }
  if (extraLength != 0) {
    extraHash.append(data[index].getPredicate().replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str")).append("String_Node_Str").append(data[index].getObject().toString().replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str"));
  }
  return extraHash;
}

Fixed version (ground truth):
private int createExtraHash(StringBuilder extraHash,Integer extraLength,Triple[] data){
  int index=0;
  for (; index < extraLength - 1; index++) {
    extraHash.append(data[index].getPredicate().replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str")).append("String_Node_Str").append(data[index].getObject().toString().replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str")).append("String_Node_Str");
  }
  if (extraLength != 0) {
    extraHash.append(data[index].getPredicate().replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str")).append("String_Node_Str").append(data[index].getObject().toString().replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str"));
  }
  return index;
}
Program: 140857
Project: 140857
Buggy source:
public FileStorage(String rootDir){
  this.rootDir=rootDir;
}

Fixed version (ground truth):
/** 
 * @param rootDir
 */
public FileStorage(String rootDir){
  this.rootDir=rootDir;
}
Program: 140859
Project: 140859
Buggy source:
public void recv() throws InstantiationException, IllegalAccessException, IOException, TimeoutException, IguanaException, InterruptedException {
  Config.getInstance("String_Node_Str");
  ExperimentManager em=new ExperimentManagerTest();
  IConsumer consume=new DefaultConsumer(em);
  String host=Config.getInstance().getString(COMMON.CONSUMER_HOST_KEY);
  String queueName=COMMON.CORE2RP_QUEUE_NAME;
  consume.init(host,queueName);
  Thread.sleep(2000);
  assertEquals(ConsumerTest.p.getProperty("String_Node_Str"),"String_Node_Str");
  System.out.println("String_Node_Str");
  consume.close();
}

Fixed version (ground truth):
public void recv(IConsumer consume) throws InstantiationException, IllegalAccessException, IOException, TimeoutException, IguanaException, InterruptedException {
  Config.getInstance("String_Node_Str");
  String host=Config.getInstance().getString(COMMON.CONSUMER_HOST_KEY);
  String queueName=COMMON.CORE2RP_QUEUE_NAME;
  consume.init(host,queueName);
  Thread.sleep(2000);
}
Program: 140860
Project: 140860
Buggy source:
@Test public void main() throws InstantiationException, IllegalAccessException, IOException, TimeoutException, IguanaException, InterruptedException {
  Config.getInstance("String_Node_Str");
  ConsumerTest ct=new ConsumerTest();
  ct.send();
  Thread.sleep(2000);
  ct.recv();
}

Fixed version (ground truth):
@Test public void main() throws InstantiationException, IllegalAccessException, IOException, TimeoutException, IguanaException, InterruptedException {
  Config.getInstance("String_Node_Str");
  ConsumerTest ct=new ConsumerTest();
  Properties p=new Properties();
  p.setProperty("String_Node_Str","String_Node_Str");
  ct.send(p);
  Thread.sleep(2000);
  ExperimentManager em=new ExperimentManagerTest();
  IConsumer consume=new DefaultConsumer(em);
  ct.recv(consume);
  assertEquals(ConsumerTest.p.getProperty("String_Node_Str"),"String_Node_Str");
  System.out.println("String_Node_Str");
  consume.close();
}
Program: 140861
Project: 140861
Buggy source:
public void send() throws IOException, TimeoutException {
  ConnectionFactory factory=new ConnectionFactory();
  factory.setHost("String_Node_Str");
  Connection connection=factory.newConnection();
  Channel channel=connection.createChannel();
  channel.queueDeclare(COMMON.CORE2RP_QUEUE_NAME,false,false,false,null);
  Properties p=new Properties();
  p.setProperty("String_Node_Str","String_Node_Str");
  ByteArrayOutputStream bos=new ByteArrayOutputStream();
  ObjectOutputStream oos=new ObjectOutputStream(bos);
  oos.writeObject(p);
  oos.flush();
  oos.close();
  bos.close();
  byte[] data=bos.toByteArray();
  channel.basicPublish("String_Node_Str",COMMON.CORE2RP_QUEUE_NAME,null,data);
}

Fixed version (ground truth):
public void send(Properties p) throws IOException, TimeoutException {
  ConnectionFactory factory=new ConnectionFactory();
  factory.setHost("String_Node_Str");
  Connection connection=factory.newConnection();
  Channel channel=connection.createChannel();
  channel.queueDeclare(COMMON.CORE2RP_QUEUE_NAME,false,false,false,null);
  ByteArrayOutputStream bos=new ByteArrayOutputStream();
  ObjectOutputStream oos=new ObjectOutputStream(bos);
  oos.writeObject(p);
  oos.flush();
  oos.close();
  bos.close();
  byte[] data=bos.toByteArray();
  channel.basicPublish("String_Node_Str",COMMON.CORE2RP_QUEUE_NAME,null,data);
}
Program: 140862
Project: 140862
Buggy source:
/** 
 * Saves a FEASIBLE Output to Query Per line
 * @param input FEASIBLE QUery list
 * @param queriesFile Output file
 * @throws IOException
 */
public void saveFeasibleToInstances(String input,String queriesFile) throws IOException {
  List<String[]> qs=QueryHandler.getFeasibleToList(input,Logger.getGlobal());
  PrintWriter pw=new PrintWriter(queriesFile);
  for (int i=0; i < qs.size() - 1; i++) {
    pw.println(qs.get(i)[0]);
  }
  pw.print(qs.get(qs.size() - 1)[0]);
  pw.close();
}

Fixed version (ground truth):
/** 
 * Saves a FEASIBLE Output to Query Per line
 * @param input FEASIBLE QUery list
 * @param queriesFile Output file
 * @throws IOException
 */
public void saveFeasibleToInstances(String input,String queriesFile) throws IOException {
  List<String[]> qs=QueryHandlerImpl.getFeasibleToList(input,Logger.getGlobal());
  PrintWriter pw=new PrintWriter(queriesFile);
  for (int i=0; i < qs.size() - 1; i++) {
    pw.println(qs.get(i)[0]);
  }
  pw.print(qs.get(qs.size() - 1)[0]);
  pw.close();
}
Program: 140864
Project: 140864
Buggy source:
@Override public int compare(String s1,String s2){
  s1=s1.trim();
  s2=s2.trim();
  s1=s1.replace("String_Node_Str","String_Node_Str");
  s2=s2.replace("String_Node_Str","String_Node_Str");
  String[] cmp1=s1.split("String_Node_Str");
  for (int k=3; k < cmp1.length; k++) {
    cmp1[2]+="String_Node_Str" + cmp1[k];
  }
  String[] cmp2=s2.split("String_Node_Str");
  for (int k=3; k < cmp2.length; k++) {
    cmp2[2]+="String_Node_Str" + cmp2[k];
  }
  int ret=cmp1[0].compareTo(cmp2[0]);
  if (ret == 0) {
    int t1=0, t2=0;
    if (cmp1[1].equals(CoherenceMetrics.TYPE_STRING)) {
      t1=-1;
    }
    if (cmp2[1].equals(CoherenceMetrics.TYPE_STRING)) {
      t2=1;
    }
    if (t1 == -1 && t2 == 1) {
      ret=0;
    }
 else     if (t1 == -1 || t2 == 1) {
      ret=t1 + t2;
    }
 else {
      ret=cmp1[1].compareTo(cmp2[1]);
    }
  }
  if (ret == 0) {
    ret=cmp1[2].compareTo(cmp2[2]);
  }
  return ret;
}

Fixed version (ground truth):
@Override public int compare(String s1,String s2){
  s1=s1.trim();
  s2=s2.trim();
  s1=s1.replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str").trim();
  s2=s2.replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str").trim();
  String[] cmp1=s1.split("String_Node_Str");
  if (cmp1.length < 2) {
    System.out.println("String_Node_Str" + cmp1[0]);
  }
  for (int k=3; k < cmp1.length; k++) {
    cmp1[2]+="String_Node_Str" + cmp1[k];
  }
  String[] cmp2=s2.split("String_Node_Str");
  for (int k=3; k < cmp2.length; k++) {
    cmp2[2]+="String_Node_Str" + cmp2[k];
  }
  int ret=cmp1[0].compareTo(cmp2[0]);
  if (ret == 0) {
    int t1=0, t2=0;
    if (cmp1[1].equals(CoherenceMetrics.TYPE_STRING)) {
      t1=-1;
    }
    if (cmp2[1].equals(CoherenceMetrics.TYPE_STRING)) {
      t2=1;
    }
    if (t1 == -1 && t2 == 1) {
      ret=0;
    }
 else     if (t1 == -1 || t2 == 1) {
      ret=t1 + t2;
    }
 else {
      ret=cmp1[1].compareTo(cmp2[1]);
    }
  }
  if (ret == 0) {
    ret=cmp1[2].compareTo(cmp2[2]);
  }
  return ret;
}
Program: 140867
Project: 140867
Buggy source:
/** 
 * NTRIPLE File to an insert or delete query.
 * @param file the file
 * @param insert if query should be insert (true) or delete (false)
 * @param graphUri the graph to use (can be null)
 * @return the query
 */
public static String ntToQuery(File file,Boolean insert,String graphUri){
  String query="String_Node_Str";
  query="String_Node_Str";
  if (!insert) {
    query="String_Node_Str";
  }
  if (graphUri != null) {
    query+="String_Node_Str" + graphUri + "String_Node_Str";
  }
  Model m=ModelFactory.createDefaultModel();
  m.read(file.toURI().toString());
  String lines=GraphHandler.GraphToSPARQLString(m.getGraph());
  lines=lines.substring(1,lines.length() - 1);
  query+=lines;
  if (graphUri != null) {
    query+="String_Node_Str";
  }
  query+="String_Node_Str";
  if (insert)   query+="String_Node_Str";
  return query;
}

Fixed version (ground truth):
/** 
 * NTRIPLE File to an insert or delete query.
 * @param file the file
 * @param insert if query should be insert (true) or delete (false)
 * @param graphUri the graph to use (can be null)
 * @return the query
 */
public static String ntToQuery(File file,Boolean insert,String graphUri){
  String query="String_Node_Str";
  query="String_Node_Str";
  if (!insert) {
    query="String_Node_Str";
  }
  if (graphUri != null) {
    query+="String_Node_Str" + graphUri + "String_Node_Str";
  }
  Model m=ModelFactory.createDefaultModel();
  m.read(file.toURI().toString());
  String lines=GraphHandler.GraphToSPARQLString(m.getGraph());
  lines=lines.substring(1,lines.length() - 1);
  query+=lines;
  if (graphUri != null) {
    query+="String_Node_Str";
  }
  query+="String_Node_Str";
  if (insert)   query+="String_Node_Str";
  System.out.println(query);
  return query;
}
Program: 140871
Project: 140871
Buggy source:
public static Query isSPARQL(String query){
  counter=0;
  parseSPARQL(query);
  if (SPARQLquery != null) {
    return SPARQLquery;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
public static Query isSPARQL(String query){
  parseSPARQL(query);
  if (SPARQLquery != null) {
    counter=0;
    return SPARQLquery;
  }
 else {
    counter=0;
    return null;
  }
}
Program: 140874
Project: 140874
Buggy source:
public static void sendIfEnd(){
  if (!end) {
    try {
      EmailHandler.sendBadNews("String_Node_Str",ZipUtils.folderToZip("String_Node_Str" + File.separator + Benchmark.RESULT_FILE_NAME,"String_Node_Str" + File.separator + Benchmark.RESULT_FILE_NAME+ "String_Node_Str"));
    }
 catch (    Exception e) {
      log.warning("String_Node_Str");
      LogHandler.writeStackTrace(log,e,Level.WARNING);
    }
  }
}

Fixed version (ground truth):
public static void sendIfEnd(){
  if (!end && mail) {
    try {
      EmailHandler.sendBadNews("String_Node_Str",ZipUtils.folderToZip("String_Node_Str" + File.separator + Benchmark.RESULT_FILE_NAME,"String_Node_Str" + File.separator + Benchmark.RESULT_FILE_NAME+ "String_Node_Str"));
    }
 catch (    Exception e) {
      log.warning("String_Node_Str");
      LogHandler.writeStackTrace(log,e,Level.WARNING);
    }
  }
}
Program: 140876
Project: 140876
Buggy source:
private static String[] queryIDListToQueries(LinkedList<Integer> queryList,File input) throws IOException {
  FileInputStream fis=null;
  BufferedReader br=null;
  String line="String_Node_Str";
  String[] ret=new String[queryList.size()];
  Collections.sort(queryList);
  Collections.reverse(queryList);
  try {
    fis=new FileInputStream(input);
    br=new BufferedReader(new InputStreamReader(fis,Charset.forName("String_Node_Str")));
    int i=0, j=0, t=0;
    j=queryList.get(t);
    while ((line=br.readLine()) != null) {
      if (j == i) {
        line=line.substring(0,line.lastIndexOf("String_Node_Str"));
        ret[t]=PatternSolution.queryToPattern(line);
        j=queryList.get(++t);
      }
      i++;
    }
  }
 catch (  IOException e) {
    LogHandler.writeStackTrace(log,e,Level.SEVERE);
  }
 finally {
    try {
      fis.close();
      br.close();
    }
 catch (    IOException e) {
      LogHandler.writeStackTrace(log,e,Level.SEVERE);
    }
  }
  return ret;
}

Fixed version (ground truth):
private static String[] queryIDListToQueries(LinkedList<Integer> queryList,File input) throws IOException {
  FileInputStream fis=null;
  BufferedReader br=null;
  String line="String_Node_Str";
  String[] ret=new String[queryList.size()];
  Collections.sort(queryList);
  try {
    fis=new FileInputStream(input);
    br=new BufferedReader(new InputStreamReader(fis,Charset.forName("String_Node_Str")));
    int i=0, j=0, t=0;
    while ((line=br.readLine()) != null) {
      j=queryList.get(t);
      if (j == i) {
        line=line.substring(0,line.lastIndexOf("String_Node_Str"));
        ret[t]=PatternSolution.queryToPattern(line);
        t++;
        if (t == queryList.size()) {
          break;
        }
      }
      i++;
    }
  }
 catch (  IOException e) {
    LogHandler.writeStackTrace(log,e,Level.SEVERE);
  }
 finally {
    try {
      fis.close();
      br.close();
    }
 catch (    IOException e) {
      LogHandler.writeStackTrace(log,e,Level.SEVERE);
    }
  }
  return ret;
}
Program: 140877
Project: 140877
Buggy source:
public static Integer getFreqSum(String[] cluster,File freqQueries){
  FileInputStream fis=null;
  BufferedReader br=null;
  String line="String_Node_Str";
  int q=0;
  List<String> cl=Arrays.asList(cluster);
  Integer ret=0;
  try {
    fis=new FileInputStream(freqQueries);
    br=new BufferedReader(new InputStreamReader(fis,Charset.forName("String_Node_Str")));
    while ((line=br.readLine()) != null && cl.isEmpty()) {
      if (line.isEmpty()) {
        continue;
      }
      for (      String qID : cl) {
        if (qID.equals("String_Node_Str" + q)) {
          ret+=Integer.parseInt(line.substring(line.lastIndexOf("String_Node_Str") + 1,line.length()));
          cl.remove(qID);
          break;
        }
      }
      q++;
    }
  }
 catch (  IOException e) {
    LogHandler.writeStackTrace(log,e,Level.SEVERE);
  }
 finally {
    try {
      fis.close();
      br.close();
    }
 catch (    IOException e) {
      LogHandler.writeStackTrace(log,e,Level.SEVERE);
    }
  }
  return ret;
}

Fixed version (ground truth):
public static Integer getFreqSum(String[] cluster,File freqQueries){
  FileInputStream fis=null;
  BufferedReader br=null;
  String line="String_Node_Str";
  int q=1;
  ArrayList<String> cl=new ArrayList<String>(Arrays.asList(cluster));
  Integer ret=0;
  try {
    fis=new FileInputStream(freqQueries);
    br=new BufferedReader(new InputStreamReader(fis,Charset.forName("String_Node_Str")));
    while ((line=br.readLine()) != null && !cl.isEmpty()) {
      if (line.isEmpty()) {
        continue;
      }
      for (      String qID : cl) {
        if (qID.equals("String_Node_Str" + q)) {
          ret+=Integer.parseInt(line.substring(line.lastIndexOf("String_Node_Str") + 1));
          cl.remove(qID);
          break;
        }
      }
      q++;
    }
  }
 catch (  IOException e) {
    LogHandler.writeStackTrace(log,e,Level.SEVERE);
  }
 finally {
    try {
      fis.close();
      br.close();
    }
 catch (    IOException e) {
      LogHandler.writeStackTrace(log,e,Level.SEVERE);
    }
  }
  return ret;
}
Program: 140878
Project: 140878
Buggy source:
public static void logToPatterns(PrintWriter pw,File input){
  FileInputStream fis=null;
  BufferedReader br=null;
  String line;
  try {
    fis=new FileInputStream(input);
    br=new BufferedReader(new InputStreamReader(fis,Charset.forName("String_Node_Str")));
    while ((line=br.readLine()) != null) {
      int index=line.indexOf("String_Node_Str");
      int lastIndex=line.indexOf("String_Node_Str",index + 1);
      line=line.substring(index,lastIndex);
      line=line.replaceFirst("String_Node_Str","String_Node_Str");
      if ((index=line.indexOf("String_Node_Str")) >= 0)       line=line.substring(0,index);
      line=URLDecoder.decode(line,"String_Node_Str");
      line=line.replaceAll("String_Node_Str","String_Node_Str");
      line=queryVarRename(line);
      try {
        QueryFactory.create(line);
        pw.println(line.replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str"));
      }
 catch (      QueryException e) {
        log.info("String_Node_Str" + line + "String_Node_Str"+ e);
      }
    }
    pw.flush();
  }
 catch (  IOException e) {
    LogHandler.writeStackTrace(log,e,Level.SEVERE);
  }
 finally {
    try {
      fis.close();
      br.close();
    }
 catch (    IOException e) {
      LogHandler.writeStackTrace(log,e,Level.SEVERE);
    }
  }
}

Fixed version (ground truth):
public static void logToPatterns(PrintWriter pw,File input){
  FileInputStream fis=null;
  BufferedReader br=null;
  String line;
  try {
    fis=new FileInputStream(input);
    br=new BufferedReader(new InputStreamReader(fis,Charset.forName("String_Node_Str")));
    while ((line=br.readLine()) != null) {
      int index=line.indexOf("String_Node_Str");
      int lastIndex=line.indexOf("String_Node_Str",index + 1);
      line=line.substring(index,lastIndex);
      line=line.replaceFirst("String_Node_Str","String_Node_Str");
      if ((index=line.indexOf("String_Node_Str")) >= 0)       line=line.substring(0,index);
      line=URLDecoder.decode(line,"String_Node_Str");
      line=line.replaceAll("String_Node_Str","String_Node_Str");
      line=queryVarRename(line);
      try {
        QueryFactory.create(line);
        pw.println(line.replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str"));
      }
 catch (      QueryException e) {
      }
    }
    pw.flush();
  }
 catch (  IOException e) {
    LogHandler.writeStackTrace(log,e,Level.SEVERE);
  }
 finally {
    try {
      fis.close();
      br.close();
    }
 catch (    IOException e) {
      LogHandler.writeStackTrace(log,e,Level.SEVERE);
    }
  }
}
Program: 140879
Project: 140879
Buggy source:
public static Collection<String> findLiterals(String query){
  Collection<String> ret=new HashSet<String>();
  String regex="String_Node_Str";
  String q=query;
  q=q.replaceAll("String_Node_Str","String_Node_Str");
  Pattern p=Pattern.compile(regex,Pattern.UNICODE_CHARACTER_CLASS);
  Matcher m=p.matcher(q);
  while (m.find()) {
    String literal=m.group();
    int index=literal.indexOf("String_Node_Str",3) + 3;
    if (literal.length() > index) {
      if (literal.charAt(index + 1) == '@') {
        index=literal.substring(index + 1).indexOf("String_Node_Str");
      }
 else       if (literal.substring(index + 1,index + 3) == "String_Node_Str") {
        index=literal.substring(index + 1).indexOf("String_Node_Str") + 1;
      }
    }
    literal=literal.substring(0,index);
    ret.add(literal);
    q=q.replace(literal,"String_Node_Str");
    m=p.matcher(q);
  }
  regex="String_Node_Str";
  p=Pattern.compile(regex,Pattern.UNICODE_CHARACTER_CLASS);
  m=p.matcher(q);
  while (m.find()) {
    String literal=m.group();
    literal=literal.substring(0,literal.length() - 1);
    ret.add(literal);
    q=q.replace(literal,"String_Node_Str");
  }
  regex="String_Node_Str";
  p=Pattern.compile(regex,Pattern.UNICODE_CHARACTER_CLASS);
  m=p.matcher(q);
  while (m.find()) {
    String literal=m.group();
    literal=literal.substring(0,literal.length() - 1);
    ret.add(literal);
  }
  return ret;
}

Fixed version (ground truth):
public static Collection<String> findLiterals(String query){
  Collection<String> ret=new HashSet<String>();
  String regex="String_Node_Str";
  String q=query;
  q=q.replaceAll("String_Node_Str","String_Node_Str");
  Pattern p=Pattern.compile(regex,Pattern.UNICODE_CHARACTER_CLASS);
  Matcher m=p.matcher(q);
  while (m.find()) {
    String literal=m.group();
    int index=literal.indexOf("String_Node_Str",3) + 3;
    if (literal.length() > index) {
      if (literal.charAt(index + 1) == '@') {
        index=literal.substring(index + 1).indexOf("String_Node_Str");
      }
 else       if (literal.substring(index + 1,index + 3) == "String_Node_Str") {
        index=literal.substring(index + 1).indexOf("String_Node_Str") + 1;
      }
    }
    literal=literal.substring(0,index);
    ret.add(literal);
    q=q.replace(literal,"String_Node_Str");
    m=p.matcher(q);
  }
  regex="String_Node_Str";
  p=Pattern.compile(regex,Pattern.UNICODE_CHARACTER_CLASS);
  m=p.matcher(q);
  while (m.find()) {
    String literal=m.group();
    literal=literal.substring(0,literal.length() - 1);
    ret.add(literal);
    q=q.replace(literal,"String_Node_Str");
  }
  regex="String_Node_Str";
  p=Pattern.compile(regex,Pattern.UNICODE_CHARACTER_CLASS);
  m=p.matcher(q.replaceAll("String_Node_Str","String_Node_Str"));
  while (m.find()) {
    String literal=m.group();
    literal=literal.substring(0,literal.length() - 1);
    ret.add(literal);
  }
  return ret;
}
Program: 140880
Project: 140880
Buggy source:
public static void main(String[] argc){
  String test="String_Node_Str";
  System.out.println(test);
  System.out.println(queryIRIsToVars(test,0));
  System.out.println(queryToPattern(test));
}

Fixed version (ground truth):
public static void main(String[] argc){
  String test="String_Node_Str";
  test="String_Node_Str";
  System.out.println(test);
  System.out.println(queryIRIsToVars(test,0));
  System.out.println(queryToPattern(test));
}
Program: 140881
Project: 140881
Buggy source:
private void init(String queriesFile) throws IOException {
  rand=new Random(2);
  File f=new File(failedQueries);
  if (f.exists())   f.delete();
  List<String> queryPatterns=Files.readAllLines(Paths.get(queriesFile),Charset.forName("String_Node_Str"));
  int i=0;
  for (  String p : queryPatterns) {
    if (p.isEmpty()) {
      continue;
    }
    if ((p.toLowerCase().contains("String_Node_Str") || p.toLowerCase().contains("String_Node_Str") || p.toLowerCase().contains("String_Node_Str")|| p.toLowerCase().contains("String_Node_Str"))) {
      valuesToCSV(p,String.valueOf(i));
    }
 else {
      updatePattern(p,String.valueOf(i));
    }
    i++;
  }
}

Fixed version (ground truth):
private void init(String queriesFile) throws IOException {
  rand=new Random(2);
  File f=new File(failedQueries);
  if (f.exists())   f.delete();
  List<String> queryPatterns=Files.readAllLines(Paths.get(queriesFile),Charset.forName("String_Node_Str"));
  int i=0;
  for (  String p : queryPatterns) {
    if (p.isEmpty()) {
      continue;
    }
    String test="String_Node_Str" + p.toLowerCase().replaceAll("String_Node_Str","String_Node_Str");
    if ((test.contains("String_Node_Str") || test.contains("String_Node_Str") || test.contains("String_Node_Str")|| test.contains("String_Node_Str"))) {
      valuesToCSV(p,String.valueOf(i));
    }
 else {
      System.out.println(test);
      System.out.println(p);
      updatePattern(p,String.valueOf(i));
    }
    i++;
  }
}
Program: 140882
Project: 140882
Buggy source:
private int valuesToCSV(String pattern,String fileName) throws IOException {
  String query=String.valueOf(pattern);
  int ret=0;
  try {
    new File(path).mkdirs();
    File failed=new File(failedQueries + "String_Node_Str");
    failed.createNewFile();
    File f=new File(path + fileName + "String_Node_Str");
    f.createNewFile();
    PrintWriter pwfailed=new PrintWriter(new FileOutputStream(failed,true));
    PrintWriter pw=new PrintWriter(new OutputStreamWriter(new FileOutputStream(f),StandardCharsets.UTF_8),true);
    String q=selectPattern(query);
    ResultSet res=con.execute(q);
    Boolean result=false;
    while (res.next()) {
      result=true;
      ResultSetMetaData rsmd=res.getMetaData();
      int columns=rsmd.getColumnCount();
      String line="String_Node_Str";
      List<Object> vars=new LinkedList<Object>();
      for (int i=1; i <= columns; i++) {
        Object current=res.getObject(i);
        Node cur=TripleStoreHandler.implToNode(current);
        vars.add(GraphHandler.NodeToSPARQLString(cur));
      }
      line=patternToQuery(pattern,vars);
      pw.write(line);
      pw.println();
      ret++;
    }
    pw.close();
    if (!result) {
      pwfailed.write(pattern);
      pwfailed.println();
      f.delete();
    }
    pwfailed.close();
    return ret;
  }
 catch (  Exception e) {
    e.printStackTrace();
    return ret;
  }
}

Fixed version (ground truth):
private int valuesToCSV(String pattern,String fileName) throws IOException {
  String query=String.valueOf(pattern);
  int ret=0;
  try {
    new File(path).mkdirs();
    File failed=new File(failedQueries + "String_Node_Str");
    failed.createNewFile();
    File f=new File(path + fileName + "String_Node_Str");
    f.createNewFile();
    PrintWriter pwfailed=new PrintWriter(new FileOutputStream(failed,true));
    PrintWriter pw=new PrintWriter(new OutputStreamWriter(new FileOutputStream(f),StandardCharsets.UTF_8),true);
    String q=selectPattern(query);
    ResultSet res=null;
    if (!QuerySorter.isSPARQL(q)) {
    }
 else {
      res=con.execute(q);
    }
    Boolean result=false;
    if (res != null) {
      while (res.next()) {
        result=true;
        ResultSetMetaData rsmd=res.getMetaData();
        int columns=rsmd.getColumnCount();
        String line="String_Node_Str";
        List<Object> vars=new LinkedList<Object>();
        for (int i=1; i <= columns; i++) {
          Object current=res.getObject(i);
          if (current == null) {
            vars.add("String_Node_Str");
            continue;
          }
          Node cur=TripleStoreHandler.implToNode(current);
          vars.add(GraphHandler.NodeToSPARQLString(cur));
        }
        line=patternToQuery(pattern,vars);
        pw.write(line);
        pw.println();
        ret++;
      }
    }
    pw.close();
    if (!result) {
      pwfailed.write(pattern);
      pwfailed.println();
      f.delete();
    }
    pwfailed.close();
    return ret;
  }
 catch (  Exception e) {
    e.printStackTrace();
    return ret;
  }
}
Program: 140883
Project: 140883
Buggy source:
private static HashMap<String,List<String>> queryMixesPerHour(Connection con,HashMap<String,List<String>> queries,HashMap<String,List<String>> map){
  List<String> row2=new ArrayList<String>();
  log.info("String_Node_Str");
  Long time=0L;
  Long count=0L;
  String query="String_Node_Str";
  Random gen=new Random(1);
  Random gen2=new Random(2);
  while (time <= 3600000) {
    Integer querySetNumber=(int)(gen.nextDouble() * (queries.size()));
    Iterator<String> it=queries.keySet().iterator();
    String setNumber="String_Node_Str";
    for (Integer i=0; i <= querySetNumber; i++) {
      setNumber=it.next();
    }
    List<String> querySet=queries.get(setNumber);
    query=querySet.get((int)(gen2.nextDouble() * (querySet.size())));
    Date start=new Date();
    try {
      con.select(query);
    }
 catch (    SQLException e) {
      log.warning("String_Node_Str" + query + "String_Node_Str");
      continue;
    }
    Date end=new Date();
    count++;
    time+=end.getTime() - start.getTime();
  }
  row2.add(count.toString());
  log.fine("String_Node_Str");
  map.put("String_Node_Str",row2);
  return map;
}

Fixed version (ground truth):
private static HashMap<String,List<String>> queryMixesPerHour(Connection con,HashMap<String,List<String>> queries,String graphURI,String fromGraph,HashMap<String,List<String>> map){
  List<String> row2=new ArrayList<String>();
  log.info("String_Node_Str");
  Long time=0L;
  Long count=0L;
  String query="String_Node_Str";
  Random gen=new Random(1);
  Random gen2=new Random(2);
  while (time <= 3600000) {
    Integer querySetNumber=(int)(gen.nextDouble() * (queries.size()));
    Iterator<String> it=queries.keySet().iterator();
    String setNumber="String_Node_Str";
    for (Integer i=0; i <= querySetNumber; i++) {
      setNumber=it.next();
    }
    List<String> querySet=queries.get(setNumber);
    query=querySet.get((int)(gen2.nextDouble() * (querySet.size()))).replace("String_Node_Str" + graphURI + "String_Node_Str","String_Node_Str" + fromGraph + "String_Node_Str");
    ;
    Date start=new Date();
    try {
      con.select(query);
    }
 catch (    SQLException e) {
      log.warning("String_Node_Str" + query + "String_Node_Str");
      continue;
    }
    Date end=new Date();
    count++;
    time+=end.getTime() - start.getTime();
  }
  row2.add(count.toString());
  log.fine("String_Node_Str");
  map.put("String_Node_Str",row2);
  return map;
}
Program: 140884
Project: 140884
Buggy source:
/** 
 * Starten den Benchmark und testet die Zeit der Queries
 * @param con Connection zum Triplestore
 * @param queries Die SPARQL Anfragen als Strings
 * @param logName Log Name welcher fürs Loggen benutzt werden soll
 * @param fromGraph Named Graph welcher benutzt wird
 * @return gibt Liste mit gemessenen Parametern zurück zu jeweiligem Test
 */
public static HashMap<String,List<String>> start(Connection con,HashMap<String,List<String>> queries,String logName,String graphURI,String fromGraph){
  HashMap<String,List<String>> map=new HashMap<String,List<String>>();
  map=queriesPerSecond(con,queries,graphURI,fromGraph,map);
  map=queryMixesPerHour(con,queries,map);
  return map;
}

Fixed version (ground truth):
/** 
 * Starten den Benchmark und testet die Zeit der Queries
 * @param con Connection zum Triplestore
 * @param queries Die SPARQL Anfragen als Strings
 * @param logName Log Name welcher fürs Loggen benutzt werden soll
 * @param fromGraph Named Graph welcher benutzt wird
 * @return gibt Liste mit gemessenen Parametern zurück zu jeweiligem Test
 */
public static HashMap<String,List<String>> start(Connection con,HashMap<String,List<String>> queries,String logName,String graphURI,String fromGraph){
  HashMap<String,List<String>> map=new HashMap<String,List<String>>();
  map=queriesPerSecond(con,queries,graphURI,fromGraph,map);
  map=queryMixesPerHour(con,queries,graphURI,fromGraph,map);
  return map;
}
Program: 140886
Project: 140886
Buggy source:
private static String[] getDatasetFiles(Connection con){
  String[] ret=new String[percents.size()];
  new File("String_Node_Str" + File.separator).mkdir();
  String fileName="String_Node_Str" + File.separator + "String_Node_Str";
  log.info("String_Node_Str");
  TripleStoreHandler.writeDatasetToFile(con,config.get("String_Node_Str"),fileName);
  for (int i=0; i < percents.size(); i++) {
    if (percents.get(i) == 1.0) {
      ret[i]=fileName;
      continue;
    }
    String outputFile="String_Node_Str" + File.separator + "String_Node_Str"+ i * 100 + "String_Node_Str";
    DataGenerator.generateData(con,config.get("String_Node_Str"),fileName,outputFile,config.get("String_Node_Str"),percents.get(i));
    log.info("String_Node_Str" + percents.get(i) * 100 + "String_Node_Str");
  }
  return ret;
}

Fixed version (ground truth):
private static String[] getDatasetFiles(Connection con,String hundredFile){
  String[] ret=new String[percents.size()];
  new File("String_Node_Str" + File.separator).mkdir();
  String fileName=hundredFile;
  if (hundredFile == null || !(new File(hundredFile).exists())) {
    fileName="String_Node_Str" + File.separator + "String_Node_Str";
    log.info("String_Node_Str");
    TripleStoreHandler.writeDatasetToFile(con,config.get("String_Node_Str"),fileName);
  }
  for (int i=0; i < percents.size(); i++) {
    if (percents.get(i) == 1.0) {
      ret[i]=fileName;
      continue;
    }
    String outputFile="String_Node_Str" + File.separator + "String_Node_Str"+ i * 100 + "String_Node_Str";
    DataGenerator.generateData(con,config.get("String_Node_Str"),fileName,outputFile,config.get("String_Node_Str"),percents.get(i));
    log.info("String_Node_Str" + percents.get(i) * 100 + "String_Node_Str");
  }
  return ret;
}
Program: 140887
Project: 140887
Buggy source:
public static String queryIRIsToVars(String query){
  String ret=query;
  Pattern p=Pattern.compile("String_Node_Str",Pattern.UNICODE_CHARACTER_CLASS);
  Matcher m=p.matcher(ret);
  int i=1;
  while (m.find()) {
    ret.replace(m.group(),"String_Node_Str" + i);
    i++;
  }
  return ret;
}

Fixed version (ground truth):
private static String queryIRIsToVars(String query,int literals){
  String ret=query;
  Pattern p=Pattern.compile("String_Node_Str",Pattern.UNICODE_CHARACTER_CLASS);
  Matcher m=p.matcher(ret);
  int i=1, count=0;
  while (m.find() && count < 2) {
    count++;
  }
  if (count == 0) {
    return "String_Node_Str" + ret;
  }
  if (count < 2 && literals == 0) {
    if (m.find(0)) {
      String gr=m.group();
      ret=ret.replace(gr.substring(gr.lastIndexOf("String_Node_Str")),"String_Node_Str");
    }
    return "String_Node_Str" + ret;
  }
  m.find(0);
  do {
    String gr=m.group();
    ret=ret.replace(gr.substring(gr.lastIndexOf("String_Node_Str")),"String_Node_Str" + i + "String_Node_Str");
    i++;
  }
 while (m.find());
  return i + "String_Node_Str" + ret;
}
Program: 140888
Project: 140888
Buggy source:
public static String queryToPattern(String query){
  String pattern=query;
  int i=1;
  Collection<String> literals=findLiterals(query);
  if (literals.size() == 0) {
    return query;
  }
  if (literals.size() == 1) {
    if (literalInFilterClause(query,literals.iterator().next())) {
      return query;
    }
    return query.replace(literals.iterator().next(),"String_Node_Str");
  }
  for (  String literal : literals) {
    if (literalInFilterClause(query,literal)) {
      continue;
    }
    pattern=pattern.replace(literal,"String_Node_Str" + i + "String_Node_Str");
    i++;
  }
  return pattern;
}

Fixed version (ground truth):
public static String queryToPattern(String query){
  String pattern=query;
  int i=1;
  Collection<String> literals=findLiterals(query);
  pattern=queryIRIsToVars(pattern,literals.size());
  i=Integer.parseInt(pattern.substring(0,pattern.indexOf("String_Node_Str")));
  pattern=pattern.substring(pattern.indexOf("String_Node_Str") + 1);
  if (literals.size() == 0) {
    return pattern;
  }
  if (i + literals.size() == 1) {
    if (literalInFilterClause(query,literals.iterator().next())) {
      return pattern;
    }
    return query.replace(literals.iterator().next(),"String_Node_Str");
  }
  for (  String literal : literals) {
    if (literalInFilterClause(query,literal)) {
      continue;
    }
    pattern=pattern.replace(literal,"String_Node_Str" + i + "String_Node_Str");
    i++;
  }
  return pattern;
}
Program: 140889
Project: 140889
Buggy source:
public static void main(String[] argc){
  String test="String_Node_Str";
  System.out.println(test);
  System.out.println(queryToPattern(test));
}

Fixed version (ground truth):
public static void main(String[] argc){
  String test="String_Node_Str";
  System.out.println(test);
  System.out.println(queryIRIsToVars(test,0));
  System.out.println(queryToPattern(test));
}
Program: 140891
Project: 140891
Buggy source:
/** 
 * @param args
 */
public static void main(String[] args){
  if (System.console() == null) {
    args=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  }
  execute(args);
}

Fixed version (ground truth):
/** 
 * @param args
 */
public static void main(String[] args){
  if (System.console() == null) {
    args=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  }
  execute(args);
}
Program: 140893
Project: 140893
Buggy source:
public Integer getWordNumber(Word word){
  if (spanToWordNumberMap == null) {
    populateSpanToWorNumberMap();
  }
  Integer wordNumber=spanToWordNumberMap.get(word.getSpanSignature());
  if (wordNumber == null) {
    log.debug("String_Node_Str" + word + "String_Node_Str"+ spanToWordNumberMap+ "String_Node_Str"+ sentenceWords);
    log.warn("String_Node_Str" + governorWordRelationMap.size() + "String_Node_Str"+ dependentWordRelationMap.size()+ "String_Node_Str"+ sentenceWords.size());
  }
  return wordNumber;
}

Fixed version (ground truth):
public Integer getWordNumber(Word word){
  if (spanToWordNumberMap == null) {
    populateSpanToWordNumberMap();
  }
  Integer wordNumber=spanToWordNumberMap.get(word.getSpanSignature());
  if (wordNumber == null) {
    log.debug("String_Node_Str" + word + "String_Node_Str"+ spanToWordNumberMap+ "String_Node_Str"+ sentenceWords);
    log.warn("String_Node_Str" + governorWordRelationMap.size() + "String_Node_Str"+ dependentWordRelationMap.size()+ "String_Node_Str"+ sentenceWords.size());
  }
  return wordNumber;
}
Program: 140894
Project: 140894
Buggy source:
public static Word createMultiword(List<Word> singleWords){
  StringBuffer composedWordForm=new StringBuffer();
  StringBuffer composedLemma=new StringBuffer();
  PartOfSpeech composedPosTag=PartOfSpeech.MULTIWORD;
  for (  Word singleWord : singleWords) {
    composedWordForm.append(singleWord.wordForm);
    composedWordForm.append("String_Node_Str");
    composedLemma.append(singleWord.getLemma());
    composedLemma.append("String_Node_Str");
  }
  Word word=new Word(composedWordForm.toString().trim(),composedLemma.toString().trim(),composedPosTag,singleWords.get(0).span.begin,singleWords.get(singleWords.size() - 1).span.end,singleWords);
  return word;
}

Fixed version (ground truth):
public static Word createMultiword(List<Word> singleWords){
  StringBuffer composedWordForm=new StringBuffer();
  StringBuffer composedLemma=new StringBuffer();
  PartOfSpeech composedPosTag=determineMultiwordPartOfSpeech(singleWords);
  for (  Word singleWord : singleWords) {
    composedWordForm.append(singleWord.wordForm);
    composedWordForm.append("String_Node_Str");
    composedLemma.append(singleWord.getLemma());
    composedLemma.append("String_Node_Str");
  }
  Word word=new Word(composedWordForm.toString().trim(),composedLemma.toString().trim(),composedPosTag,singleWords.get(0).span.begin,singleWords.get(singleWords.size() - 1).span.end,singleWords);
  return word;
}
Program: 140895
Project: 140895
Buggy source:
@Override public byte[] put(byte[] k,byte[] v){
  final long hash=Hash.murmurHash(k);
  final long dataPtr=writeKeyVal(k,v);
synchronized (lockForHash(hash)) {
    final SearchResult sr=locateRecord(k,hash);
    if (sr.val != null) {
      RecordPtr.overwrite(sr.foundMapper,sr.foundPos,hash,dataPtr,k.length,v.length);
    }
 else     if (sr.freeMapper != null) {
      RecordPtr.overwrite(sr.freeMapper,sr.freePos,hash,dataPtr,k.length,v.length);
      size.incrementAndGet();
    }
 else {
      final RecordPtr recPtr=new RecordPtr(hash,dataPtr,k.length,v.length);
      final long bucketPos=allocateSecondaryBucket(sr.lastBucketMapper,sr.lastBucketPos);
      writeRecordsToBucketChain(bucketPos,sr.lastBucketMapper,Arrays.asList(new RecordPtr[]{recPtr}));
      size.incrementAndGet();
    }
    return sr.val;
  }
}

Fixed version (ground truth):
@Override public byte[] put(byte[] k,byte[] v){
  final long hash=Hash.murmurHash(k);
  final long dataPtr=writeKeyVal(k,v);
synchronized (lockForHash(hash)) {
    final SearchResult sr=locateRecord(k,hash);
    if (sr.val != null) {
      RecordPtr.overwrite(sr.foundMapper,sr.foundPos,hash,dataPtr,k.length,v.length);
    }
 else     if (sr.freeMapper != null) {
      RecordPtr.overwrite(sr.freeMapper,sr.freePos,hash,dataPtr,k.length,v.length);
      size.incrementAndGet();
    }
 else {
      final RecordPtr recPtr=new RecordPtr(hash,dataPtr,k.length,v.length);
      final long bucketPos=allocateSecondaryBucket(sr.lastBucketMapper,sr.lastBucketPos);
      writeRecordsToBucketChain(bucketPos,secondaryMapper,Arrays.asList(new RecordPtr[]{recPtr}));
      size.incrementAndGet();
    }
    return sr.val;
  }
}
Program: 140896
Project: 140896
Buggy source:
private SearchResult locateRecord(byte[] k,long hash){
  final SearchResult out=new SearchResult();
  final long idx=idxForHash(hash);
  final int startSubIdx=subIdxForHash(hash);
  MMapper mapper=primaryMapper;
  long bucketPos=idxToPos(idx);
  long nextBucketPos=getNextBucketPos(bucketPos,mapper);
  if (findInBucket(mapper,hash,k,bucketPos,startSubIdx,out))   return out;
  mapper=secondaryMapper;
  while (nextBucketPos != 0) {
    bucketPos=nextBucketPos;
    nextBucketPos=getNextBucketPos(bucketPos,mapper);
    if (findInBucket(mapper,hash,k,bucketPos,startSubIdx,out))     return out;
  }
  out.lastBucketMapper=mapper;
  out.lastBucketPos=bucketPos;
  return out;
}

Fixed version (ground truth):
private SearchResult locateRecord(byte[] k,long hash){
  final SearchResult out=new SearchResult();
  final long idx=idxForHash(hash);
  final int startSubIdx=subIdxForHash(hash);
  MMapper mapper=primaryMapper;
  long bucketPos=idxToPos(idx);
  long nextBucketPos=getNextBucketPos(bucketPos,mapper);
  if (findInBucket(mapper,hash,k,bucketPos,startSubIdx,out))   return out;
  while (nextBucketPos != 0) {
    mapper=secondaryMapper;
    bucketPos=nextBucketPos;
    nextBucketPos=getNextBucketPos(bucketPos,mapper);
    if (findInBucket(mapper,hash,k,bucketPos,startSubIdx,out))     return out;
  }
  out.lastBucketMapper=mapper;
  out.lastBucketPos=bucketPos;
  return out;
}
Program: 140897
Project: 140897
Buggy source:
@Override protected void rehashIdx(long idx){
  final long keepIdx=idx, moveIdx=idx + tableLength;
  final ArrayList<RecordPtr> keepBuckets=new ArrayList<RecordPtr>();
  final ArrayList<RecordPtr> moveBuckets=new ArrayList<RecordPtr>();
  long keepBucketPos=idxToPos(idx);
  long moveBucketPos=idxToPos(moveIdx);
{
    final ArrayList<RecordPtr> allBuckets=new ArrayList<RecordPtr>();
    accumRecordsInBucketChain(keepBucketPos,primaryMapper,allBuckets);
    for (    final RecordPtr recPtr : allBuckets) {
      final long newIdx=recPtr.hash & (tableLength + tableLength - 1L);
      if (newIdx == keepIdx)       keepBuckets.add(recPtr);
 else       if (newIdx == moveIdx)       keepBuckets.add(recPtr);
 else       throw new IllegalStateException("String_Node_Str");
    }
  }
  writeRecordsToBucketChain(keepBucketPos,primaryMapper,keepBuckets);
  writeRecordsToBucketChain(moveBucketPos,primaryMapper,moveBuckets);
}

Fixed version (ground truth):
@Override protected void rehashIdx(long idx){
  final long keepIdx=idx, moveIdx=idx + tableLength;
  final ArrayList<RecordPtr> keepBuckets=new ArrayList<RecordPtr>();
  final ArrayList<RecordPtr> moveBuckets=new ArrayList<RecordPtr>();
  long keepBucketPos=idxToPos(idx);
  long moveBucketPos=idxToPos(moveIdx);
{
    final ArrayList<RecordPtr> allBuckets=new ArrayList<RecordPtr>();
    accumRecordsInBucketChain(keepBucketPos,primaryMapper,allBuckets);
    for (    final RecordPtr recPtr : allBuckets) {
      final long newIdx=recPtr.hash & (tableLength + tableLength - 1L);
      if (newIdx == keepIdx)       keepBuckets.add(recPtr);
 else       if (newIdx == moveIdx)       moveBuckets.add(recPtr);
 else       throw new IllegalStateException("String_Node_Str");
    }
  }
  writeRecordsToBucketChain(keepBucketPos,primaryMapper,keepBuckets);
  writeRecordsToBucketChain(moveBucketPos,primaryMapper,moveBuckets);
}