nus-yam/ex-repair huggingface dataset:
Program: 43975
Project: 43975
Buggy source:
public static void main(String[] args) throws IOException {
  Platform.setInstance(new J2sePlatform());
  LuaC.install();
  LuaState vm=Platform.newLuaState();
  boolean interactive=(args.length == 0);
  boolean versioninfo=false;
  boolean processing=true;
  try {
    for (int i=0; i < args.length; i++) {
      if (!processing || !args[i].startsWith("String_Node_Str")) {
        break;
      }
 else       if (args[i].length() <= 1) {
        break;
      }
 else {
switch (args[i].charAt(1)) {
case 'e':
          if (++i >= args.length)           usageExit();
        break;
case 'l':
      if (++i >= args.length)       usageExit();
    loadLibrary(vm,args[i]);
  break;
case 'i':
interactive=true;
break;
case 'v':
versioninfo=true;
break;
case '-':
if (args[i].length() > 2) usageExit();
processing=false;
break;
default :
usageExit();
break;
}
}
}
if (versioninfo) System.out.println(version);
processing=true;
for (int i=0; i < args.length; i++) {
if (!processing || !args[i].startsWith("String_Node_Str")) {
processScript(vm,new FileInputStream(args[i]),args[i],args,i + 1);
break;
}
 else if (args[i].length() <= 1) {
processScript(vm,System.in,"String_Node_Str",args,i + 1);
break;
}
 else {
switch (args[i].charAt(1)) {
case 'e':
++i;
processScript(vm,new ByteArrayInputStream(args[i].getBytes()),args[i],null,0);
break;
case '-':
processing=false;
break;
}
}
}
if (interactive) interactiveMode(vm);
}
 catch (IOException ioe) {
System.err.println(ioe.toString());
System.exit(-2);
}
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException {
  Platform.setInstance(new J2sePlatform());
  LuaC.install();
  LuaState vm=Platform.newLuaState();
  boolean interactive=(args.length == 0);
  boolean versioninfo=false;
  boolean processing=true;
  try {
    for (int i=0; i < args.length; i++) {
      if (!processing || !args[i].startsWith("String_Node_Str")) {
        break;
      }
 else       if (args[i].length() <= 1) {
        break;
      }
 else {
switch (args[i].charAt(1)) {
case 'e':
          if (++i >= args.length)           usageExit();
        break;
case 'l':
      if (++i >= args.length)       usageExit();
    loadLibrary(vm,args[i]);
  break;
case 'i':
interactive=true;
break;
case 'v':
versioninfo=true;
break;
case '-':
if (args[i].length() > 2) usageExit();
processing=false;
break;
default :
usageExit();
break;
}
}
}
if (versioninfo) System.out.println(version);
processing=true;
for (int i=0; i < args.length; i++) {
if (!processing || !args[i].startsWith("String_Node_Str")) {
processScript(vm,new FileInputStream(args[i]),args[i],args,i + 1);
break;
}
 else if (args[i].length() <= 1) {
processScript(vm,System.in,"String_Node_Str",args,i + 1);
break;
}
 else {
switch (args[i].charAt(1)) {
case 'l':
++i;
break;
case 'e':
++i;
processScript(vm,new ByteArrayInputStream(args[i].getBytes()),args[i],null,0);
break;
case '-':
processing=false;
break;
}
}
}
if (interactive) interactiveMode(vm);
}
 catch (IOException ioe) {
System.err.println(ioe.toString());
System.exit(-2);
}
}
Program: 43976
Project: 43976
Buggy source:
protected void runTest(String testName) throws IOException, InterruptedException {
  Platform.setInstance(new J2sePlatform());
  LuaState state=Platform.newLuaState();
  LuaC.install();
  LPrototype p=loadScript(state,testName);
  p.source=LString.valueOf("String_Node_Str");
  ByteArrayOutputStream outputStream=new ByteArrayOutputStream();
  BaseLib.redirectOutput(outputStream);
  try {
    LClosure c=p.newClosure(state._G);
    state.pushlvalue(c);
    state.call(0,0);
    final String actualOutput=new String(outputStream.toByteArray());
    final String expectedOutput=getExpectedOutput(testName);
    assertEquals(expectedOutput,actualOutput);
  }
  finally {
    BaseLib.restoreStandardOutput();
    outputStream.close();
  }
}

Fixed version (ground truth):
protected void runTest(String testName) throws IOException, InterruptedException {
  Platform.setInstance(new J2sePlatform());
  LuaState state=Platform.newLuaState();
  LuaC.install();
  DebugLib.install(state);
  LPrototype p=loadScript(state,testName);
  p.source=LString.valueOf("String_Node_Str");
  ByteArrayOutputStream outputStream=new ByteArrayOutputStream();
  BaseLib.redirectOutput(outputStream);
  try {
    LClosure c=p.newClosure(state._G);
    state.pushlvalue(c);
    state.call(0,0);
    final String actualOutput=new String(outputStream.toByteArray());
    final String expectedOutput=getExpectedOutput(testName);
    assertEquals(expectedOutput,actualOutput);
  }
  finally {
    BaseLib.restoreStandardOutput();
    outputStream.close();
  }
}
Program: 43978
Project: 43978
Buggy source:
protected LValue normalizeGet(Object val){
  if (val instanceof WeakReference)   val=((WeakReference)val).get();
 else   if (val != null) {
    LUserData ud=(LUserData)val;
    Object o=((WeakReference)ud.m_instance).get();
    if (o != null)     val=new LUserData(o,ud.m_metatable);
 else     val=LNil.NIL;
  }
  return val == null ? LNil.NIL : (LValue)val;
}

Fixed version (ground truth):
protected LValue normalizeGet(Object val){
  if (val instanceof WeakReference)   val=((WeakReference)val).get();
 else   if (val instanceof LUserData) {
    LUserData ud=(LUserData)val;
    Object o=((WeakReference)ud.m_instance).get();
    if (o != null)     val=new LUserData(o,ud.m_metatable);
 else     val=LNil.NIL;
  }
  return val == null ? LNil.NIL : (LValue)val;
}
Program: 43979
Project: 43979
Buggy source:
public int compareTo(LString o){
  final byte[] a=this.m_bytes;
  final byte[] b=o.m_bytes;
  int i=this.m_offset;
  int j=o.m_offset;
  final int imax=i + m_length;
  final int jmax=j + o.m_length;
  if (a == b && i == j && imax == jmax)   return 0;
  while (i < imax && j < jmax) {
    if (a[i] != b[i]) {
      return (((int)a[i]) & 0x0FF) - (((int)b[j]) & 0x0FF);
    }
    i++;
    j++;
  }
  return m_length - o.m_length;
}

Fixed version (ground truth):
public int compareTo(LString o){
  final byte[] a=this.m_bytes;
  final byte[] b=o.m_bytes;
  int i=this.m_offset;
  int j=o.m_offset;
  final int imax=i + m_length;
  final int jmax=j + o.m_length;
  if (a == b && i == j && imax == jmax)   return 0;
  while (i < imax && j < jmax) {
    if (a[i] != b[j]) {
      return (((int)a[i]) & 0x0FF) - (((int)b[j]) & 0x0FF);
    }
    i++;
    j++;
  }
  return m_length - o.m_length;
}
Program: 43980
Project: 43980
Buggy source:
/** 
 * This needs to leave any values returned by yield in the coroutine  on the calling vm stack
 * @param vm
 * @param nargs 
 */
public void resumeFrom(LuaState vm,int nargs){
synchronized (this) {
    if (status == STATUS_DEAD) {
      vm.resettop();
      vm.pushboolean(false);
      vm.pushstring("String_Node_Str");
      return;
    }
    LThread prior=running;
    try {
      if (prior != null)       prior.status=STATUS_NORMAL;
      running=this;
      status=STATUS_RUNNING;
      if (thread == null) {
        vm.xmove(threadVm,nargs);
        threadVm.prepStackCall();
        thread=new Thread(this);
        thread.start();
      }
 else {
        threadVm.resettop();
        vm.xmove(threadVm,nargs);
      }
      this.notify();
      this.wait();
      vm.resettop();
      vm.pushboolean(true);
      if (threadVm.cc >= 0) {
        threadVm.xmove(vm,threadVm.gettop() - 1);
      }
 else {
        threadVm.base=0;
        threadVm.xmove(vm,threadVm.gettop());
      }
    }
 catch (    Throwable t) {
      status=STATUS_DEAD;
      vm.resettop();
      vm.pushboolean(false);
      vm.pushstring("String_Node_Str" + t);
      this.notify();
    }
 finally {
      running=prior;
    }
  }
}

Fixed version (ground truth):
/** 
 * This needs to leave any values returned by yield in the coroutine  on the calling vm stack
 * @param vm
 * @param nargs 
 */
public void resumeFrom(LuaState vm,int nargs){
synchronized (this) {
    if (status == STATUS_DEAD) {
      vm.resettop();
      vm.pushboolean(false);
      vm.pushstring("String_Node_Str");
      return;
    }
    LThread prior=running;
    try {
      if (prior != null)       prior.status=STATUS_NORMAL;
      running=this;
      status=STATUS_RUNNING;
      if (thread == null) {
        vm.xmove(threadVm,nargs);
        threadVm.prepStackCall();
        thread=new Thread(this);
        thread.start();
      }
 else {
        threadVm.resettop();
        vm.xmove(threadVm,nargs);
      }
      this.notify();
      this.wait();
      vm.resettop();
      if (threadVm.cc >= 0) {
        vm.pushboolean(status != STATUS_DEAD);
        threadVm.xmove(vm,threadVm.gettop() - 1);
      }
 else {
        vm.pushboolean(true);
        threadVm.base=0;
        threadVm.xmove(vm,threadVm.gettop());
      }
    }
 catch (    Throwable t) {
      status=STATUS_DEAD;
      vm.resettop();
      vm.pushboolean(false);
      vm.pushstring("String_Node_Str" + t);
      this.notify();
    }
 finally {
      running=prior;
    }
  }
}
Program: 43981
Project: 43981
Buggy source:
private void rehash(){
  final int oldCapacity=hashKeys.length;
  final int newCapacity=(oldCapacity > 0) ? 2 * oldCapacity : MIN_HASH_CAPACITY;
  final LValue[] oldKeys=hashKeys;
  final Object[] oldValues=hashValues;
  hashKeys=new LValue[newCapacity];
  hashValues=new Object[newCapacity];
  for (int i=0; i < oldCapacity; ++i) {
    final LValue k=oldKeys[i];
    if (k != null) {
      final Object v=oldValues[i];
      final int slot=hashFindSlot(k);
      hashKeys[slot]=k;
      hashValues[slot]=v;
    }
  }
}

Fixed version (ground truth):
protected void rehash(){
  final int oldCapacity=hashKeys.length;
  final int newCapacity=(oldCapacity > 0) ? 2 * oldCapacity : MIN_HASH_CAPACITY;
  final LValue[] oldKeys=hashKeys;
  final Object[] oldValues=hashValues;
  hashKeys=new LValue[newCapacity];
  hashValues=new Object[newCapacity];
  for (int i=0; i < oldCapacity; ++i) {
    final LValue k=oldKeys[i];
    if (k != null) {
      final Object v=oldValues[i];
      final int slot=hashFindSlot(k);
      hashKeys[slot]=k;
      hashValues[slot]=v;
    }
  }
}
Program: 43982
Project: 43982
Buggy source:
private boolean checkLoadFactor(){
  final int hashCapacity=hashKeys.length;
  return (hashCapacity >> 1) >= (hashCapacity - hashEntries);
}

Fixed version (ground truth):
protected boolean checkLoadFactor(){
  final int hashCapacity=hashKeys.length;
  return (hashCapacity >> 1) >= (hashCapacity - hashEntries);
}
Program: 43983
Project: 43983
Buggy source:
private void hashClearSlot(int i){
  if (hashKeys[i] != null) {
    int j=i;
    int n=hashKeys.length;
    while (hashKeys[j=((j + 1) % n)] != null) {
      final int k=((hashKeys[j].hashCode()) & 0x7FFFFFFF) % n;
      if ((j > i && (k <= i || k > j)) || (j < i && (k <= i && k > j))) {
        hashKeys[i]=hashKeys[j];
        hashValues[i]=hashValues[j];
        i=j;
      }
    }
    --hashEntries;
    hashKeys[i]=null;
    hashValues[i]=null;
    if (hashEntries == 0) {
      hashKeys=NONE;
      hashValues=null;
    }
  }
}

Fixed version (ground truth):
protected void hashClearSlot(int i){
  if (hashKeys[i] != null) {
    int j=i;
    int n=hashKeys.length;
    while (hashKeys[j=((j + 1) % n)] != null) {
      final int k=((hashKeys[j].hashCode()) & 0x7FFFFFFF) % n;
      if ((j > i && (k <= i || k > j)) || (j < i && (k <= i && k > j))) {
        hashKeys[i]=hashKeys[j];
        hashValues[i]=hashValues[j];
        i=j;
      }
    }
    --hashEntries;
    hashKeys[i]=null;
    hashValues[i]=null;
    if (hashEntries == 0) {
      hashKeys=NONE;
      hashValues=null;
    }
  }
}
Program: 43984
Project: 43984
Buggy source:
protected LValue normalizeGet(Object val){
  if (val != null)   val=((WeakReference)val).get();
  return val == null ? LNil.NIL : (LValue)val;
}

Fixed version (ground truth):
protected LValue normalizeGet(Object val){
  if (val instanceof WeakReference)   val=((WeakReference)val).get();
 else   if (val != null) {
    LUserData ud=(LUserData)val;
    Object o=((WeakReference)ud.m_instance).get();
    if (o != null)     val=new LUserData(o,ud.m_metatable);
 else     val=LNil.NIL;
  }
  return val == null ? LNil.NIL : (LValue)val;
}
Program: 43985
Project: 43985
Buggy source:
protected Object normalizePut(LValue val){
  return val == LNil.NIL ? null : new WeakReference(val);
}

Fixed version (ground truth):
protected Object normalizePut(LValue val){
  if (val.isNil()) {
    return null;
  }
 else   if (val.isUserData()) {
    LUserData ud=(LUserData)val;
    return new LUserData(new WeakReference(ud.m_instance),ud.m_metatable);
  }
 else {
    return new WeakReference(val);
  }
}
Program: 43988
Project: 43988
Buggy source:
public int luaMaxN(){
  return m_arrayEntries;
}

Fixed version (ground truth):
public LValue luaMaxN(){
  LValue result=LInteger.valueOf(0);
  for (int i=m_vector.length - 1; i >= 0; i--) {
    if (m_vector[i] != LNil.NIL) {
      result=LInteger.valueOf(i + 1);
      break;
    }
  }
  if (m_hashKeys != null) {
    final int hlen=m_hashKeys.length;
    for (int i=0; i < hlen; ++i) {
      LValue k=m_hashKeys[i];
      if (k != null && k.luaGetType() == Lua.LUA_TNUMBER) {
        if (k.luaBinCmpUnknown(Lua.OP_LT,result)) {
          result=k;
        }
      }
    }
  }
  return result;
}
Program: 43989
Project: 43989
Buggy source:
private void resize(int newCapacity){
  final int oldCapacity=m_vector.length;
  LValue[] newVector=new LValue[newCapacity];
  System.arraycopy(m_vector,0,newVector,0,Math.min(oldCapacity,newCapacity));
  if (newCapacity > oldCapacity) {
    if (m_hashKeys != null) {
      for (int i=oldCapacity; i < newCapacity; ++i) {
        int slot=findSlot(i + 1);
        if (m_hashKeys[slot] != null) {
          newVector[i]=m_hashValues[slot];
          m_hashKeys[slot]=null;
          --m_hashEntries;
        }
 else {
          newVector[i]=LNil.NIL;
        }
      }
      if (m_hashEntries == 0) {
        m_hashKeys=null;
        m_hashValues=null;
      }
    }
 else {
      for (int i=oldCapacity; i < newCapacity; ++i) {
        newVector[i]=LNil.NIL;
      }
    }
  }
 else {
    for (int i=newCapacity; i < oldCapacity; ++i) {
      LValue v=m_vector[i];
      if (v != LNil.NIL) {
        if (checkLoadFactor())         rehash();
        final int slot=findSlot(i + 1);
        m_hashKeys[slot]=LInteger.valueOf(i + 1);
        m_hashValues[slot]=v;
        ++m_hashEntries;
      }
    }
  }
  m_vector=newVector;
}

Fixed version (ground truth):
private void resize(int newCapacity){
  final int oldCapacity=m_vector.length;
  LValue[] newVector=new LValue[newCapacity];
  System.arraycopy(m_vector,0,newVector,0,Math.min(oldCapacity,newCapacity));
  if (newCapacity > oldCapacity) {
    for (int i=oldCapacity; i < newCapacity; ++i) {
      if (m_hashKeys != null) {
        int slot=findSlot(i + 1);
        if (m_hashKeys[slot] != null) {
          newVector[i]=m_hashValues[slot];
          clearSlot(slot);
          continue;
        }
      }
      newVector[i]=LNil.NIL;
    }
  }
 else {
    for (int i=newCapacity; i < oldCapacity; ++i) {
      LValue v=m_vector[i];
      if (v != LNil.NIL) {
        if (checkLoadFactor())         rehash();
        final int slot=findSlot(i + 1);
        m_hashKeys[slot]=LInteger.valueOf(i + 1);
        m_hashValues[slot]=v;
        ++m_hashEntries;
      }
    }
  }
  m_vector=newVector;
}
Program: 43990
Project: 43990
Buggy source:
private void indexError(LuaState vm,LValue nontable){
  vm.error("String_Node_Str" + nontable.luaGetTypeName() + "String_Node_Str",2);
}

Fixed version (ground truth):
private void indexError(LuaState vm,LValue nontable){
  vm.error("String_Node_Str" + nontable.luaGetTypeName() + "String_Node_Str",1);
}
Program: 43991
Project: 43991
Buggy source:
private void resize(int newCapacity){
  final int oldCapacity=m_vector.length;
  LValue[] newVector=new LValue[newCapacity];
  System.arraycopy(m_vector,0,newVector,0,Math.min(oldCapacity,newCapacity));
  if (newCapacity > oldCapacity) {
    if (m_hashKeys != null) {
      for (int i=oldCapacity; i < newCapacity; ++i) {
        int slot=findSlot(i + 1);
        if (m_hashKeys[slot] != null) {
          newVector[i]=m_hashValues[slot];
          m_hashKeys[i]=null;
          --m_hashEntries;
        }
 else {
          newVector[i]=LNil.NIL;
        }
      }
    }
 else {
      for (int i=oldCapacity; i < newCapacity; ++i) {
        newVector[i]=LNil.NIL;
      }
    }
  }
 else {
    for (int i=newCapacity; i < oldCapacity; ++i) {
      LValue v=m_vector[i];
      if (v != LNil.NIL) {
        if (checkLoadFactor())         rehash();
        final int slot=findSlot(i + 1);
        m_hashKeys[slot]=LInteger.valueOf(i + 1);
        m_hashValues[slot]=v;
        ++m_hashEntries;
      }
    }
  }
  m_vector=newVector;
}

Fixed version (ground truth):
private void resize(int newCapacity){
  final int oldCapacity=m_vector.length;
  LValue[] newVector=new LValue[newCapacity];
  System.arraycopy(m_vector,0,newVector,0,Math.min(oldCapacity,newCapacity));
  if (newCapacity > oldCapacity) {
    if (m_hashKeys != null) {
      for (int i=oldCapacity; i < newCapacity; ++i) {
        int slot=findSlot(i + 1);
        if (m_hashKeys[slot] != null) {
          newVector[i]=m_hashValues[slot];
          m_hashKeys[slot]=null;
          --m_hashEntries;
        }
 else {
          newVector[i]=LNil.NIL;
        }
      }
      if (m_hashEntries == 0) {
        m_hashKeys=null;
        m_hashValues=null;
      }
    }
 else {
      for (int i=oldCapacity; i < newCapacity; ++i) {
        newVector[i]=LNil.NIL;
      }
    }
  }
 else {
    for (int i=newCapacity; i < oldCapacity; ++i) {
      LValue v=m_vector[i];
      if (v != LNil.NIL) {
        if (checkLoadFactor())         rehash();
        final int slot=findSlot(i + 1);
        m_hashKeys[slot]=LInteger.valueOf(i + 1);
        m_hashValues[slot]=v;
        ++m_hashEntries;
      }
    }
  }
  m_vector=newVector;
}
Program: 43992
Project: 43992
Buggy source:
protected void init(LuaState state){
  state.installStandardLibs();
  LuajavaLib.install(state._G);
  LuaC.install();
  if (luaPath != null && luaPath.trim().length() > 0) {
    PackageLib.setLuaPath(luaPath);
  }
}

Fixed version (ground truth):
protected void init(LuaState state){
  state.installStandardLibs();
  LuajavaLib.install(state._G);
  LuaC.install();
  String luaPath=getLuaPath();
  if (luaPath != null && luaPath.trim().length() > 0) {
    PackageLib.setLuaPath(luaPath);
  }
}
Program: 43994
Project: 43994
Buggy source:
String getLuaPath(){
  return this.luaPath;
}

Fixed version (ground truth):
String getLuaPath(){
  return System.getProperty("String_Node_Str");
}
Program: 43995
Project: 43995
Buggy source:
public void run(){
  try {
    if (TRACE)     System.out.println("String_Node_Str" + host + "String_Node_Str"+ port);
    this.connection=(SocketConnection)Connector.open("String_Node_Str" + host + "String_Node_Str"+ port);
    this.inStream=connection.openDataInputStream();
    this.outStream=connection.openDataOutputStream();
    if (TRACE)     System.out.println("String_Node_Str" + host + "String_Node_Str"+ port);
    this.redirectOutputStream=new RedirectOutputStream(this);
    BaseLib.redirectOutput(redirectOutputStream);
    while (!isDisconnected()) {
      byte[] data=null;
      int size=inStream.readInt();
      data=new byte[size];
      inStream.readFully(data);
      DebugMessage request=(DebugMessage)SerializationHelper.deserialize(data);
      if (TRACE)       System.out.println("String_Node_Str" + request.toString());
      handleRequest(request);
    }
  }
 catch (  EOFException e) {
  }
catch (  IOException e) {
    e.printStackTrace();
    handleRequest(new DebugMessage(DebugMessageType.reset));
    debugSupport.disconnect(1);
  }
 finally {
    if (redirectOutputStream != null) {
      try {
        redirectOutputStream.close();
      }
 catch (      IOException ignore) {
      }
      BaseLib.restoreStandardOutput();
    }
    dispose();
  }
}

Fixed version (ground truth):
public void run(){
  try {
    if (TRACE)     System.out.println("String_Node_Str" + host + "String_Node_Str"+ port);
    this.connection=(SocketConnection)Connector.open("String_Node_Str" + host + "String_Node_Str"+ port);
    this.inStream=connection.openDataInputStream();
    this.outStream=connection.openDataOutputStream();
    if (TRACE)     System.out.println("String_Node_Str" + host + "String_Node_Str"+ port);
    this.redirectOutputStream=new RedirectOutputStream(this);
    BaseLib.redirectOutput(redirectOutputStream);
    while (!isDisconnected()) {
      byte[] data=null;
      int size=inStream.readInt();
      data=new byte[size];
      inStream.readFully(data);
      DebugMessage request=(DebugMessage)SerializationHelper.deserialize(data);
      if (TRACE)       System.out.println("String_Node_Str" + request.toString());
      handleRequest(request);
    }
  }
 catch (  EOFException e) {
    handleRequest(new DebugMessage(DebugMessageType.reset));
  }
catch (  IOException e) {
    e.printStackTrace();
    handleRequest(new DebugMessage(DebugMessageType.reset));
    debugSupport.disconnect(1);
  }
 finally {
    if (redirectOutputStream != null) {
      try {
        redirectOutputStream.close();
      }
 catch (      IOException ignore) {
      }
      BaseLib.restoreStandardOutput();
    }
    dispose();
  }
}
Program: 43997
Project: 43997
Buggy source:
public LValue luaBinOpUnknown(int opcode,LValue lhs){
  return arithmeticError(lhs.luaGetTypeName());
}

Fixed version (ground truth):
public LValue luaBinOpUnknown(int opcode,LValue lhs){
  return arithmeticError(luaGetTypeName());
}
Program: 43998
Project: 43998
Buggy source:
public void run(){
  try {
    if (TRACE)     System.out.println("String_Node_Str" + host + "String_Node_Str"+ port);
    this.connection=(SocketConnection)Connector.open("String_Node_Str" + host + "String_Node_Str"+ port);
    this.inStream=connection.openDataInputStream();
    this.outStream=connection.openDataOutputStream();
    if (TRACE)     System.out.println("String_Node_Str" + host + "String_Node_Str"+ port);
    this.redirectOutputStream=new RedirectOutputStream(this);
    BaseLib.redirectOutput(redirectOutputStream);
    while (!isDisconnected()) {
      byte[] data=null;
      int size=inStream.readInt();
      data=new byte[size];
      inStream.readFully(data);
      DebugMessage request=(DebugMessage)SerializationHelper.deserialize(data);
      if (TRACE)       System.out.println("String_Node_Str" + request.toString());
      handleRequest(request);
    }
  }
 catch (  EOFException e) {
  }
catch (  IOException e) {
    e.printStackTrace();
    handleRequest(new DebugMessage(DebugMessageType.reset));
    debugSupport.disconnect(1);
  }
 finally {
    try {
      redirectOutputStream.close();
    }
 catch (    IOException ignore) {
    }
    BaseLib.restoreStandardOutput();
    dispose();
  }
}

Fixed version (ground truth):
public void run(){
  try {
    if (TRACE)     System.out.println("String_Node_Str" + host + "String_Node_Str"+ port);
    this.connection=(SocketConnection)Connector.open("String_Node_Str" + host + "String_Node_Str"+ port);
    this.inStream=connection.openDataInputStream();
    this.outStream=connection.openDataOutputStream();
    if (TRACE)     System.out.println("String_Node_Str" + host + "String_Node_Str"+ port);
    this.redirectOutputStream=new RedirectOutputStream(this);
    BaseLib.redirectOutput(redirectOutputStream);
    while (!isDisconnected()) {
      byte[] data=null;
      int size=inStream.readInt();
      data=new byte[size];
      inStream.readFully(data);
      DebugMessage request=(DebugMessage)SerializationHelper.deserialize(data);
      if (TRACE)       System.out.println("String_Node_Str" + request.toString());
      handleRequest(request);
    }
  }
 catch (  EOFException e) {
  }
catch (  IOException e) {
    e.printStackTrace();
    handleRequest(new DebugMessage(DebugMessageType.reset));
    debugSupport.disconnect(1);
  }
 finally {
    if (redirectOutputStream != null) {
      try {
        redirectOutputStream.close();
      }
 catch (      IOException ignore) {
      }
      BaseLib.restoreStandardOutput();
    }
    dispose();
  }
}
Program: 44000
Project: 44000
Buggy source:
public boolean luaStackCall(LuaState vm){
switch (id) {
case INSTALL:
    install(vm._G);
  break;
case ABS:
setResult(vm,abs(vm.topointer(2)));
break;
case COS:
setResult(vm,new LDouble(Math.cos(vm.tonumber(2))));
break;
case MAX:
setResult(vm,max(vm.topointer(2),vm.topointer(3)));
break;
case MIN:
setResult(vm,min(vm.topointer(2),vm.topointer(3)));
break;
case MODF:
modf(vm);
break;
case SIN:
setResult(vm,new LDouble(Math.sin(vm.tonumber(2))));
break;
case SQRT:
setResult(vm,new LDouble(Math.sqrt(vm.tonumber(2))));
break;
case CEIL:
setResult(vm,LInteger.valueOf((int)Math.ceil(vm.tonumber(2))));
break;
case FLOOR:
setResult(vm,LInteger.valueOf((int)Math.floor(vm.tonumber(2))));
break;
default :
throw new RuntimeException("String_Node_Str" + id);
}
return false;
}

Fixed version (ground truth):
public boolean luaStackCall(LuaState vm){
switch (id) {
case INSTALL:
    install(vm._G);
  break;
case ABS:
setResult(vm,abs(vm.topointer(2)));
break;
case COS:
setResult(vm,new LDouble(Math.cos(vm.tonumber(2))));
break;
case MAX:
setResult(vm,max(vm.topointer(2),vm.topointer(3)));
break;
case MIN:
setResult(vm,min(vm.topointer(2),vm.topointer(3)));
break;
case MODF:
modf(vm);
break;
case SIN:
setResult(vm,new LDouble(Math.sin(vm.tonumber(2))));
break;
case SQRT:
setResult(vm,new LDouble(Math.sqrt(vm.tonumber(2))));
break;
case CEIL:
setResult(vm,LInteger.valueOf((int)Math.ceil(vm.tonumber(2))));
break;
case FLOOR:
setResult(vm,LInteger.valueOf((int)Math.floor(vm.tonumber(2))));
break;
default :
LuaState.vmerror("String_Node_Str");
}
return false;
}
Program: 44001
Project: 44001
Buggy source:
public boolean luaStackCall(LuaState vm){
switch (id) {
case INSTALL:
    install(vm._G);
  break;
case CONCAT:
{
  int n=vm.gettop();
  LTable table=vm.totable(2);
  LString sep=(n >= 3 ? vm.tolstring(3) : null);
  int i=vm.tointeger(4);
  int j=vm.tointeger(5);
  int len=table.luaLength();
  if (i == 0)   i=1;
  if (j == 0)   j=len;
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  try {
    for (int k=i; k <= j; k++) {
      LValue v=table.get(k);
      v.luaAsString().write(baos);
      if (k < j && sep != null)       sep.write(baos);
    }
    vm.resettop();
    vm.pushlstring(baos.toByteArray());
  }
 catch (  IOException e) {
    vm.error(e.getMessage());
  }
  break;
}
case INSERT:
{
int n=vm.gettop();
LTable table=vm.totable(2);
int pos=(n >= 4 ? vm.tointeger(3) : 0);
LValue value=vm.topointer(-1);
table.luaInsertPos(pos,value);
break;
}
case MAXN:
{
LTable table=vm.totable(2);
vm.resettop();
vm.pushinteger(table.luaMaxN());
break;
}
case REMOVE:
{
int n=vm.gettop();
LTable table=vm.totable(2);
int pos=(n >= 3 ? vm.tointeger(3) : 0);
vm.resettop();
vm.pushlvalue(table.luaRemovePos(pos));
break;
}
case SORT:
{
LTable table=vm.totable(2);
LValue compare=vm.topointer(3);
table.luaSort(vm,compare);
vm.resettop();
break;
}
default :
throw new RuntimeException("String_Node_Str");
}
return false;
}

Fixed version (ground truth):
public boolean luaStackCall(LuaState vm){
switch (id) {
case INSTALL:
    install(vm._G);
  break;
case CONCAT:
{
  int n=vm.gettop();
  LTable table=vm.totable(2);
  LString sep=(n >= 3 ? vm.tolstring(3) : null);
  int i=vm.tointeger(4);
  int j=vm.tointeger(5);
  int len=table.luaLength();
  if (i == 0)   i=1;
  if (j == 0)   j=len;
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  try {
    for (int k=i; k <= j; k++) {
      LValue v=table.get(k);
      v.luaAsString().write(baos);
      if (k < j && sep != null)       sep.write(baos);
    }
    vm.resettop();
    vm.pushlstring(baos.toByteArray());
  }
 catch (  IOException e) {
    vm.error(e.getMessage());
  }
  break;
}
case INSERT:
{
int n=vm.gettop();
LTable table=vm.totable(2);
int pos=(n >= 4 ? vm.tointeger(3) : 0);
LValue value=vm.topointer(-1);
table.luaInsertPos(pos,value);
break;
}
case MAXN:
{
LTable table=vm.totable(2);
vm.resettop();
vm.pushinteger(table.luaMaxN());
break;
}
case REMOVE:
{
int n=vm.gettop();
LTable table=vm.totable(2);
int pos=(n >= 3 ? vm.tointeger(3) : 0);
vm.resettop();
vm.pushlvalue(table.luaRemovePos(pos));
break;
}
case SORT:
{
LTable table=vm.totable(2);
LValue compare=vm.topointer(3);
table.luaSort(vm,compare);
vm.resettop();
break;
}
default :
LuaState.vmerror("String_Node_Str");
}
return false;
}
Program: 44002
Project: 44002
Buggy source:
public static boolean luaBinCmpDoubleDouble(int opcode,double lhs,double rhs){
switch (opcode) {
case Lua.OP_EQ:
    return lhs == rhs;
case Lua.OP_LT:
  return lhs < rhs;
case Lua.OP_LE:
return lhs <= rhs;
}
throw new RuntimeException("String_Node_Str");
}

Fixed version (ground truth):
public static boolean luaBinCmpDoubleDouble(int opcode,double lhs,double rhs){
switch (opcode) {
case Lua.OP_EQ:
    return lhs == rhs;
case Lua.OP_LT:
  return lhs < rhs;
case Lua.OP_LE:
return lhs <= rhs;
}
LuaState.vmerror("String_Node_Str");
return false;
}
Program: 44003
Project: 44003
Buggy source:
public static LValue luaBinOpDoubleDouble(int opcode,double lhs,double rhs){
switch (opcode) {
case Lua.OP_ADD:
    return new LDouble(lhs + rhs);
case Lua.OP_SUB:
  return new LDouble(lhs - rhs);
case Lua.OP_MUL:
return new LDouble(lhs * rhs);
case Lua.OP_DIV:
return new LDouble(lhs / rhs);
case Lua.OP_MOD:
return new LDouble(lhs - Math.floor(lhs / rhs) * rhs);
case Lua.OP_POW:
throw new LuaErrorException("String_Node_Str");
}
throw new RuntimeException("String_Node_Str");
}

Fixed version (ground truth):
public static LValue luaBinOpDoubleDouble(int opcode,double lhs,double rhs){
switch (opcode) {
case Lua.OP_ADD:
    return new LDouble(lhs + rhs);
case Lua.OP_SUB:
  return new LDouble(lhs - rhs);
case Lua.OP_MUL:
return new LDouble(lhs * rhs);
case Lua.OP_DIV:
return new LDouble(lhs / rhs);
case Lua.OP_MOD:
return new LDouble(lhs - Math.floor(lhs / rhs) * rhs);
case Lua.OP_POW:
throw new LuaErrorException("String_Node_Str");
}
LuaState.vmerror("String_Node_Str");
return null;
}
Program: 44004
Project: 44004
Buggy source:
public LValue luaBinOpInteger(int opcode,int rhs){
switch (opcode) {
case Lua.OP_ADD:
    return LInteger.valueOf(m_value + rhs);
case Lua.OP_SUB:
  return LInteger.valueOf(m_value - rhs);
case Lua.OP_MUL:
return LInteger.valueOf(m_value * rhs);
case Lua.OP_DIV:
return LInteger.valueOf(m_value / rhs);
case Lua.OP_MOD:
return LInteger.valueOf(m_value - ((int)Math.floor(m_value / (double)rhs)) * rhs);
case Lua.OP_POW:
return LInteger.valueOf(ipow(m_value,rhs));
}
throw new RuntimeException("String_Node_Str");
}

Fixed version (ground truth):
public LValue luaBinOpInteger(int opcode,int rhs){
switch (opcode) {
case Lua.OP_ADD:
    return LInteger.valueOf(m_value + rhs);
case Lua.OP_SUB:
  return LInteger.valueOf(m_value - rhs);
case Lua.OP_MUL:
return LInteger.valueOf(m_value * rhs);
case Lua.OP_DIV:
return LInteger.valueOf(m_value / rhs);
case Lua.OP_MOD:
return LInteger.valueOf(m_value - ((int)Math.floor(m_value / (double)rhs)) * rhs);
case Lua.OP_POW:
return LInteger.valueOf(ipow(m_value,rhs));
}
LuaState.vmerror("String_Node_Str");
return null;
}
Program: 44005
Project: 44005
Buggy source:
public boolean luaBinCmpInteger(int opcode,int rhs){
switch (opcode) {
case Lua.OP_EQ:
    return m_value == rhs;
case Lua.OP_LT:
  return m_value < rhs;
case Lua.OP_LE:
return m_value <= rhs;
}
throw new RuntimeException("String_Node_Str");
}

Fixed version (ground truth):
public boolean luaBinCmpInteger(int opcode,int rhs){
switch (opcode) {
case Lua.OP_EQ:
    return m_value == rhs;
case Lua.OP_LT:
  return m_value < rhs;
case Lua.OP_LE:
return m_value <= rhs;
}
LuaState.vmerror("String_Node_Str");
return false;
}
Program: 44006
Project: 44006
Buggy source:
public boolean luaBinCmpString(int opcode,LString rhs){
switch (opcode) {
case Lua.OP_EQ:
    return equals(rhs);
case Lua.OP_LT:
  return compareTo(rhs) < 0;
case Lua.OP_LE:
return compareTo(rhs) <= 0;
}
throw new RuntimeException("String_Node_Str");
}

Fixed version (ground truth):
public boolean luaBinCmpString(int opcode,LString rhs){
switch (opcode) {
case Lua.OP_EQ:
    return equals(rhs);
case Lua.OP_LT:
  return compareTo(rhs) < 0;
case Lua.OP_LE:
return compareTo(rhs) <= 0;
}
LuaState.vmerror("String_Node_Str");
return false;
}
Program: 44008
Project: 44008
Buggy source:
public static void main(String[] args) throws IOException {
  LuaState state=new LuaState();
  String script=(args.length > 0 ? args[0] : "String_Node_Str");
  System.out.println("String_Node_Str" + script + "String_Node_Str");
  state.installStandardLibs();
  LuaC.install();
  InputStream is=LuaRunner.class.getResourceAsStream(script);
  if (is == null)   throw new java.io.FileNotFoundException("String_Node_Str" + script);
  LPrototype p=LoadState.undump(state,is,script);
  LClosure c=new LClosure(p,state._G);
  state.doCall(c,new LValue[0]);
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException {
  LuaState state=LuaState.newState();
  String script=(args.length > 0 ? args[0] : "String_Node_Str");
  System.out.println("String_Node_Str" + script + "String_Node_Str");
  state.installStandardLibs();
  LuaC.install();
  InputStream is=LuaRunner.class.getResourceAsStream(script);
  if (is == null)   throw new java.io.FileNotFoundException("String_Node_Str" + script);
  LPrototype p=LoadState.undump(state,is,script);
  LClosure c=new LClosure(p,state._G);
  state.doCall(c,new LValue[0]);
}
Program: 44009
Project: 44009
Buggy source:
/** 
 * string.gmatch (s, pattern) Returns an iterator function that, each time it is called, returns the next captures  from pattern over string s. If pattern specifies no captures, then the  whole match is produced in each call.  As an example, the following loop s = "hello world from Lua" for w in string.gmatch(s, "%a+") do print(w) end will iterate over all the words from string s, printing one per line.  The next example collects all pairs key=value from the given string into a table: t = {} s = "from=world, to=Lua" for k, v in string.gmatch(s, "(%w+)=(%w+)") do t[k] = v end For this function, a '^' at the start of a pattern does not work as an anchor,  as this would prevent the iteration.
 */
static void gmatch(LuaState vm){
  vm.resettop();
  vm.pushlvalue(new GMatchAux(vm));
}

Fixed version (ground truth):
/** 
 * string.gmatch (s, pattern) Returns an iterator function that, each time it is called, returns the next captures  from pattern over string s. If pattern specifies no captures, then the  whole match is produced in each call.  As an example, the following loop s = "hello world from Lua" for w in string.gmatch(s, "%a+") do print(w) end will iterate over all the words from string s, printing one per line.  The next example collects all pairs key=value from the given string into a table: t = {} s = "from=world, to=Lua" for k, v in string.gmatch(s, "(%w+)=(%w+)") do t[k] = v end For this function, a '^' at the start of a pattern does not work as an anchor,  as this would prevent the iteration.
 */
static void gmatch(LuaState vm){
  LString src=vm.tolstring(2);
  LString pat=vm.tolstring(3);
  vm.resettop();
  vm.pushlvalue(new GMatchAux(vm,src,pat));
}
Program: 44010
Project: 44010
Buggy source:
public boolean luaStackCall(LuaState vm){
  vm.resettop();
  for (; soffset < srclen; soffset++) {
    int res=ms.match(soffset,0);
    if (res >= 0) {
      int soff=soffset;
      soffset=res;
      ms.push_captures(true,soff,res);
      return false;
    }
  }
  vm.pushnil();
  return false;
}

Fixed version (ground truth):
public boolean luaStackCall(LuaState vm){
  vm.resettop();
  for (; soffset < srclen; soffset++) {
    ms.reset();
    int res=ms.match(soffset,0);
    if (res >= 0) {
      int soff=soffset;
      soffset=res;
      ms.push_captures(true,soff,res);
      return false;
    }
  }
  vm.pushnil();
  return false;
}
Program: 44011
Project: 44011
Buggy source:
public GMatchAux(LuaState vm){
  this.src=vm.tolstring(2);
  this.pat=vm.tolstring(3);
  this.srclen=src.length();
  this.ms=new MatchState(vm,src,pat);
  this.soffset=0;
}

Fixed version (ground truth):
public GMatchAux(LuaState vm,LString src,LString pat){
  this.srclen=src.length();
  this.ms=new MatchState(vm,src,pat);
  this.soffset=0;
}
Program: 44012
Project: 44012
Buggy source:
public void acceptClientConnection() throws IOException {
  try {
    Socket clientSocket=serverSocket.accept();
    int count=getClientCount();
    if (count == numClientConnectionsAllowed) {
      clientSocket.close();
    }
 else {
synchronized (this) {
        incrementClientCount();
        this.clientConnectionTask=new ClientConnectionTask(this,clientSocket);
        new Thread(clientConnectionTask).start();
      }
    }
  }
  finally {
    dispose();
  }
}

Fixed version (ground truth):
public void acceptClientConnection() throws IOException {
  try {
    Socket clientSocket=serverSocket.accept();
    int count=getClientCount();
    if (count == numClientConnectionsAllowed) {
      clientSocket.close();
    }
 else {
synchronized (this) {
        incrementClientCount();
        this.clientConnectionTask=new ClientConnectionTask(this,clientSocket);
        new Thread(clientConnectionTask).start();
      }
    }
  }
 catch (  IOException e) {
    dispose();
  }
}
Program: 44013
Project: 44013
Buggy source:
public CallInfo(Closure c,int base,int resultoff,int nresults){
  this.closure=c;
  this.base=base;
  this.resultbase=resultoff;
  this.nresults=nresults;
  this.pc=0;
}

Fixed version (ground truth):
public CallInfo(Closure c,int base,int top,int resultoff,int nresults){
  this.closure=c;
  this.base=base;
  this.top=top;
  this.resultbase=resultoff;
  this.nresults=nresults;
  this.pc=0;
}
Program: 44014
Project: 44014
Buggy source:
public static void printState(StackState state,int base,int top,int max,Closure cl,int pc){
  PrintStream previous=ps;
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  ps=new PrintStream(baos);
  printOpCode(cl.p,pc);
  ps.flush();
  ps.close();
  ps=previous;
  format(baos.toString(),40);
  ps.print("String_Node_Str");
  format(String.valueOf(base),3);
  ps.print("String_Node_Str");
  format(String.valueOf(top),3);
  ps.print("String_Node_Str");
  int i=0;
  for (; i < base; i++)   ps.print('.');
  ps.print('[');
  for (; i < max && i < state.stack.length; i++) {
    Object v=state.stack[i];
    ps.print(v != null ? String.valueOf(v) : STRING_FOR_NULL);
    if (i + 1 == top)     ps.print(']');
    ps.print("String_Node_Str");
  }
  ps.println();
}

Fixed version (ground truth):
public static void printState(StackState state,int base,int top,int max,Closure cl,int pc){
  PrintStream previous=ps;
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  ps=new PrintStream(baos);
  printOpCode(cl.p,pc);
  ps.flush();
  ps.close();
  ps=previous;
  format(baos.toString(),40);
  ps.print("String_Node_Str");
  format(String.valueOf(base),3);
  ps.print("String_Node_Str");
  format(String.valueOf(top),3);
  ps.print("String_Node_Str");
  int i=0;
  for (; i < base; i++)   ps.print('.');
  ps.print('[');
  for (; i < max; i++) {
    Object v=state.stack[i];
    ps.print(v != null ? String.valueOf(v) : STRING_FOR_NULL);
    if (i + 1 == top)     ps.print(']');
    ps.print("String_Node_Str");
  }
  ps.println();
}
Program: 44015
Project: 44015
Buggy source:
public void prepStackCall(){
  Closure c=(Closure)stack[base];
  int resultbase=base;
  checkstack(c.p.maxstacksize);
  if (!c.p.is_vararg) {
    base+=1;
    adjustTop(base + c.p.numparams);
  }
 else {
    int npar=c.p.numparams;
    int narg=Math.max(0,top - base - 1);
    int nfix=Math.min(narg,npar);
    int nvar=Math.max(0,narg - nfix);
    stack[top]=LInteger.valueOf(nvar);
    System.arraycopy(stack,base + 1,stack,top + 1,nfix);
    base=top + 1;
    top=base + nfix;
    adjustTop(base + npar);
  }
  final int newcc=cc + 1;
  if (newcc >= calls.length) {
    CallInfo[] newcalls=new CallInfo[calls.length * 2];
    System.arraycopy(calls,0,newcalls,0,cc + 1);
    calls=newcalls;
  }
  calls[newcc]=new CallInfo(c,base,resultbase,nresults);
  cc=newcc;
}

Fixed version (ground truth):
public void prepStackCall(){
  Closure c=(Closure)stack[base];
  int resultbase=base;
  checkstack(c.p.maxstacksize);
  if (!c.p.is_vararg) {
    base+=1;
    adjustTop(base + c.p.numparams);
  }
 else {
    int npar=c.p.numparams;
    int narg=Math.max(0,top - base - 1);
    int nfix=Math.min(narg,npar);
    int nvar=Math.max(0,narg - nfix);
    stack[top]=LInteger.valueOf(nvar);
    System.arraycopy(stack,base + 1,stack,top + 1,nfix);
    base=top + 1;
    top=base + nfix;
    adjustTop(base + npar);
  }
  final int newcc=cc + 1;
  if (newcc >= calls.length) {
    CallInfo[] newcalls=new CallInfo[calls.length * 2];
    System.arraycopy(calls,0,newcalls,0,cc + 1);
    calls=newcalls;
  }
  calls[newcc]=new CallInfo(c,base,top,resultbase,nresults);
  cc=newcc;
}
Program: 44016
Project: 44016
Buggy source:
protected void setStarted(){
synchronized (this) {
    isStarted=true;
    this.notify();
  }
}

Fixed version (ground truth):
protected void setStarted(){
synchronized (this) {
    bSuspendAtStart=false;
    this.notify();
  }
}
Program: 44018
Project: 44018
Buggy source:
private String getVariable(CallInfo callInfo,int index){
  Proto prototype=callInfo.closure.p;
  int count=-1;
  LocVars[] localVariables=prototype.locvars;
  for (int i=0; i < localVariables.length; i++) {
    if (callInfo.pc < localVariables[i].startpc || callInfo.pc > localVariables[i].endpc) {
      continue;
    }
 else {
      count++;
      if (count == index) {
        return localVariables[i].varname.toJavaString();
      }
    }
  }
  return null;
}

Fixed version (ground truth):
private String getVariable(CallInfo callInfo,int index){
  int count=-1;
  LocVars[] localVariables=callInfo.closure.p.locvars;
  for (int i=0; i < localVariables.length; i++) {
    if (!isActiveVariable(callInfo.pc,localVariables[i])) {
      continue;
    }
 else {
      count++;
      if (count == index) {
        return localVariables[i].varname.toJavaString();
      }
    }
  }
  return null;
}
Program: 44019
Project: 44019
Buggy source:
public void exec(){
  try {
    super.exec();
  }
 catch (  AbortException e) {
  }
catch (  VMException e) {
    throw e;
  }
catch (  Exception e) {
    lastException=new VMException(e);
    debugSupport.notifyDebugEvent(new DebugEventError(e.getMessage()));
    suspend();
  }
}

Fixed version (ground truth):
public void exec(){
  try {
    super.exec();
  }
 catch (  AbortException e) {
  }
catch (  Exception e) {
    VMException lastException=new VMException(e);
    if (debugSupport != null) {
      debugSupport.notifyDebugEvent(new DebugEventError(e.getMessage()));
      suspend();
synchronized (this) {
        while (suspended) {
          try {
            wait();
          }
 catch (          InterruptedException e1) {
          }
        }
      }
    }
    throw lastException;
  }
}
Program: 44020
Project: 44020
Buggy source:
protected void doDebug() throws IOException {
  DebugUtils.println("String_Node_Str");
  init();
  state=new DebugStackState();
  DebugUtils.println("String_Node_Str" + getScript() + "String_Node_Str");
  InputStream is=new FileInputStream(new File(getScript()));
  Proto p=LoadState.undump(state,is,getScript());
  DebugUtils.println("String_Node_Str");
  DebugSupport debugSupport=new DebugSupportImpl(getRequestPort(),getEventPort());
  getDebugState().setDebugSupport(debugSupport);
  final Closure c=new Closure(state,p);
  String[] args=getScriptArgs();
  int numOfScriptArgs=(args != null ? args.length : 0);
  LValue[] vargs=new LValue[numOfScriptArgs];
  for (int i=0; i < numOfScriptArgs; i++) {
    vargs[i]=new LString(args[i]);
  }
  try {
    getDebugState().doCall(c,vargs);
  }
 catch (  VMException e) {
    System.err.println("String_Node_Str" + e.getMessage());
  }
  getDebugState().stop();
}

Fixed version (ground truth):
protected void doDebug() throws IOException {
  DebugUtils.println("String_Node_Str");
  init();
  state=new DebugStackState();
  DebugUtils.println("String_Node_Str" + getScript() + "String_Node_Str");
  InputStream is=new FileInputStream(new File(getScript()));
  Proto p=LoadState.undump(state,is,getScript());
  DebugUtils.println("String_Node_Str");
  DebugSupport debugSupport=new DebugSupportImpl(getRequestPort(),getEventPort());
  getDebugState().setDebugSupport(debugSupport);
  getDebugState().setSuspendAtStart(true);
  final Closure c=new Closure(state,p);
  String[] args=getScriptArgs();
  int numOfScriptArgs=(args != null ? args.length : 0);
  LValue[] vargs=new LValue[numOfScriptArgs];
  for (int i=0; i < numOfScriptArgs; i++) {
    vargs[i]=new LString(args[i]);
  }
  try {
    getDebugState().doCall(c,vargs);
  }
 catch (  VMException e) {
    System.err.println("String_Node_Str" + e.getMessage());
  }
  getDebugState().stop();
}
Program: 44021
Project: 44021
Buggy source:
private CoroutinesLib(int id){
  this.id=id;
}

Fixed version (ground truth):
private CoroutinesLib(int id,LThread thread){
  this.id=id;
  this.thread=thread;
}
Program: 44022
Project: 44022
Buggy source:
public boolean luaStackCall(VM vm){
switch (id) {
case 0:
{
      install();
      vm.pushnil();
      break;
    }
case 1:
{
    Closure c=(Closure)vm.topointer(2);
    vm.pushlvalue(new LThread(c));
    break;
  }
case 2:
{
  LThread t=(LThread)vm.topointer(2);
  LThread prior=running;
  try {
    running=t;
    t.resumeFrom(vm,prior);
    return false;
  }
  finally {
    running=prior;
  }
}
case 3:
{
if (running != null) {
  vm.pushlvalue(running);
}
 else {
  vm.pushnil();
}
break;
}
case 4:
{
vm.pushstring(((LThread)vm.topointer(2)).getStatus());
break;
}
case 5:
{
vm.error("String_Node_Str");
return false;
}
case 6:
{
if (running == null) vm.error("String_Node_Str");
 else {
return running.yield();
}
}
case 7:
{
vm.error("String_Node_Str");
return false;
}
}
vm.insert(1);
vm.settop(1);
return false;
}

Fixed version (ground truth):
public boolean luaStackCall(VM vm){
switch (id) {
case 0:
{
      install();
      vm.pushnil();
      break;
    }
case 1:
{
    Closure c=(Closure)vm.topointer(2);
    vm.pushlvalue(new LThread(c));
    break;
  }
case 2:
{
  LThread t=(LThread)vm.topointer(2);
  t.resumeFrom(vm,vm.gettop() - 2);
  return false;
}
case 3:
{
LThread r=LThread.getRunning();
if (r != null) {
  vm.pushlvalue(r);
}
 else {
  vm.pushnil();
}
break;
}
case 4:
{
vm.pushstring(((LThread)vm.topointer(2)).getStatus());
break;
}
case 5:
{
Closure c=(Closure)vm.topointer(2);
vm.pushlvalue(new CoroutinesLib(7,new LThread(c)));
break;
}
case 6:
{
LThread r=LThread.getRunning();
if (r == null) vm.error("String_Node_Str");
 else {
return r.yield();
}
}
case 7:
{
LThread t=this.thread;
t.resumeFrom(vm,vm.gettop() - 1);
vm.remove(1);
return false;
}
}
vm.insert(1);
vm.settop(1);
return false;
}