nus-yam/ex-repair huggingface dataset:
Program: 130589
Project: 130589
Buggy source:
/** 
 * Builds a relay cell payload (not including cell header, only relay header)
 * @param toHop Hop that it's destined for
 * @param cmd Command ID, see RELAY_
 * @param stream Stream ID
 * @param payload Relay cell data
 * @return Constructed relay payload
 */
protected byte[] buildRelay(TorHop toHop,int cmd,short stream,byte[] payload){
  byte[] fnl=new byte[509];
  ByteBuffer buf=ByteBuffer.wrap(fnl);
  buf.put((byte)cmd);
  buf.putShort((short)0);
  buf.putShort(stream);
  buf.putInt(0);
  buf.putShort((short)payload.length);
  buf.put(payload);
  toHop.df_md.update(fnl);
  MessageDigest md;
  try {
    md=(MessageDigest)toHop.df_md.clone();
    byte digest[]=md.digest();
    byte[] fnl_final=new byte[509];
    System.arraycopy(digest,0,fnl,5,4);
    return fnl;
  }
 catch (  CloneNotSupportedException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
/** 
 * Builds a relay cell payload (not including cell header, only relay header)
 * @param toHop Hop that it's destined for
 * @param cmd Command ID, see RELAY_
 * @param stream Stream ID
 * @param payload Relay cell data
 * @return Constructed relay payload
 */
protected synchronized byte[] buildRelay(TorHop toHop,int cmd,short stream,byte[] payload){
  byte[] fnl=new byte[509];
  ByteBuffer buf=ByteBuffer.wrap(fnl);
  buf.put((byte)cmd);
  buf.putShort((short)0);
  buf.putShort(stream);
  buf.putInt(0);
  buf.putShort((short)payload.length);
  buf.put(payload);
  toHop.df_md.update(fnl);
  MessageDigest md;
  try {
    md=(MessageDigest)toHop.df_md.clone();
    byte digest[]=md.digest();
    byte[] fnl_final=new byte[509];
    System.arraycopy(digest,0,fnl,5,4);
    return fnl;
  }
 catch (  CloneNotSupportedException e) {
    throw new RuntimeException(e);
  }
}
Program: 130590
Project: 130590
Buggy source:
/** 
 * Removes onion skins for received data
 * @param data Encrypted data for onion skin removal.
 * @return Decrypted data.
 */
private byte[] decrypt(byte[] data){
  for (int i=0; i < hops.size(); i++) {
    data=hops.get(i).decrypt(data);
    if (data[1] == 0 && data[2] == 0)     return data;
  }
  return data;
}

Fixed version (ground truth):
/** 
 * Removes onion skins for received data
 * @param data Encrypted data for onion skin removal.
 * @return Decrypted data.
 */
private byte[] decrypt(byte[] data){
  for (int i=0; i < hops.size(); i++) {
    data=hops.get(i).decrypt(data);
    if (data[1] == 0 && data[2] == 0)     if (i != hops.size() - 1) {
      System.out.println("String_Node_Str" + hops.get(i));
      return data;
    }
  }
  return data;
}
Program: 130591
Project: 130591
Buggy source:
/** 
 * Gererates a relay cell, encrypts and sends it
 * @param payload Relay payload
 * @param relaytype Type of relay cell (see RELAY_)
 * @param early Whether to use an early cell (needed for EXTEND only)
 * @param stream Stream ID
 */
public void send(byte[] payload,int relaytype,boolean early,short stream) throws IOException {
  if (state == STATES.DESTROYED)   throw new RuntimeException("String_Node_Str");
  if (relaytype == RELAY_DATA)   sendWindow--;
  byte relcell[]=buildRelay(hops.get(hops.size() - 1),relaytype,stream,payload);
  sock.sendCell(circId,early ? Cell.RELAY_EARLY : Cell.RELAY,encrypt(relcell));
}

Fixed version (ground truth):
public synchronized void send(byte[] payload,int relaytype,boolean early,short stream) throws IOException {
  if (state == STATES.DESTROYED)   throw new RuntimeException("String_Node_Str");
  if (relaytype == RELAY_DATA)   sendWindow--;
  byte relcell[]=buildRelay(hops.get(hops.size() - 1),relaytype,stream,payload);
  sock.sendCell(circId,early ? Cell.RELAY_EARLY : Cell.RELAY,encrypt(relcell));
  sentPackets++;
  sentBytes+=relcell.length;
}
Program: 130592
Project: 130592
Buggy source:
/** 
 * Main constructor. Connects and does connection setup.
 * @param host Hostname/IP string
 * @param port Port
 */
public TorSocket(String host,int port) throws IOException {
}

Fixed version (ground truth):
/** 
 * Main constructor. Connects and does connection setup.
 * @param host Hostname/IP string
 * @param port Port
 */
public TorSocket(OnionRouter fh) throws IOException {
}
Program: 130593
Project: 130593
Buggy source:
public void destroy() throws IOException {
  setState(STATES.DESTROYED);
  circ.send(new byte[]{6},TorCircuit.RELAY_END,false,(short)streamId);
  circ.streams.remove(new Integer(streamId));
}

Fixed version (ground truth):
public void destroy() throws IOException {
  if (state == STATES.DESTROYED)   return;
  setState(STATES.DESTROYED);
  circ.send(new byte[]{6},TorCircuit.RELAY_END,false,(short)streamId);
  circ.streams.remove(new Integer(streamId));
}
Program: 130594
Project: 130594
Buggy source:
@Override public void dataArrived(TorStream s){
  try {
    client.write(ByteBuffer.wrap(s.recv(-1,false)));
  }
 catch (  IOException e) {
    try {
      removeClient(this);
    }
 catch (    IOException e1) {
      e1.printStackTrace();
    }
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Override public void dataArrived(TorStream s){
  try {
    if (!client.isConnected())     removeClient(this);
    client.write(ByteBuffer.wrap(s.recv(-1,false)));
  }
 catch (  IOException e) {
    try {
      removeClient(this);
    }
 catch (    IOException e1) {
      e1.printStackTrace();
    }
    e.printStackTrace();
  }
}
Program: 130596
Project: 130596
Buggy source:
public void newClientData(Selector selector,SelectionKey sk) throws IOException {
  if (!connected) {
    ByteBuffer inbuf=ByteBuffer.allocate(512);
    if (client.read(inbuf) < 1)     return;
    inbuf.flip();
    int ver=inbuf.get();
    if (ver != 4) {
      throw new IOException("String_Node_Str" + ver);
    }
    int cmd=inbuf.get();
    if (cmd != 1) {
      throw new IOException("String_Node_Str");
    }
    port=inbuf.getShort();
    final byte ip[]=new byte[4];
    inbuf.get(ip);
    remoteAddr=InetAddress.getByAddress(ip);
    while ((inbuf.get()) != 0)     ;
    if (ip[0] == 0 && ip[1] == 0 && ip[2] == 0 && ip[3] != 0) {
      String host="String_Node_Str";
      byte b;
      while ((b=inbuf.get()) != 0) {
        host+=b;
      }
      remoteAddr=InetAddress.getByName(host);
      System.out.println(host + remoteAddr);
    }
    stream=circ.createStream(remoteAddr.getHostAddress(),port,this);
  }
 else {
    ByteBuffer buf=ByteBuffer.allocate(1024);
    if (client.read(buf) == -1)     throw new IOException("String_Node_Str");
    lastData=System.currentTimeMillis();
    buf.flip();
    stream.send(buf.array());
  }
}

Fixed version (ground truth):
public void newClientData(Selector selector,SelectionKey sk) throws IOException {
  if (!connected) {
    ByteBuffer inbuf=ByteBuffer.allocate(512);
    if (client.read(inbuf) < 1)     return;
    inbuf.flip();
    int ver=inbuf.get();
    if (ver != 4) {
      throw new IOException("String_Node_Str" + ver);
    }
    int cmd=inbuf.get();
    if (cmd != 1) {
      throw new IOException("String_Node_Str");
    }
    port=inbuf.getShort();
    final byte ip[]=new byte[4];
    inbuf.get(ip);
    remoteAddr=InetAddress.getByAddress(ip);
    while ((inbuf.get()) != 0)     ;
    if (ip[0] == 0 && ip[1] == 0 && ip[2] == 0 && ip[3] != 0) {
      String host="String_Node_Str";
      byte b;
      while ((b=inbuf.get()) != 0) {
        host+=b;
      }
      remoteAddr=InetAddress.getByName(host);
      System.out.println(host + remoteAddr);
    }
    stream=circ.createStream(remoteAddr.getHostAddress(),port,this);
  }
 else {
    ByteBuffer buf=ByteBuffer.allocate(4096);
    int nlen=0;
    if ((nlen=client.read(buf)) == -1)     throw new IOException("String_Node_Str");
    lastData=System.currentTimeMillis();
    buf.flip();
    byte b[]=new byte[nlen];
    buf.get(b);
    stream.send(b);
  }
}
Program: 130597
Project: 130597
Buggy source:
public void loadTmp(int x86_tmp,int free){
  out.println("String_Node_Str" + x86_tmp + "String_Node_Str"+ free);
  int diff=free - x86_tmp;
  if (diff >= numRegs) {
    emit("String_Node_Str",indirect((free - x86_tmp) * 4,"String_Node_Str"),reg(free));
  }
 else   if (diff > 0) {
    emit("String_Node_Str",reg(x86_tmp),reg(free));
  }
 else   if (diff == 0) {
  }
 else {
    assert(false);
  }
}

Fixed version (ground truth):
public void loadTmp(int x86_tmp,int free){
  out.println("String_Node_Str" + x86_tmp + "String_Node_Str"+ free);
  int diff=free - x86_tmp;
  if (diff < 0) {
    assert(false);
  }
 else   if (diff < numRegs) {
    emit("String_Node_Str",reg(x86_tmp),reg(free));
  }
 else   if (diff > 0) {
    emit("String_Node_Str",indirect(diff * WORDSIZE,"String_Node_Str"),reg(free));
  }
 else {
  }
}
Program: 130598
Project: 130598
Buggy source:
/** 
 * Generate code to evaluate this expression and leave the result in the specified free variable.
 */
public void compileExpr(Assembly a,int free){
  this.object.compileExpr(a,free);
  tmp.setTmp(free);
  a.spill(free + 1);
  for (  Expression e : inits) {
    e.compileExpr(a,free + 1);
  }
  a.unspill(free + 1);
}

Fixed version (ground truth):
/** 
 * Generate code to evaluate this expression and leave the result in the specified free variable.
 */
public void compileExpr(Assembly a,int free){
  a.emit("String_Node_Str" + free);
  this.object.compileExpr(a,free);
  a.emit("String_Node_Str" + free);
  tmp.setTmp(free);
  a.spill(free + 1);
  for (  Expression e : inits) {
    e.compileExpr(a,free + 1);
  }
  a.unspill(free + 1);
}
Program: 130599
Project: 130599
Buggy source:
/** 
 * Generate code to evaluate this expression and leave the result in the specified free variable.
 */
public void compileExpr(Assembly a,int free){
  int orig_free=free;
  while (!a.reg(free).equals("String_Node_Str")) {
    free++;
  }
  a.spill(free);
  left.compileExpr(a,free);
  a.spill(free + 1);
  right.compileExpr(a,free + 1);
  a.emit("String_Node_Str",a.immed(0),"String_Node_Str");
  a.emit("String_Node_Str",a.reg(free + 1));
  a.emit("String_Node_Str","String_Node_Str","String_Node_Str");
  a.unspillAll(orig_free);
  a.emit("String_Node_Str","String_Node_Str",a.reg(free));
}

Fixed version (ground truth):
/** 
 * Generate code to evaluate this expression and leave the result in the specified free variable.
 */
public void compileExpr(Assembly a,int free){
  int freed=a.spillTo(free,"String_Node_Str");
  left.compileExpr(a,freed);
  a.spill(freed + 1);
  right.compileExpr(a,freed + 1);
  a.emit("String_Node_Str",a.immed(0),"String_Node_Str");
  a.emit("String_Node_Str",a.reg(freed + 1));
  a.emit("String_Node_Str","String_Node_Str","String_Node_Str");
  a.unspillTo(freed + 1,free);
  a.emit("String_Node_Str","String_Node_Str",a.reg(free));
}
Program: 130600
Project: 130600
Buggy source:
/** 
 * Generate code to evaluate this expression and leave the result in the specified free variable.
 */
public void compileExpr(Assembly a,int free){
  int orig_free=free;
  while (!a.reg(free).equals("String_Node_Str")) {
    free++;
  }
  a.spill(free);
  left.compileExpr(a,free);
  a.spill(free + 1);
  right.compileExpr(a,free + 1);
  a.emit("String_Node_Str",a.immed(0),"String_Node_Str");
  a.emit("String_Node_Str",a.reg(free + 1));
  a.unspillAll(orig_free);
  a.emit("String_Node_Str","String_Node_Str",a.reg(free));
}

Fixed version (ground truth):
/** 
 * Generate code to evaluate this expression and leave the result in the specified free variable.
 */
public void compileExpr(Assembly a,int free){
  int freed=a.spillTo(free,"String_Node_Str");
  left.compileExpr(a,freed);
  a.spill(freed + 1);
  right.compileExpr(a,freed + 1);
  a.emit("String_Node_Str",a.immed(0),"String_Node_Str");
  a.emit("String_Node_Str",a.reg(freed + 1));
  a.unspillTo(freed + 1,free);
  a.emit("String_Node_Str","String_Node_Str",a.reg(free));
}
Program: 130601
Project: 130601
Buggy source:
/** 
 * Return the superclass, if any, of this class.
 */
public ClassType getSuper(){
  return extendsType.isClass();
}

Fixed version (ground truth):
/** 
 * Return the superclass, if any, of this class.
 */
public ClassType getSuper(){
  return extendsType == null ? null : extendsType.isClass();
}
Program: 130602
Project: 130602
Buggy source:
/** 
 * Convert this value into an ObjValue, or fail with an error message if this value does not represent an object.
 */
public ObjValue getObj(){
  throw new RuntimeException("String_Node_Str" + this.getClass().toString());
}

Fixed version (ground truth):
/** 
 * Convert this value into an ObjValue, or fail with an error message if this value does not represent an object.
 */
public ObjValue getObj(){
  Interp.abort("String_Node_Str");
  return null;
}
Program: 130603
Project: 130603
Buggy source:
/** 
 * Add a new field to this class.
 */
public void addField(Context ctxt,Modifiers mods,Id id,Type type,Expression init_expr){
  FieldEnv field=null;
  if (FieldEnv.find(id.getName(),fields) != null) {
    ctxt.report(new Failure(id.getPos(),"String_Node_Str" + id));
  }
 else   if (mods.isStatic()) {
    field=new FieldEnv(mods,id,type,this,-1,0,null,init_expr);
  }
 else {
    field=new FieldEnv(mods,id,type,this,fieldCount++,width,null,init_expr);
    width+=type.size();
  }
  if (fields == null) {
    fields=field;
  }
 else {
    FieldEnv cur=fields;
    while (fields.getNext() != null) {
      cur=fields.getNext();
    }
    cur.setNext(field);
  }
}

Fixed version (ground truth):
/** 
 * Add a new field to this class.
 */
public void addField(Context ctxt,Modifiers mods,Id id,Type type,Expression init_expr){
  FieldEnv field=null;
  if (FieldEnv.find(id.getName(),fields) != null) {
    ctxt.report(new Failure(id.getPos(),"String_Node_Str" + id));
  }
 else   if (mods.isStatic()) {
    field=new FieldEnv(mods,id,type,this,-1,0,null,init_expr);
  }
 else {
    field=new FieldEnv(mods,id,type,this,fieldCount++,width,null,init_expr);
    width+=type.size();
  }
  if (fields == null) {
    fields=field;
  }
 else {
    FieldEnv cur=fields;
    while (cur.getNext() != null) {
      cur=cur.getNext();
    }
    cur.setNext(field);
  }
}
Program: 130604
Project: 130604
Buggy source:
/** 
 * creates the crop ratios from the user selection. 0 = left 1 = bottom 2 = right 3 = top
 * @return the cropped ratios or null if to small
 */
private float[] getCutRatiosForPdf(){
  int x1, x2, y1, y2;
  if (zoomXStart > zoomXEnd) {
    x1=zoomXEnd;
    x2=zoomXStart;
  }
 else {
    x1=zoomXStart;
    x2=zoomXEnd;
  }
  if (zoomYStart > zoomYEnd) {
    y1=zoomYEnd;
    y2=zoomYStart;
  }
 else {
    y1=zoomYStart;
    y2=zoomYEnd;
  }
  if (x1 < 0) {
    x1=0;
  }
  if (x2 > img.getWidth()) {
    x2=img.getWidth();
  }
  if (y1 < 0) {
    y1=0;
  }
  if (y2 > img.getWidth()) {
    y2=img.getWidth();
  }
  if ((x2 - x1) < MINIMUM_WIDTH) {
    return null;
  }
  if ((y2 - y1) < MINIMUM_HEIGHT) {
    return null;
  }
  float[] ratios=new float[4];
  ratios[0]=(float)x1 / img.getWidth();
  ratios[1]=(float)(img.getHeight() - y2) / img.getHeight();
  ratios[2]=1 - ((float)x2 / img.getWidth());
  ratios[3]=1 - ((float)(img.getHeight() - y1) / img.getHeight());
  return ratios;
}

Fixed version (ground truth):
/** 
 * creates the crop ratios from the user selection. 0 = left 1 = bottom 2 = right 3 = top
 * @return the cropped ratios or null if to small
 */
private float[] getCutRatiosForPdf(){
  int x1, x2, y1, y2;
  if (zoomXStart > zoomXEnd) {
    x1=zoomXEnd;
    x2=zoomXStart;
  }
 else {
    x1=zoomXStart;
    x2=zoomXEnd;
  }
  if (zoomYStart > zoomYEnd) {
    y1=zoomYEnd;
    y2=zoomYStart;
  }
 else {
    y1=zoomYStart;
    y2=zoomYEnd;
  }
  if (x1 < 0) {
    x1=0;
  }
  if (x2 > img.getWidth()) {
    x2=img.getWidth();
  }
  if (y1 < 0) {
    y1=0;
  }
  if (y2 > img.getHeight()) {
    y2=img.getHeight();
  }
  if ((x2 - x1) < MINIMUM_WIDTH) {
    return null;
  }
  if ((y2 - y1) < MINIMUM_HEIGHT) {
    return null;
  }
  float[] ratios=new float[4];
  ratios[0]=(float)x1 / img.getWidth();
  ratios[1]=(float)(img.getHeight() - y2) / img.getHeight();
  ratios[2]=1 - ((float)x2 / img.getWidth());
  ratios[3]=1 - ((float)(img.getHeight() - y1) / img.getHeight());
  return ratios;
}
Program: 130605
Project: 130605
Buggy source:
private Object apply(Sym name,List<Object> args){
  try {
    Object ret=((Invocable)engine).invokeFunction(iso2.get(name),args);
    check(syms.get(name).second,ret);
    return ret;
  }
 catch (  Throwable e) {
    throw new RuntimeException("String_Node_Str" + name + "String_Node_Str"+ args+ "String_Node_Str"+ e.getClass()+ "String_Node_Str"+ e.getMessage()+ postfix);
  }
}

Fixed version (ground truth):
private Object apply(Sym name,List<Object> args){
  try {
    Object ret=((Invocable)engine).invokeFunction(iso2.get(name),args);
    check(syms.get(name).second,ret);
    return ret;
  }
 catch (  Throwable e) {
    throw new RuntimeException("String_Node_Str" + name + "String_Node_Str"+ args+ "String_Node_Str"+ Util.sep(args.stream().map(x -> x.getClass()).collect(Collectors.toList()),"String_Node_Str")+ "String_Node_Str"+ e.getClass()+ "String_Node_Str"+ e.getMessage()+ postfix);
  }
}
Program: 130606
Project: 130606
Buggy source:
/** 
 * Expects filenames in the map
 */
public static Map<En,List<String[]>> start2(Map<String,String> map,AqlOptions op,Schema<Ty,En,Sym,Fk,Att> sch,boolean omitCheck) throws Exception {
  Character sepChar=(Character)op.getOrDefault(AqlOption.csv_field_delim_char);
  Character quoteChar=(Character)op.getOrDefault(AqlOption.csv_quote_char);
  Character escapeChar=(Character)op.getOrDefault(AqlOption.csv_escape_char);
  final CSVParser parser=new CSVParserBuilder().withSeparator(sepChar).withQuoteChar(quoteChar).withEscapeChar(escapeChar).withFieldAsNull(CSVReaderNullFieldIndicator.EMPTY_SEPARATORS).build();
  Map<En,List<String[]>> ret=new HashMap<>();
  for (  String k : map.keySet()) {
    if (!omitCheck) {
      if (!sch.ens.contains(new En(k))) {
        throw new RuntimeException("String_Node_Str" + k);
      }
    }
    File file=new File(map.get(k));
    FileReader fileReader=new FileReader(file);
    final CSVReader reader=new CSVReaderBuilder(fileReader).withCSVParser(parser).withFieldAsNull(CSVReaderNullFieldIndicator.EMPTY_SEPARATORS).build();
    List<String[]> rows=reader.readAll();
    fileReader.close();
    ret.put(new En(k),rows);
  }
  if (!omitCheck) {
    for (    En en : sch.ens) {
      if (!ret.containsKey(en)) {
        ret.put(en,new LinkedList<>(Util.singList(Util.union(sch.attsFrom(en),sch.fksFrom(en)).toArray(new String[0]))));
      }
    }
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * Expects filenames in the map
 */
public static Map<En,List<String[]>> start2(Map<String,String> map,AqlOptions op,Schema<Ty,En,Sym,Fk,Att> sch,boolean omitCheck) throws Exception {
  Character sepChar=(Character)op.getOrDefault(AqlOption.csv_field_delim_char);
  Character quoteChar=(Character)op.getOrDefault(AqlOption.csv_quote_char);
  Character escapeChar=(Character)op.getOrDefault(AqlOption.csv_escape_char);
  final CSVParser parser=new CSVParserBuilder().withSeparator(sepChar).withQuoteChar(quoteChar).withEscapeChar(escapeChar).withFieldAsNull(CSVReaderNullFieldIndicator.EMPTY_SEPARATORS).build();
  Map<En,List<String[]>> ret=new HashMap<>();
  for (  String k : map.keySet()) {
    if (!omitCheck) {
      if (!sch.ens.contains(new En(k))) {
        throw new RuntimeException("String_Node_Str" + k);
      }
    }
    File file=new File(map.get(k));
    FileReader fileReader=new FileReader(file);
    final CSVReader reader=new CSVReaderBuilder(fileReader).withCSVParser(parser).withFieldAsNull(CSVReaderNullFieldIndicator.EMPTY_SEPARATORS).build();
    List<String[]> rows=reader.readAll();
    fileReader.close();
    ret.put(new En(k),rows);
  }
  if (!omitCheck) {
    for (    En en : sch.ens) {
      if (!ret.containsKey(en)) {
        ret.put(en,new LinkedList<>(Util.singList(Util.union(sch.attsFrom(en).stream().map(Object::toString).collect(Collectors.toList()),sch.fksFrom(en).stream().map(Object::toString).collect(Collectors.toList())).toArray(new String[0]))));
      }
    }
  }
  return ret;
}
Program: 130608
Project: 130608
Buggy source:
public Program(List<Triple<String,Integer,X>> decls){
  List<Triple<String,Integer,X>> seen=new LinkedList<>();
  for (  Triple<String,Integer,X> decl : decls) {
    checkDup(seen,decl);
    exps.put(decl.first,decl.third);
    lines.put(decl.first,decl.second);
    order.add(decl.first);
  }
}

Fixed version (ground truth):
public Program(List<Triple<String,Integer,X>> decls,String text){
  this.text=text;
  List<Triple<String,Integer,X>> seen=new LinkedList<>();
  for (  Triple<String,Integer,X> decl : decls) {
    checkDup(seen,decl);
    exps.put(decl.first,decl.third);
    lines.put(decl.first,decl.second);
    order.add(decl.first);
  }
}
Program: 130609
Project: 130609
Buggy source:
private void checkDup(List<Triple<String,Integer,X>> seen,Triple<String,Integer,X> toAdd){
  for (  Triple<String,Integer,X> other : seen) {
    if (other.first.equals(toAdd.first)) {
      throw new RuntimeException("String_Node_Str" + toAdd.first + "String_Node_Str"+ other.second+ "String_Node_Str"+ toAdd.second);
    }
  }
  seen.add(toAdd);
}

Fixed version (ground truth):
private void checkDup(List<Triple<String,Integer,X>> seen,Triple<String,Integer,X> toAdd){
  for (  Triple<String,Integer,X> other : seen) {
    if (other.first.equals(toAdd.first)) {
      if (text == null) {
        throw new RuntimeException("String_Node_Str" + toAdd.first);
      }
      throw new ParserException(new ParseErrorDetails(){
        @Override public String getEncountered(){
          return other.first;
        }
        @Override public List<String> getExpected(){
          return new LinkedList<>();
        }
        @Override public String getFailureMessage(){
          return "String_Node_Str" + conv(other.second);
        }
        @Override public int getIndex(){
          return other.second;
        }
        @Override public String getUnexpected(){
          return "String_Node_Str";
        }
      }
,"String_Node_Str" + toAdd.first,conv(toAdd.second));
    }
  }
  seen.add(toAdd);
}
Program: 130610
Project: 130610
Buggy source:
@SuppressWarnings("String_Node_Str") public static <X>X timeout(Callable<X> c,long timeout){
  final Ref<X> ret=new Ref<>();
  final Ref<Throwable> thr=new Ref<>();
  Thread t=new Thread(() -> {
    try {
      X x=c.call();
synchronized (ret) {
        ret.set(x);
      }
    }
 catch (    Exception exn) {
      exn.printStackTrace();
synchronized (thr) {
        thr.set(exn);
      }
    }
catch (    ThreadDeath d) {
synchronized (thr) {
        thr.set(new RuntimeInterruptedException(d));
      }
    }
  }
);
  t.start();
  try {
    t.join(timeout);
  }
 catch (  InterruptedException e) {
    t.stop();
    throw new RuntimeInterruptedException(e);
  }
synchronized (thr) {
synchronized (ret) {
      if (!ret.isSet() && !thr.isSet()) {
        t.stop();
        throw new RuntimeException("String_Node_Str" + timeout + "String_Node_Str");
      }
 else       if (ret.isSet() && !thr.isSet()) {
        return ret.x;
      }
 else       if (!ret.isSet() && thr.isSet()) {
        throw new RuntimeException(thr.x.getMessage());
      }
 else {
        throw new RuntimeException("String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public static <X>X timeout(Callable<X> c,long timeout){
  final Ref<X> ret=new Ref<>();
  final Ref<Throwable> thr=new Ref<>();
  Thread t=new Thread(() -> {
    try {
      X x=c.call();
synchronized (ret) {
        ret.set(x);
      }
    }
 catch (    Exception exn) {
      exn.printStackTrace();
synchronized (thr) {
        thr.set(exn);
      }
    }
catch (    ThreadDeath d) {
synchronized (thr) {
        thr.set(new RuntimeInterruptedException(d));
      }
    }
  }
);
  t.start();
  try {
    t.join(timeout);
  }
 catch (  InterruptedException e) {
    t.stop();
    throw new RuntimeInterruptedException(e);
  }
synchronized (thr) {
synchronized (ret) {
      if (!ret.isSet() && !thr.isSet()) {
        t.stop();
        throw new RuntimeException("String_Node_Str" + (timeout / 1000) + "String_Node_Str"+ (timeout / 1000)+ "String_Node_Str");
      }
 else       if (ret.isSet() && !thr.isSet()) {
        return ret.x;
      }
 else       if (!ret.isSet() && thr.isSet()) {
        throw new RuntimeException(thr.x.getMessage());
      }
 else {
        throw new RuntimeException("String_Node_Str");
      }
    }
  }
}
Program: 130611
Project: 130611
Buggy source:
public Object apply(Sym name,List<Object> args){
  try {
    Object ret=((Invocable)engine).invokeFunction(iso2.get(name),args);
    check(syms.get(name).second,ret);
    return ret;
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str" + e.getClass() + "String_Node_Str"+ e.getMessage());
  }
}

Fixed version (ground truth):
public Object apply(Sym name,List<Object> args){
  try {
    Object ret=((Invocable)engine).invokeFunction(iso2.get(name),args);
    check(syms.get(name).second,ret);
    return ret;
  }
 catch (  Throwable e) {
    throw new RuntimeException("String_Node_Str" + name + "String_Node_Str"+ args+ "String_Node_Str"+ e.getClass()+ "String_Node_Str"+ e.getMessage()+ postfix);
  }
}
Program: 130612
Project: 130612
Buggy source:
public Object parse(Ty name,String o){
  try {
    Object ret=((Invocable)engine).invokeFunction(iso1.get(name),Util.singList(o));
    check(name,ret);
    return ret;
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str" + e.getClass() + "String_Node_Str"+ e.getMessage());
  }
}

Fixed version (ground truth):
public Object parse(Ty name,String o){
  try {
    Object ret=((Invocable)engine).invokeFunction(iso1.get(name),Util.singList(o));
    check(name,ret);
    return ret;
  }
 catch (  Throwable e) {
    throw new RuntimeException("String_Node_Str" + o + "String_Node_Str"+ name+ "String_Node_Str"+ e.getClass()+ "String_Node_Str"+ e.getMessage()+ postfix);
  }
}
Program: 130613
Project: 130613
Buggy source:
public void check(Ty ty,Object o){
  if (o == null) {
    throw new RuntimeException("String_Node_Str");
  }
  String clazz=java_tys.get(ty);
  Class<?> c=Util.load(clazz);
  if (!c.isInstance(o)) {
    throw new RuntimeException(o + "String_Node_Str" + c);
  }
}

Fixed version (ground truth):
private void check(Ty ty,Object o){
  if (o == null) {
    throw new RuntimeException("String_Node_Str" + postfix);
  }
  String clazz=java_tys.get(ty);
  Class<?> c=Util.load(clazz);
  if (!c.isInstance(o)) {
    throw new RuntimeException(o + "String_Node_Str" + c+ postfix);
  }
}
Program: 130614
Project: 130614
Buggy source:
public AqlJs(Ctx<Sym,Pair<List<Ty>,Ty>> syms,Ctx<Ty,String> java_tys,Ctx<Ty,String> java_parsers,Ctx<Sym,String> java_fns){
  this.syms=syms;
  this.java_fns=java_fns;
  this.java_parsers=java_parsers;
  this.java_tys=java_tys;
  try {
    int i=0;
    for (    Ty k : java_parsers.keySet()) {
      String ret="String_Node_Str" + i + "String_Node_Str"+ java_parsers.get(k)+ "String_Node_Str";
      iso1.put(k,"String_Node_Str" + i);
      i++;
      engine.eval(ret);
    }
    i=0;
    for (    Sym k : java_fns.keySet()) {
      String ret="String_Node_Str" + i + "String_Node_Str"+ java_fns.get(k)+ "String_Node_Str";
      iso2.put(k,"String_Node_Str" + i);
      i++;
      engine.eval(ret);
    }
  }
 catch (  ScriptException e) {
    throw new RuntimeException(e.getMessage());
  }
}

Fixed version (ground truth):
public AqlJs(Ctx<Sym,Pair<List<Ty>,Ty>> syms,Ctx<Ty,String> java_tys,Ctx<Ty,String> java_parsers,Ctx<Sym,String> java_fns){
  this.syms=syms;
  this.java_fns=java_fns;
  this.java_parsers=java_parsers;
  this.java_tys=java_tys;
  String last="String_Node_Str";
  try {
    int i=0;
    for (    Ty k : java_parsers.keySet()) {
      String ret="String_Node_Str" + i + "String_Node_Str"+ java_parsers.get(k)+ "String_Node_Str";
      iso1.put(k,"String_Node_Str" + i);
      i++;
      engine.eval(ret);
      last=k.toString();
    }
    i=0;
    for (    Sym k : java_fns.keySet()) {
      String ret="String_Node_Str" + i + "String_Node_Str"+ java_fns.get(k)+ "String_Node_Str";
      iso2.put(k,"String_Node_Str" + i);
      i++;
      engine.eval(ret);
      last=k.toString();
    }
  }
 catch (  Throwable e) {
    throw new RuntimeException("String_Node_Str" + e.getMessage() + postfix+ "String_Node_Str"+ last);
  }
}
Program: 130615
Project: 130615
Buggy source:
@Deprecated public static Object exec(String s){
  ScriptEngine engine=new ScriptEngineManager().getEngineByName("String_Node_Str");
  try {
    return engine.eval(s);
  }
 catch (  ScriptException e) {
    e.printStackTrace();
    throw new RuntimeException("String_Node_Str" + s + "String_Node_Str"+ e.getMessage());
  }
}

Fixed version (ground truth):
@Deprecated public static Object exec(String s){
  ScriptEngine engine=new ScriptEngineManager().getEngineByName("String_Node_Str");
  try {
    return engine.eval(s);
  }
 catch (  ScriptException e) {
    e.printStackTrace();
    throw new RuntimeException("String_Node_Str" + s + "String_Node_Str"+ e.getMessage()+ postfix);
  }
}
Program: 130616
Project: 130616
Buggy source:
private static Object getDefault(AqlOption option){
switch (option) {
case allow_java_eqs_unsafe:
    return false;
case completion_precedence:
  return null;
case prover:
return ProverName.auto;
case dont_validate_unsafe:
return false;
case require_consistency:
return false;
case timeout:
return new Long(10);
case dont_verify_is_appropriate_for_prover_unsafe:
return false;
case completion_compose:
return true;
case completion_filter_subsumed:
return true;
case completion_sort:
return true;
case completion_syntactic_ac:
return false;
case static_typing:
return false;
case always_reload:
return false;
case csv_charset:
return "String_Node_Str";
case csv_escape_char:
return '\\';
case csv_field_delim_char:
return ',';
case csv_format:
return "String_Node_Str";
case id_column_name:
return "String_Node_Str";
case csv_line_delim_string:
return "String_Node_Str";
case csv_quote_char:
return '\"';
case varchar_length:
return 64;
case csv_null_string:
return null;
default :
throw new RuntimeException("String_Node_Str" + option);
}
}

Fixed version (ground truth):
private static Object getDefault(AqlOption option){
switch (option) {
case allow_java_eqs_unsafe:
    return false;
case completion_precedence:
  return null;
case prover:
return ProverName.auto;
case dont_validate_unsafe:
return false;
case require_consistency:
return false;
case timeout:
return new Long(10);
case dont_verify_is_appropriate_for_prover_unsafe:
return false;
case completion_compose:
return true;
case completion_filter_subsumed:
return true;
case completion_sort:
return true;
case completion_syntactic_ac:
return false;
case static_typing:
return false;
case always_reload:
return false;
case csv_charset:
return "String_Node_Str";
case csv_escape_char:
return '\\';
case csv_field_delim_char:
return ',';
case csv_format:
return "String_Node_Str";
case id_column_name:
return "String_Node_Str";
case csv_line_delim_string:
return "String_Node_Str";
case csv_quote_char:
return '\"';
case varchar_length:
return 64;
case csv_null_string:
return null;
case program_allow_nontermination_unsafe:
return false;
default :
throw new RuntimeException("String_Node_Str" + option);
}
}
Program: 130617
Project: 130617
Buggy source:
private static <Ty,En,Sym,Fk,Att,Gen,Sk>Object getFromMap(Map<String,String> map,Collage<Ty,En,Sym,Fk,Att,Gen,Sk> col,AqlOption op){
switch (op) {
case allow_java_eqs_unsafe:
    return op.getBoolean(map);
case completion_precedence:
  return AqlOption.getPrec(map.get(op.toString()),col);
case prover:
return op.getDPName(map);
case require_consistency:
return op.getBoolean(map);
case timeout:
return op.getLong(map);
case dont_verify_is_appropriate_for_prover_unsafe:
return op.getBoolean(map);
case completion_compose:
return op.getBoolean(map);
case completion_filter_subsumed:
return op.getBoolean(map);
case completion_sort:
return op.getBoolean(map);
case completion_syntactic_ac:
return op.getBoolean(map);
case dont_validate_unsafe:
return op.getBoolean(map);
case static_typing:
return op.getBoolean(map);
case always_reload:
return op.getBoolean(map);
case csv_charset:
return op.getString(map);
case csv_escape_char:
return op.getChar(map);
case csv_field_delim_char:
return op.getString(map);
case csv_format:
return op.getString(map);
case id_column_name:
return op.getString(map);
case csv_line_delim_string:
return op.getChar(map);
case csv_quote_char:
return op.getChar(map);
case varchar_length:
return op.getInteger(map);
case csv_null_string:
return op.getString(map);
default :
throw new RuntimeException("String_Node_Str");
}
}

Fixed version (ground truth):
private static <Ty,En,Sym,Fk,Att,Gen,Sk>Object getFromMap(Map<String,String> map,Collage<Ty,En,Sym,Fk,Att,Gen,Sk> col,AqlOption op){
switch (op) {
case allow_java_eqs_unsafe:
    return op.getBoolean(map);
case completion_precedence:
  return AqlOption.getPrec(map.get(op.toString()),col);
case prover:
return op.getDPName(map);
case require_consistency:
return op.getBoolean(map);
case timeout:
return op.getLong(map);
case dont_verify_is_appropriate_for_prover_unsafe:
return op.getBoolean(map);
case completion_compose:
return op.getBoolean(map);
case completion_filter_subsumed:
return op.getBoolean(map);
case completion_sort:
return op.getBoolean(map);
case completion_syntactic_ac:
return op.getBoolean(map);
case dont_validate_unsafe:
return op.getBoolean(map);
case static_typing:
return op.getBoolean(map);
case always_reload:
return op.getBoolean(map);
case csv_charset:
return op.getString(map);
case csv_escape_char:
return op.getChar(map);
case csv_field_delim_char:
return op.getString(map);
case csv_format:
return op.getString(map);
case id_column_name:
return op.getString(map);
case csv_line_delim_string:
return op.getChar(map);
case csv_quote_char:
return op.getChar(map);
case varchar_length:
return op.getInteger(map);
case csv_null_string:
return op.getString(map);
case program_allow_nontermination_unsafe:
return op.getBoolean(map);
default :
throw new RuntimeException("String_Node_Str");
}
}
Program: 130618
Project: 130618
Buggy source:
public static String printDefault(){
  List<String> l=new LinkedList<>();
  for (  AqlOption option : AqlOption.values()) {
    l.add(option + "String_Node_Str" + getDefault(option));
  }
  return Util.sep(l,"String_Node_Str");
}

Fixed version (ground truth):
public static String printDefault(){
  List<String> l=new LinkedList<>();
  for (  AqlOption option : AqlOption.values()) {
    Object o=getDefault(option);
    if (o == null) {
      l.add(option + "String_Node_Str");
    }
 else {
      l.add(option + "String_Node_Str" + o);
    }
  }
  return Util.sep(l,"String_Node_Str");
}
Program: 130619
Project: 130619
Buggy source:
private static <Sk,En,Fk,Ty,Att,Sym,Gen>ProverName auto(@SuppressWarnings("String_Node_Str") AqlOptions ops,Collage<Ty,En,Sym,Fk,Att,Gen,Sk> col){
  if (col.eqs.isEmpty()) {
    return ProverName.free;
  }
 else   if (col.isGround()) {
    return ProverName.congruence;
  }
 else   if (col.isMonoidal()) {
    return ProverName.monoidal;
  }
 else   if (ProgramProver.isProgram(Var.it,col.toKB().first,false)) {
    return ProverName.program;
  }
  throw new RuntimeException("String_Node_Str");
}

Fixed version (ground truth):
private static <Sk,En,Fk,Ty,Att,Sym,Gen>ProverName auto(AqlOptions ops,Collage<Ty,En,Sym,Fk,Att,Gen,Sk> col){
  if (col.eqs.isEmpty()) {
    return ProverName.free;
  }
 else   if (col.isGround()) {
    return ProverName.congruence;
  }
 else   if (col.isMonoidal()) {
    return ProverName.monoidal;
  }
 else   if (!(Boolean)ops.getOrDefault(AqlOption.program_allow_nontermination_unsafe) && reorientable(col) && ProgramProver.isProgram(Var.it,reorient(col).toKB().first,false)) {
    return ProverName.program;
  }
 else   if ((Boolean)ops.getOrDefault(AqlOption.program_allow_nontermination_unsafe) && ProgramProver.isProgram(Var.it,col.toKB().first,false)) {
    return ProverName.program;
  }
  throw new RuntimeException("String_Node_Str");
}
Program: 130621
Project: 130621
Buggy source:
public static <X>Map<X,X> id(Collection<X> X){
  Map<X,X> ret=new HashMap<>();
  for (  X x : X) {
    ret.put(x,x);
  }
  return ret;
}

Fixed version (ground truth):
public static <X>Map<X,X> id(Collection<X> X){
  Map<X,X> ret=new LinkedHashMap<>();
  for (  X x : X) {
    ret.put(x,x);
  }
  return ret;
}
Program: 130622
Project: 130622
Buggy source:
private static Parser<InstExpColim<String,String,String,String,String,String,String,String,String,String,String>> colimInstExp(){
  Parser<List<catdata.Pair<String,InstExp<?,?,?,?,?,?,?,?,?>>>> nodes=Parsers.tuple(token("String_Node_Str"),env(inst_ref.lazy(),"String_Node_Str")).map(x -> x.b);
  Parser<List<catdata.Pair<String,TransExp<?,?,?,?,?,?,?,?,?,?,?,?,?>>>> edges=Parsers.tuple(token("String_Node_Str"),env(trans_ref.lazy(),"String_Node_Str")).map(x -> x.b);
  Parser<Tuple4<List<String>,List<catdata.Pair<String,InstExp<?,?,?,?,?,?,?,?,?>>>,List<catdata.Pair<String,TransExp<?,?,?,?,?,?,?,?,?,?,?,?,?>>>,List<catdata.Pair<String,String>>>> pa=Parsers.tuple(imports,nodes.optional(),edges.optional(),options);
  Parser<Tuple4<Token,GraphExp<?,?>,SchExp<?,?,?,?,?>,Token>> l=Parsers.tuple(token("String_Node_Str"),graph_ref.lazy(),sch_ref.lazy(),token("String_Node_Str"));
  @SuppressWarnings({"String_Node_Str","String_Node_Str"}) Parser<InstExpColim<String,String,String,String,String,String,String,String,String,String,String>> ret=Parsers.tuple(l,pa,token("String_Node_Str")).map(x -> {
    return new InstExpColim(x.a.b,x.a.c,x.b.a,Util.newIfNull(x.b.b),Util.newIfNull(x.b.c),x.b.d);
  }
);
  return ret;
}

Fixed version (ground truth):
private static Parser<InstExpColim<String,String,String,String,String,String,String,String,String,String,String>> colimInstExp(){
  Parser<List<catdata.Pair<String,InstExp<?,?,?,?,?,?,?,?,?>>>> nodes=Parsers.tuple(token("String_Node_Str"),env(inst_ref.lazy(),"String_Node_Str")).map(x -> x.b);
  Parser<List<catdata.Pair<String,TransExp<?,?,?,?,?,?,?,?,?,?,?,?,?>>>> edges=Parsers.tuple(token("String_Node_Str"),env(trans_ref.lazy(),"String_Node_Str")).map(x -> x.b);
  Parser<Tuple4<List<String>,List<catdata.Pair<String,InstExp<?,?,?,?,?,?,?,?,?>>>,List<catdata.Pair<String,TransExp<?,?,?,?,?,?,?,?,?,?,?,?,?>>>,List<catdata.Pair<String,String>>>> pa=Parsers.tuple(Parsers.always(),nodes.optional(),edges.optional(),options);
  Parser<Tuple4<Token,GraphExp<?,?>,SchExp<?,?,?,?,?>,Token>> l=Parsers.tuple(token("String_Node_Str"),graph_ref.lazy(),sch_ref.lazy(),token("String_Node_Str"));
  @SuppressWarnings({"String_Node_Str","String_Node_Str"}) Parser<InstExpColim<String,String,String,String,String,String,String,String,String,String,String>> ret=Parsers.tuple(l,pa,token("String_Node_Str")).map(x -> {
    return new InstExpColim(x.a.b,x.a.c,x.b.a,Util.newIfNull(x.b.b),Util.newIfNull(x.b.c),x.b.d);
  }
);
  return ret;
}
Program: 130623
Project: 130623
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) private static final void instExp(){
  Parser<InstExp<?,?,?,?,?,?,?,?,?>> var=ident.map(InstExpVar::new), empty=Parsers.tuple(token("String_Node_Str"),sch_ref.get()).map(x -> new InstExpEmpty<>(x.b)), sigma=Parsers.tuple(token("String_Node_Str"),map_ref.lazy(),inst_ref.lazy(),options.between(token("String_Node_Str"),token("String_Node_Str")).optional()).map(x -> new InstExpSigma(x.b,x.c,x.d == null ? new HashMap<>() : Util.toMapSafely(x.d))), delta=Parsers.tuple(token("String_Node_Str"),map_ref.lazy(),inst_ref.lazy()).map(x -> new InstExpDelta(x.b,x.c)), distinct=Parsers.tuple(token("String_Node_Str"),inst_ref.lazy()).map(x -> new InstExpDistinct(x.b)), eval=Parsers.tuple(token("String_Node_Str"),query_ref.lazy(),inst_ref.lazy()).map(x -> new InstExpEval(x.b,x.c)), ret=Parsers.or(empty,instExpRaw(),var,sigma,delta,distinct,eval,colimInstExp());
  inst_ref.set(ret);
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) private static final void instExp(){
  Parser<InstExp<?,?,?,?,?,?,?,?,?>> var=ident.map(InstExpVar::new), empty=Parsers.tuple(token("String_Node_Str"),sch_ref.get()).map(x -> new InstExpEmpty<>(x.b)), sigma=Parsers.tuple(token("String_Node_Str"),map_ref.lazy(),inst_ref.lazy(),options.between(token("String_Node_Str"),token("String_Node_Str")).optional()).map(x -> new InstExpSigma(x.b,x.c,x.d == null ? new HashMap<>() : Util.toMapSafely(x.d))), delta=Parsers.tuple(token("String_Node_Str"),map_ref.lazy(),inst_ref.lazy()).map(x -> new InstExpDelta(x.b,x.c)), distinct=Parsers.tuple(token("String_Node_Str"),inst_ref.lazy()).map(x -> new InstExpDistinct(x.b)), eval=Parsers.tuple(token("String_Node_Str"),query_ref.lazy(),inst_ref.lazy()).map(x -> new InstExpEval(x.b,x.c)), dom=Parsers.tuple(token("String_Node_Str"),trans_ref.lazy()).map(x -> new InstExpDom(x.b)), cod=Parsers.tuple(token("String_Node_Str"),trans_ref.lazy()).map(x -> new InstExpCod(x.b)), ret=Parsers.or(empty,instExpRaw(),var,sigma,delta,distinct,eval,colimInstExp(),dom,cod);
  inst_ref.set(ret);
}
Program: 130624
Project: 130624
Buggy source:
public InstExpColim(GraphExp<N,E> shape,SchExp<Ty,En,Sym,Fk,Att> schema,List<String> imports,List<Pair<N,InstExp<Ty,En,Sym,Fk,Att,Gen,Sk,X,Y>>> nodes,List<Pair<E,TransExp<Ty,En,Sym,Fk,Att,Gen,Sk,Gen,Sk,X,Y,X,Y>>> edges,List<Pair<String,String>> options){
  this.schema=schema;
  this.shape=shape;
  this.nodes=new Ctx<>(nodes);
  this.edges=new Ctx<>(edges);
  this.options=Util.toMapSafely(options);
  this.imports=imports;
}

Fixed version (ground truth):
public InstExpColim(GraphExp<N,E> shape,SchExp<Ty,En,Sym,Fk,Att> schema,List<String> imports,List<Pair<N,InstExp<Ty,En,Sym,Fk,Att,Gen,Sk,X,Y>>> nodes,List<Pair<E,TransExp<Ty,En,Sym,Fk,Att,Gen,Sk,Gen,Sk,X,Y,X,Y>>> edges,List<Pair<String,String>> options){
  this.schema=schema;
  this.shape=shape;
  this.nodes=new Ctx<>(nodes);
  this.edges=new Ctx<>(edges);
  this.options=Util.toMapSafely(options);
}
Program: 130625
Project: 130625
Buggy source:
public Kind kind(){
  return Kind.INSTANCE;
}

Fixed version (ground truth):
@Override public Kind kind(){
  return Kind.INSTANCE;
}
Program: 130626
Project: 130626
Buggy source:
public Pair<N,N> type(N src,List<E> path){
  Util.assertNotNull(src,path);
  N dst=src;
  for (  E e : path) {
    if (!edges.containsKey(e)) {
      throw new RuntimeException("String_Node_Str" + e);
    }
    if (!src.equals(edges.get(e).first)) {
      throw new RuntimeException("String_Node_Str" + path + "String_Node_Str"+ e+ "String_Node_Str"+ edges.get(e).first+ "String_Node_Str"+ src);
    }
    dst=edges.get(e).second;
  }
  return new Pair<>(src,dst);
}

Fixed version (ground truth):
public Pair<N,N> type(N src,List<E> path){
  Util.assertNotNull(src,path);
  N dst=src;
  for (  E e : path) {
    if (!edges.containsKey(e)) {
      throw new RuntimeException("String_Node_Str" + e);
    }
    if (!dst.equals(edges.get(e).first)) {
      throw new RuntimeException("String_Node_Str" + path + "String_Node_Str"+ e+ "String_Node_Str"+ edges.get(e).first+ "String_Node_Str"+ src);
    }
    dst=edges.get(e).second;
  }
  return new Pair<>(src,dst);
}
Program: 130627
Project: 130627
Buggy source:
/** 
 * Calculates the similarity (a number within 0 and 1) between two strings. Is Levenshtein distance 
 */
public static double similarity(String s1,String s2){
  String longer=s1, shorter=s2;
  if (s1.length() < s2.length()) {
    longer=s2;
    shorter=s1;
  }
  int longerLength=longer.length();
  if (longerLength == 0) {
    return 1.0;
  }
  return (longerLength - editDistance(longer,shorter)) / (double)longerLength;
}

Fixed version (ground truth):
/** 
 * Calculates a similarity (a number within 0 and 1) between two strings.
 */
public static double similarity(String s1,String s2){
  if (s1.equals(s2)) {
    return 1.0;
  }
  return editDistance(s1,s2);
}
Program: 130628
Project: 130628
Buggy source:
@Override public Match<N1,E1,N2,E2> bestMatch(){
  Map<N1,N2> nodes=new HashMap<>();
  Map<E1,List<E2>> edges=new HashMap<>();
  for (  N1 s : src.nodes) {
    double max_d=-1;
    N2 max_t=null;
    for (    N2 t : dst.nodes) {
      double cur_d=params.apply(s.toString(),t.toString());
      if (cur_d > max_d) {
        max_d=cur_d;
        max_t=t;
      }
    }
    if (max_t == null) {
      throw new RuntimeException("String_Node_Str" + s);
    }
    nodes.put(s,max_t);
  }
  for (  E1 c : src.edges.keySet()) {
    double max_d=-1;
    E2 max_c=null;
    for (    E2 d : dst.edges(nodes.get(src.edges.get(c).first),nodes.get(src.edges.get(c).second))) {
      double cur_d=params.apply(c.toString(),d.toString());
      if (cur_d > max_d) {
        max_d=cur_d;
        max_c=d;
      }
    }
    if (max_c == null) {
      throw new RuntimeException("String_Node_Str" + c + "String_Node_Str"+ Util.sep(nodes,"String_Node_Str","String_Node_Str"));
    }
    edges.put(c,Util.singList(max_c));
  }
  return new Match<>(src,dst,nodes,edges);
}

Fixed version (ground truth):
@Override public Match<N1,E1,N2,E2> bestMatch(){
  Map<N1,N2> nodes=new HashMap<>();
  Map<E1,List<E2>> edges=new HashMap<>();
  for (  N1 s : src.nodes) {
    int min_d=Integer.MAX_VALUE;
    N2 min_t=null;
    for (    N2 t : dst.nodes) {
      int cur_d=params.apply(s.toString(),t.toString());
      if (cur_d < min_d) {
        min_d=cur_d;
        min_t=t;
      }
    }
    if (min_t == null) {
      throw new RuntimeException("String_Node_Str" + s);
    }
    nodes.put(s,min_t);
  }
  for (  E1 c : src.edges.keySet()) {
    int min_d=Integer.MAX_VALUE;
    E2 min_c=null;
    N2 n2_s=nodes.get(src.edges.get(c).first);
    N2 n2_t=nodes.get(src.edges.get(c).second);
    for (    E2 d : dst.edges(n2_s,n2_t)) {
      int cur_d=params.apply(c.toString(),d.toString());
      if (cur_d < min_d) {
        min_d=cur_d;
        min_c=d;
      }
    }
    if (min_c != null) {
      edges.put(c,Util.singList(min_c));
    }
 else     if (n2_s.equals(n2_t)) {
      edges.put(c,new LinkedList<>());
    }
 else {
      ShortestPath<N2,E2> sp=new ShortestPath<>(this.dst,n2_s);
      if (sp.hasPathTo(n2_t)) {
        edges.put(c,sp.pathTo(n2_t));
      }
 else {
        throw new RuntimeException("String_Node_Str" + c + "String_Node_Str"+ Util.sep(nodes,"String_Node_Str","String_Node_Str"));
      }
    }
  }
  return new Match<>(src,dst,nodes,edges);
}
Program: 130629
Project: 130629
Buggy source:
@Override public BiFunction<String,String,Double> createParams(Map<String,String> options){
  if (!options.isEmpty()) {
    throw new RuntimeException("String_Node_Str");
  }
  return EditDistance::similarity;
}

Fixed version (ground truth):
@Override public BiFunction<String,String,Integer> createParams(Map<String,String> options){
  if (!options.isEmpty()) {
    throw new RuntimeException("String_Node_Str");
  }
  return EditDistance::editDistance;
}
Program: 130632
Project: 130632
Buggy source:
@Override protected XEnvironment makeEnv(String str,XProgram init){
  return XDriver.makeEnv(str,init);
}

Fixed version (ground truth):
@Override protected XEnvironment makeEnv(String str,XProgram init){
  return XDriver.makeEnv(str,init,toUpdate);
}