nus-yam/ex-repair huggingface dataset:
Program: 178960
Project: 178960
Buggy source:
@Test(timeout=Config.TIMEOUT) public void differentClientsHaveSeparateStateOnServerSide() throws Exception {
  final String MSG1="String_Node_Str";
  final String MSG2="String_Node_Str";
  final RpcServer server=new NettyRpcServerBuilder(BIND_ADDRESS).addClass(State.class,ServerState.class).build();
  final ClientState clientOneState=new ClientState();
  final RpcClient clientOne=new NettyRpcClientBuilder(BIND_ADDRESS).addObject(State.class,clientOneState).build();
  final State proxyOne=clientOne.getRemote().getProxy(State.class);
  final ClientState clientTwoState=new ClientState();
  final RpcClient clientTwo=new NettyRpcClientBuilder(BIND_ADDRESS).addObject(State.class,clientTwoState).build();
  final State proxyTwo=clientTwo.getRemote().getProxy(State.class);
  try {
    proxyOne.set(MSG1);
    proxyTwo.set(MSG2);
    proxyOne.get();
    proxyTwo.get();
    giveTimeForMessagesToBeProcessed();
    assertThat(clientOneState.state,equalTo(MSG1));
    assertThat(clientTwoState.state,equalTo(MSG2));
  }
  finally {
    clientOne.shutdown();
    clientTwo.shutdown();
    server.shutdown();
  }
}

Fixed version (ground truth):
@Test(timeout=TIMEOUT) public void differentClientsHaveSeparateStateOnServerSide() throws Exception {
  final String MSG1="String_Node_Str";
  final String MSG2="String_Node_Str";
  final RpcServer server=new NettyRpcServerBuilder(BIND_ADDRESS).addClass(State.class,ServerState.class).build();
  final ClientState clientOneState=new ClientState();
  final RpcClient clientOne=new NettyRpcClientBuilder(BIND_ADDRESS).addObject(State.class,clientOneState).build();
  final State proxyOne=clientOne.getRemote().getProxy(State.class);
  final ClientState clientTwoState=new ClientState();
  final RpcClient clientTwo=new NettyRpcClientBuilder(BIND_ADDRESS).addObject(State.class,clientTwoState).build();
  final State proxyTwo=clientTwo.getRemote().getProxy(State.class);
  try {
    proxyOne.set(MSG1);
    proxyTwo.set(MSG2);
    proxyOne.get();
    proxyTwo.get();
    giveTimeForMessagesToBeProcessed();
    assertThat(clientOneState.state,equalTo(MSG1));
    assertThat(clientTwoState.state,equalTo(MSG2));
  }
  finally {
    clientOne.shutdown();
    clientTwo.shutdown();
    server.shutdown();
  }
}
Program: 178961
Project: 178961
Buggy source:
@Test(timeout=Config.TIMEOUT) public void exceptionsFromClientSideImplementationArePassedToServer() throws Throwable {
  final ThrowableThrower impl=new ThrowableThrower(){
    @Override public void go() throws Throwable {
      throw new IllegalAccessException("String_Node_Str");
    }
  }
;
  final ExceptionListener listener=mockery.mock(ExceptionListener.class);
  mockery.checking(new Expectations(){
{
      one(listener).onExceptionCaught(with(any(Remote.class)),with(any(RemoteException.class)));
    }
  }
);
  final RpcServer server=new NettyRpcServerBuilder(BIND_ADDRESS).addExceptionListener(listener).addClass(NoParamsVoidReturn.class,CallClientBack.class).build();
  final RpcClient client=new NettyRpcClientBuilder(BIND_ADDRESS).addObject(ThrowableThrower.class,impl).build();
  final NoParamsVoidReturn proxy=client.getRemote().getProxy(NoParamsVoidReturn.class);
  try {
    proxy.go();
    giveTimeForMessagesToBeProcessed();
  }
  finally {
    client.shutdown();
    server.shutdown();
  }
}

Fixed version (ground truth):
@Test(timeout=TIMEOUT) public void exceptionsFromClientSideImplementationArePassedToServer() throws Throwable {
  final ThrowableThrower impl=new ThrowableThrower(){
    @Override public void go() throws Throwable {
      throw new IllegalAccessException("String_Node_Str");
    }
  }
;
  final ExceptionListener listener=mockery.mock(ExceptionListener.class);
  mockery.checking(new Expectations(){
{
      one(listener).onExceptionCaught(with(any(Remote.class)),with(any(RemoteException.class)));
    }
  }
);
  final RpcServer server=new NettyRpcServerBuilder(BIND_ADDRESS).addExceptionListener(listener).addClass(NoParamsVoidReturn.class,CallClientBack.class).build();
  final RpcClient client=new NettyRpcClientBuilder(BIND_ADDRESS).addObject(ThrowableThrower.class,impl).build();
  final NoParamsVoidReturn proxy=client.getRemote().getProxy(NoParamsVoidReturn.class);
  try {
    proxy.go();
    giveTimeForMessagesToBeProcessed();
  }
  finally {
    client.shutdown();
    server.shutdown();
  }
}
Program: 178962
Project: 178962
Buggy source:
@Test(timeout=Config.TIMEOUT) public void feedbackToClientWorks() throws Exception {
  final String MSG="String_Node_Str";
  final RpcServer server=new NettyRpcServerBuilder(BIND_ADDRESS).addClass(SomeServerApi.class,SomeServerImpl.class).build();
  final ClientApi mockClient=mockery.mock(ClientApi.class);
  mockery.checking(new Expectations(){
{
      one(mockClient).feedback(MSG);
    }
  }
);
  final RpcClient client=new NettyRpcClientBuilder(BIND_ADDRESS).addObject(ClientApi.class,mockClient).build();
  final SomeServerApi proxy=client.getRemote().getProxy(SomeServerApi.class);
  try {
    proxy.go(MSG);
    giveTimeForMessagesToBeProcessed();
  }
  finally {
    client.shutdown();
    server.shutdown();
  }
}

Fixed version (ground truth):
@Test(timeout=TIMEOUT) public void feedbackToClientWorks() throws Exception {
  final String MSG="String_Node_Str";
  final RpcServer server=new NettyRpcServerBuilder(BIND_ADDRESS).addClass(SomeServerApi.class,SomeServerImpl.class).build();
  final ClientApi mockClient=mockery.mock(ClientApi.class);
  mockery.checking(new Expectations(){
{
      one(mockClient).feedback(MSG);
    }
  }
);
  final RpcClient client=new NettyRpcClientBuilder(BIND_ADDRESS).addObject(ClientApi.class,mockClient).build();
  final SomeServerApi proxy=client.getRemote().getProxy(SomeServerApi.class);
  try {
    proxy.go(MSG);
    giveTimeForMessagesToBeProcessed();
  }
  finally {
    client.shutdown();
    server.shutdown();
  }
}
Program: 178963
Project: 178963
Buggy source:
@Test(timeout=Config.TIMEOUT) public void methodParametersArePassedToRemoteSideProperly() throws Exception {
  final IntegerParam impl=mockery.mock(IntegerParam.class);
  final Integer param=5;
  mockery.checking(new Expectations(){
{
      one(impl).go(with(equalTo(param)));
    }
  }
);
  final RpcServer server=new NettyRpcServerBuilder(BIND_ADDRESS).addObject(IntegerParam.class,impl).build();
  final RpcClient client=new NettyRpcClientBuilder(BIND_ADDRESS).build();
  final IntegerParam proxy=client.getRemote().getProxy(IntegerParam.class);
  try {
    proxy.go(param);
    giveTimeForMessagesToBeProcessed();
  }
  finally {
    client.shutdown();
    server.shutdown();
  }
}

Fixed version (ground truth):
@Test(timeout=TIMEOUT) public void methodParametersArePassedToRemoteSideProperly() throws Exception {
  final IntegerParam impl=mockery.mock(IntegerParam.class);
  final Integer param=5;
  mockery.checking(new Expectations(){
{
      one(impl).go(with(equalTo(param)));
    }
  }
);
  final RpcServer server=new NettyRpcServerBuilder(BIND_ADDRESS).addObject(IntegerParam.class,impl).build();
  final RpcClient client=new NettyRpcClientBuilder(BIND_ADDRESS).build();
  final IntegerParam proxy=client.getRemote().getProxy(IntegerParam.class);
  try {
    proxy.go(param);
    giveTimeForMessagesToBeProcessed();
  }
  finally {
    client.shutdown();
    server.shutdown();
  }
}
Program: 178964
Project: 178964
Buggy source:
@Test(timeout=Config.TIMEOUT) public void primitiveMethodParametersArePassedToRemoteSideProperly() throws Exception {
  final IntLongParam impl=mockery.mock(IntLongParam.class);
  final int paramInt=5;
  final long paramLong=10l;
  mockery.checking(new Expectations(){
{
      one(impl).go(with(equalTo(paramInt)),with(equalTo(paramLong)));
    }
  }
);
  final RpcServer server=new NettyRpcServerBuilder(BIND_ADDRESS).addObject(IntLongParam.class,impl).build();
  final RpcClient client=new NettyRpcClientBuilder(BIND_ADDRESS).build();
  final IntLongParam proxy=client.getRemote().getProxy(IntLongParam.class);
  try {
    proxy.go(paramInt,paramLong);
    giveTimeForMessagesToBeProcessed();
  }
  finally {
    client.shutdown();
    server.shutdown();
  }
}

Fixed version (ground truth):
@Test(timeout=TIMEOUT) public void primitiveMethodParametersArePassedToRemoteSideProperly() throws Exception {
  final IntLongParam impl=mockery.mock(IntLongParam.class);
  final int paramInt=5;
  final long paramLong=10l;
  mockery.checking(new Expectations(){
{
      one(impl).go(with(equalTo(paramInt)),with(equalTo(paramLong)));
    }
  }
);
  final RpcServer server=new NettyRpcServerBuilder(BIND_ADDRESS).addObject(IntLongParam.class,impl).build();
  final RpcClient client=new NettyRpcClientBuilder(BIND_ADDRESS).build();
  final IntLongParam proxy=client.getRemote().getProxy(IntLongParam.class);
  try {
    proxy.go(paramInt,paramLong);
    giveTimeForMessagesToBeProcessed();
  }
  finally {
    client.shutdown();
    server.shutdown();
  }
}
Program: 178965
Project: 178965
Buggy source:
@Test(timeout=Config.TIMEOUT,expected=ConfigurationException.class) public void throwsProtocolExceptionIfCannotSerializeParams() throws Exception {
  final NonSerializable impl=mockery.mock(NonSerializable.class);
  final RpcServer server=new NettyRpcServerBuilder(BIND_ADDRESS).addObject(NonSerializable.class,impl).build();
  final RpcClient client=new NettyRpcClientBuilder(BIND_ADDRESS).build();
  final NonSerializable proxy=client.getRemote().getProxy(NonSerializable.class);
  try {
    proxy.param("String_Node_Str",new Object());
  }
  finally {
    client.shutdown();
    server.shutdown();
  }
}

Fixed version (ground truth):
@Test(timeout=TIMEOUT,expected=ConfigurationException.class) public void throwsProtocolExceptionIfCannotSerializeParams() throws Exception {
  final NonSerializable impl=mockery.mock(NonSerializable.class);
  final RpcServer server=new NettyRpcServerBuilder(BIND_ADDRESS).addObject(NonSerializable.class,impl).build();
  final RpcClient client=new NettyRpcClientBuilder(BIND_ADDRESS).build();
  final NonSerializable proxy=client.getRemote().getProxy(NonSerializable.class);
  try {
    proxy.param("String_Node_Str",new Object());
  }
  finally {
    client.shutdown();
    server.shutdown();
  }
}
Program: 178966
Project: 178966
Buggy source:
@Test(timeout=Config.TIMEOUT,expected=ConfigurationException.class) public void doNotAllowMethodsWithNonVoidReturnTypeToBeProxied() throws Exception {
  final NoParamsIntegerReturn impl=mockery.mock(NoParamsIntegerReturn.class);
  final RpcServer server=new NettyRpcServerBuilder(BIND_ADDRESS).addObject(NoParamsIntegerReturn.class,impl).build();
  final RpcClient client=new NettyRpcClientBuilder(BIND_ADDRESS).build();
  final NoParamsIntegerReturn proxy=client.getRemote().getProxy(NoParamsIntegerReturn.class);
  try {
    proxy.go();
  }
  finally {
    client.shutdown();
    server.shutdown();
  }
}

Fixed version (ground truth):
@Test(timeout=TIMEOUT,expected=ConfigurationException.class) public void doNotAllowMethodsWithNonVoidReturnTypeToBeProxied() throws Exception {
  final NoParamsIntegerReturn impl=mockery.mock(NoParamsIntegerReturn.class);
  final RpcServer server=new NettyRpcServerBuilder(BIND_ADDRESS).addObject(NoParamsIntegerReturn.class,impl).build();
  final RpcClient client=new NettyRpcClientBuilder(BIND_ADDRESS).build();
  final NoParamsIntegerReturn proxy=client.getRemote().getProxy(NoParamsIntegerReturn.class);
  try {
    proxy.go();
  }
  finally {
    client.shutdown();
    server.shutdown();
  }
}
Program: 178967
Project: 178967
Buggy source:
@Test(timeout=Config.TIMEOUT) public void subsequentCallsWork() throws Exception {
  final NoParamsVoidReturn impl=mockery.mock(NoParamsVoidReturn.class);
  mockery.checking(new Expectations(){
{
      one(impl).go();
      one(impl).go();
    }
  }
);
  final RpcServer server=new NettyRpcServerBuilder(BIND_ADDRESS).addObject(NoParamsVoidReturn.class,impl).build();
  final RpcClient client=new NettyRpcClientBuilder(BIND_ADDRESS).build();
  final NoParamsVoidReturn proxy=client.getRemote().getProxy(NoParamsVoidReturn.class);
  try {
    proxy.go();
    proxy.go();
    giveTimeForMessagesToBeProcessed();
  }
  finally {
    client.shutdown();
    server.shutdown();
  }
}

Fixed version (ground truth):
@Test(timeout=TIMEOUT) public void subsequentCallsWork() throws Exception {
  final NoParamsVoidReturn impl=mockery.mock(NoParamsVoidReturn.class);
  mockery.checking(new Expectations(){
{
      one(impl).go();
      one(impl).go();
    }
  }
);
  final RpcServer server=new NettyRpcServerBuilder(BIND_ADDRESS).addObject(NoParamsVoidReturn.class,impl).build();
  final RpcClient client=new NettyRpcClientBuilder(BIND_ADDRESS).build();
  final NoParamsVoidReturn proxy=client.getRemote().getProxy(NoParamsVoidReturn.class);
  try {
    proxy.go();
    proxy.go();
    giveTimeForMessagesToBeProcessed();
  }
  finally {
    client.shutdown();
    server.shutdown();
  }
}
Program: 178968
Project: 178968
Buggy source:
@Test(timeout=Config.TIMEOUT) public void throwsTransportExceptionIfConnectionIsAbruptlyTerminated() throws Throwable {
  final InfinteWaiter impl=new InfinteWaiter(){
    @SuppressWarnings({"String_Node_Str"}) @Override public void hang(){
      try {
        sleep(1000L);
      }
 catch (      InterruptedException ignored) {
      }
    }
  }
;
  final RpcServer server=new NettyRpcServerBuilder(BIND_ADDRESS).addObject(InfinteWaiter.class,impl).build();
  final ExceptionSavingListener listener=new ExceptionSavingListener();
  final RpcClient client=new NettyRpcClientBuilder(BIND_ADDRESS).addExceptionListener(listener).setKeepAlive(30l).build();
  final InfinteWaiter proxy=client.getRemote().getProxy(InfinteWaiter.class);
  try {
    proxy.hang();
    server.shutdown();
    giveTimeForMessagesToBeProcessed();
    assertThat(listener.lastException(),notNullValue());
    assertThat(listener.lastException().getClass(),equalTo((Class)TransportException.class));
  }
  finally {
    client.shutdown();
  }
}

Fixed version (ground truth):
@Test(timeout=TIMEOUT) public void throwsTransportExceptionIfConnectionIsAbruptlyTerminated() throws Throwable {
  final InfinteWaiter impl=new InfinteWaiter(){
    @SuppressWarnings({"String_Node_Str"}) @Override public void hang(){
      try {
        sleep(1000L);
      }
 catch (      InterruptedException ignored) {
      }
    }
  }
;
  final RpcServer server=new NettyRpcServerBuilder(BIND_ADDRESS).addObject(InfinteWaiter.class,impl).build();
  final ExceptionSavingListener listener=new ExceptionSavingListener();
  final RpcClient client=new NettyRpcClientBuilder(BIND_ADDRESS).addExceptionListener(listener).setKeepAlive(30l).build();
  final InfinteWaiter proxy=client.getRemote().getProxy(InfinteWaiter.class);
  try {
    proxy.hang();
    server.shutdown();
    giveTimeForMessagesToBeProcessed();
    assertThat(listener.lastException(),notNullValue());
    assertThat(listener.lastException().getClass(),equalTo((Class)TransportException.class));
  }
  finally {
    client.shutdown();
  }
}
Program: 178969
Project: 178969
Buggy source:
@Test(timeout=Config.TIMEOUT) public void serverImplementationsAreCachedIeStatePersistsAcrossClientCalls() throws Exception {
  final String MSG="String_Node_Str";
  final RpcServer server=new NettyRpcServerBuilder(BIND_ADDRESS).addClass(State.class,ServerState.class).build();
  final ClientState clientState=new ClientState();
  final RpcClient client=new NettyRpcClientBuilder(BIND_ADDRESS).addObject(State.class,clientState).build();
  final State serverStateProxy=client.getRemote().getProxy(State.class);
  try {
    serverStateProxy.set(MSG);
    serverStateProxy.get();
    giveTimeForMessagesToBeProcessed();
    assertThat(clientState.state,equalTo(MSG));
  }
  finally {
    client.shutdown();
    server.shutdown();
  }
}

Fixed version (ground truth):
@Test(timeout=TIMEOUT) public void serverImplementationsAreCachedIeStatePersistsAcrossClientCalls() throws Exception {
  final String MSG="String_Node_Str";
  final RpcServer server=new NettyRpcServerBuilder(BIND_ADDRESS).addClass(State.class,ServerState.class).build();
  final ClientState clientState=new ClientState();
  final RpcClient client=new NettyRpcClientBuilder(BIND_ADDRESS).addObject(State.class,clientState).build();
  final State serverStateProxy=client.getRemote().getProxy(State.class);
  try {
    serverStateProxy.set(MSG);
    serverStateProxy.get();
    giveTimeForMessagesToBeProcessed();
    assertThat(clientState.state,equalTo(MSG));
  }
  finally {
    client.shutdown();
    server.shutdown();
  }
}
Program: 178970
Project: 178970
Buggy source:
@Test(timeout=Config.TIMEOUT) public void invokesMethodsWithNoParamsAndVoidReturnType() throws Exception {
  final NoParamsVoidReturn impl=mockery.mock(NoParamsVoidReturn.class);
  mockery.checking(new Expectations(){
{
      one(impl).go();
    }
  }
);
  final RpcServer server=new NettyRpcServerBuilder(BIND_ADDRESS).addObject(NoParamsVoidReturn.class,impl).build();
  final RpcClient client=new NettyRpcClientBuilder(BIND_ADDRESS).build();
  final NoParamsVoidReturn proxy=client.getRemote().getProxy(NoParamsVoidReturn.class);
  try {
    proxy.go();
    giveTimeForMessagesToBeProcessed();
  }
  finally {
    client.shutdown();
    server.shutdown();
  }
}

Fixed version (ground truth):
@Test(timeout=TIMEOUT) public void invokesMethodsWithNoParamsAndVoidReturnType() throws Exception {
  final NoParamsVoidReturn impl=mockery.mock(NoParamsVoidReturn.class);
  mockery.checking(new Expectations(){
{
      one(impl).go();
    }
  }
);
  final RpcServer server=new NettyRpcServerBuilder(BIND_ADDRESS).addObject(NoParamsVoidReturn.class,impl).build();
  final RpcClient client=new NettyRpcClientBuilder(BIND_ADDRESS).build();
  final NoParamsVoidReturn proxy=client.getRemote().getProxy(NoParamsVoidReturn.class);
  try {
    proxy.go();
    giveTimeForMessagesToBeProcessed();
  }
  finally {
    client.shutdown();
    server.shutdown();
  }
}
Program: 178971
Project: 178971
Buggy source:
@Test(timeout=Config.TIMEOUT) public void exceptionsFromServerSideImplementationArePassedToClient() throws Throwable {
  final ThrowableThrower impl=new ThrowableThrower(){
    @Override public void go() throws Throwable {
      throw new IllegalAccessException("String_Node_Str");
    }
  }
;
  final ExceptionListener listener=mockery.mock(ExceptionListener.class);
  mockery.checking(new Expectations(){
{
      one(listener).onExceptionCaught(with(any(Remote.class)),with(any(RemoteException.class)));
    }
  }
);
  final RpcServer server=new NettyRpcServerBuilder(BIND_ADDRESS).addObject(ThrowableThrower.class,impl).build();
  final RpcClient client=new NettyRpcClientBuilder(BIND_ADDRESS).addExceptionListener(listener).build();
  final ThrowableThrower proxy=client.getRemote().getProxy(ThrowableThrower.class);
  try {
    proxy.go();
    giveTimeForMessagesToBeProcessed();
  }
  finally {
    client.shutdown();
    server.shutdown();
  }
}

Fixed version (ground truth):
@Test(timeout=TIMEOUT) public void exceptionsFromServerSideImplementationArePassedToClient() throws Throwable {
  final ThrowableThrower impl=new ThrowableThrower(){
    @Override public void go() throws Throwable {
      throw new IllegalAccessException("String_Node_Str");
    }
  }
;
  final ExceptionListener listener=mockery.mock(ExceptionListener.class);
  mockery.checking(new Expectations(){
{
      one(listener).onExceptionCaught(with(any(Remote.class)),with(any(RemoteException.class)));
    }
  }
);
  final RpcServer server=new NettyRpcServerBuilder(BIND_ADDRESS).addObject(ThrowableThrower.class,impl).build();
  final RpcClient client=new NettyRpcClientBuilder(BIND_ADDRESS).addExceptionListener(listener).build();
  final ThrowableThrower proxy=client.getRemote().getProxy(ThrowableThrower.class);
  try {
    proxy.go();
    giveTimeForMessagesToBeProcessed();
  }
  finally {
    client.shutdown();
    server.shutdown();
  }
}
Program: 178972
Project: 178972
Buggy source:
@Test(timeout=Config.TIMEOUT) public void serverShutdownDoesNotHangIfThereAreStillClientsConnected() throws Exception {
  final RpcServer server=new NettyRpcServerBuilder(BIND_ADDRESS).build();
  final RpcClient client=new NettyRpcClientBuilder(BIND_ADDRESS).build();
  server.shutdown();
  client.shutdown();
}

Fixed version (ground truth):
@Test(timeout=TIMEOUT) public void serverShutdownDoesNotHangIfThereAreStillClientsConnected() throws Exception {
  final RpcServer server=new NettyRpcServerBuilder(BIND_ADDRESS).build();
  final RpcClient client=new NettyRpcClientBuilder(BIND_ADDRESS).build();
  server.shutdown();
  client.shutdown();
}
Program: 178973
Project: 178973
Buggy source:
@Test(timeout=Config.TIMEOUT) public void serverNotifiesAboutClientConnectsAndDisconnects() throws Exception {
  final ClientListener mock=mockery.mock(ClientListener.class);
  final RpcServer server=new NettyRpcServerBuilder(BIND_ADDRESS).addClientListener(mock).build();
  mockery.checking(new Expectations(){
{
      one(mock).onClientConnect(with(any(Remote.class)));
    }
  }
);
  final RpcClient client=new NettyRpcClientBuilder(BIND_ADDRESS).build();
  mockery.checking(new Expectations(){
{
      one(mock).onClientDisconnect(with(any(Remote.class)));
    }
  }
);
  client.shutdown();
  giveTimeForMessagesToBeProcessed();
  server.shutdown();
}

Fixed version (ground truth):
@Test(timeout=TIMEOUT) public void serverNotifiesAboutClientConnectsAndDisconnects() throws Exception {
  final ClientListener mock=mockery.mock(ClientListener.class);
  final RpcServer server=new NettyRpcServerBuilder(BIND_ADDRESS).addClientListener(mock).build();
  mockery.checking(new Expectations(){
{
      one(mock).onClientConnect(with(any(Remote.class)));
    }
  }
);
  final RpcClient client=new NettyRpcClientBuilder(BIND_ADDRESS).build();
  mockery.checking(new Expectations(){
{
      one(mock).onClientDisconnect(with(any(Remote.class)));
    }
  }
);
  client.shutdown();
  giveTimeForMessagesToBeProcessed();
  server.shutdown();
}
Program: 178975
Project: 178975
Buggy source:
private static byte[] readDevice(DeviceHandler device,byte command) throws YubiHSMErrorException {
  byte[] result=new byte[0];
  if (device.available() > 0) {
    result=device.read(2);
  }
  if (result.length == 0) {
    reset(device);
    throw new YubiHSMErrorException("String_Node_Str");
  }
  if ((result[1] & Defines.YSM_RESPONSE) != 0) {
    log.debug("String_Node_Str",result[1],Defines.getCommandString((byte)(result[1] - Defines.YSM_RESPONSE)));
  }
  if (result[1] == (command | Defines.YSM_RESPONSE)) {
    int len=(int)result[0] - 1;
    return device.read(len);
  }
 else {
    reset(device);
    throw new YubiHSMErrorException("String_Node_Str");
  }
}

Fixed version (ground truth):
private static byte[] readDevice(DeviceHandler device,byte command) throws YubiHSMErrorException {
  byte[] result=new byte[0];
  if (device.available() > 0) {
    result=device.read(2);
  }
  if (result.length == 0) {
    reset(device);
    throw new YubiHSMErrorException("String_Node_Str");
  }
  if ((result[1] & Defines.YSM_RESPONSE) != 0) {
    log.debug("String_Node_Str",result[1],Defines.getCommandString((byte)(result[1] - Defines.YSM_RESPONSE)));
  }
  if (result[1] == (command | Defines.YSM_RESPONSE)) {
    int len=(int)result[0] - 1;
    return device.read(len);
  }
 else {
    reset(device);
    throw new YubiHSMErrorException("String_Node_Str" + Defines.getCommandString(command) + "String_Node_Str"+ Defines.getCommandString((byte)(result[1] - Defines.YSM_RESPONSE)));
  }
}
Program: 178976
Project: 178976
Buggy source:
protected static synchronized byte[] execute(DeviceHandler device,byte command,byte[] data,boolean readResponse) throws YubiHSMErrorException {
  byte[] cmdBuffer;
  if (command != Defines.YSM_NULL) {
    cmdBuffer=new byte[]{(byte)(((data.length + 1) << 24) >> 24),command};
  }
 else {
    cmdBuffer=new byte[]{command};
  }
  log.debug("String_Node_Str",Utils.byteArrayToHex(Utils.concatAllArrays(cmdBuffer,data)));
  device.write(Utils.concatAllArrays(cmdBuffer,data));
  if (!readResponse) {
    try {
      Thread.sleep(10);
      return null;
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
  try {
    int timeout=(int)device.getTimeout() * 1000;
    int sleptTime=0;
    log.debug("String_Node_Str" + Defines.getCommandString(command) + "String_Node_Str"+ timeout);
    while (sleptTime <= timeout) {
      Thread.sleep(1);
      sleptTime+=1;
      if (device.available() > 0) {
        break;
      }
    }
    log.debug("String_Node_Str" + sleptTime + "String_Node_Str");
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
  return readDevice(device,command);
}

Fixed version (ground truth):
protected static synchronized byte[] execute(DeviceHandler device,byte command,byte[] data,boolean readResponse) throws YubiHSMErrorException {
  byte[] cmdBuffer;
  if (command != Defines.YSM_NULL) {
    cmdBuffer=new byte[]{(byte)(((data.length + 1) << 24) >> 24),command};
  }
 else {
    cmdBuffer=new byte[]{command};
  }
  log.debug("String_Node_Str",Utils.byteArrayToHex(Utils.concatAllArrays(cmdBuffer,data)));
  device.write(Utils.concatAllArrays(cmdBuffer,data));
  try {
    if (!readResponse) {
      Thread.sleep(10);
      return null;
    }
    int sleptTime=0;
    int timeout=100;
    if (device.getTimeout() > 0) {
      timeout=(int)(device.getTimeout() * 1000);
    }
    log.debug("String_Node_Str",Defines.getCommandString(command),timeout);
    while (sleptTime <= timeout) {
      Thread.sleep(1);
      sleptTime+=1;
      if (device.available() > 0) {
        break;
      }
    }
    log.debug("String_Node_Str",sleptTime);
  }
 catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
  return readDevice(device,command);
}
Program: 178977
Project: 178977
Buggy source:
private void addKeys() throws Exception {
  for (int i=0; i < 32; i++) {
    int flags=1 << i;
    String key=new String();
    key=duplicateStr(String.format("String_Node_Str",i + 1),32);
    addKey(flags,i,key);
  }
  addKey(0x200,0x1000,duplicateStr("String_Node_Str",32));
  addKey(0xe000,0x1001,duplicateStr("String_Node_Str",16));
  addKey(0xffffffff,0x2000,duplicateStr("String_Node_Str",16));
  addKey(0x10000,0x3031,"String_Node_Str");
}

Fixed version (ground truth):
private void addKeys() throws Exception {
  for (int i=0; i <= 30; i++) {
    int flags=1 << i;
    String key=new String();
    key=duplicateStr(String.format("String_Node_Str",i + 1),32);
    addKey(flags,i + 1,key);
  }
  addKey(0x200,0x1000,duplicateStr("String_Node_Str",32));
  addKey(0xe000,0x1001,duplicateStr("String_Node_Str",16));
  addKey(0xffffffff,0x2000,duplicateStr("String_Node_Str",16));
  addKey(0x10000,0x3031,"String_Node_Str");
}
Program: 178978
Project: 178978
Buggy source:
/** 
 * Generate AEAD block of data buffer for a specific key. After a key has been loaded into the internal data buffer, this command can be used a number of times to get AEADs of the data buffer for different key handles. For example, to encrypt a YubiKey secrets to one or more Yubico KSM's that all have a YubiHSM attached to them.
 * @param device the YubiHSM device handler
 * @param nonce the nonce
 * @param keyHandle the key to use
 * @return a hash map with the AEAD and nonce
 * @throws YubiHSMInputException argmuent exceptions
 * @throws YubiHSMCommandFailedException command failed exception
 * @throws YubiHSMErrorException error exception
 */
public static Map<String,String> generateBufferAEAD(DeviceHandler device,String nonce,int keyHandle) throws YubiHSMInputException, YubiHSMCommandFailedException, YubiHSMErrorException {
  byte[] nonceBA=Utils.validateNonce(Utils.hexToByteArray(nonce),true);
  byte[] cmdBuffer=Utils.concatAllArrays(nonceBA,Utils.leIntToBA(keyHandle));
  byte[] result=CommandHandler.execute(device,Defines.YSM_BUFFER_AEAD_GENERATE,cmdBuffer,true);
  return parseResult(result,nonce,keyHandle,Defines.YSM_BUFFER_AEAD_GENERATE);
}

Fixed version (ground truth):
/** 
 * Generate AEAD block of data buffer for a specific key. After a key has been loaded into the internal data buffer, this command can be used a number of times to get AEADs of the data buffer for different key handles. For example, to encrypt a YubiKey secrets to one or more Yubico KSM's that all have a YubiHSM attached to them.
 * @param device the YubiHSM device handler
 * @param nonce the nonce
 * @param keyHandle the key to use
 * @return a hash map with the AEAD and nonce
 * @throws YubiHSMInputException argument exceptions
 * @throws YubiHSMCommandFailedException command failed exception
 * @throws YubiHSMErrorException error exception
 */
public static Map<String,String> generateBufferAEAD(DeviceHandler device,String nonce,int keyHandle) throws YubiHSMInputException, YubiHSMCommandFailedException, YubiHSMErrorException {
  byte[] nonceBA=Utils.validateNonce(Utils.hexToByteArray(nonce),true);
  byte[] cmdBuffer=Utils.concatAllArrays(nonceBA,Utils.leIntToBA(keyHandle));
  byte[] result=CommandHandler.execute(device,Defines.YSM_BUFFER_AEAD_GENERATE,cmdBuffer,true);
  return parseResult(result,nonce,keyHandle,Defines.YSM_BUFFER_AEAD_GENERATE);
}
Program: 178979
Project: 178979
Buggy source:
/** 
 * Validate an AEAD using the YubiHSM, matching it against some known plain text. Matching is done inside the YubiHSM so the decrypted AEAD is never exposed.
 * @param device the YubiHSM device
 * @param nonce the nonce or public_id
 * @param keyHandle the key to use
 * @param aead the AEAD
 * @param plaintext the plain text string
 * @return returns true if validation was a success, false if the validation failed
 * @throws YubiHSMInputException argument exceptions
 * @throws YubiHSMCommandFailedException command failed exception
 * @throws YubiHSMErrorException error exception
 */
public static boolean validateAEAD(DeviceHandler device,String nonce,int keyHandle,String aead,String plaintext) throws YubiHSMInputException, YubiHSMCommandFailedException, YubiHSMErrorException {
  byte[] aeadBA=Utils.validateByteArray("String_Node_Str",Utils.hexToByteArray(aead),Defines.YSM_MAX_KEY_SIZE + Defines.YSM_AEAD_MAC_SIZE,0,0);
  byte[] plainBA=Utils.validateByteArray("String_Node_Str",plaintext.getBytes(),0,aeadBA.length - Defines.YSM_AEAD_MAC_SIZE,YubiHSM.minHashLength);
  byte[] plainAndAead=Utils.concatAllArrays(plainBA,aeadBA);
  byte[] nonceBA=Utils.validateNonce(Utils.hexToByteArray(nonce),true);
  byte[] cmdBuffer=Utils.concatAllArrays(nonceBA,Utils.leIntToBA(keyHandle),Utils.addLengthToData(plainAndAead));
  byte[] result=CommandHandler.execute(device,Defines.YSM_AEAD_DECRYPT_CMP,cmdBuffer,true);
  return parseValidationResult(result,nonce,keyHandle);
}

Fixed version (ground truth):
/** 
 * Validate an AEAD using the YubiHSM, matching it against some known plain text. Matching is done inside the YubiHSM so the decrypted AEAD is never exposed.
 * @param device the YubiHSM device
 * @param nonce the nonce or public_id
 * @param keyHandle the key to use
 * @param aead the AEAD
 * @param plaintext the plain text string
 * @return returns true if validation was a success, false if the validation failed
 * @throws YubiHSMInputException argument exceptions
 * @throws YubiHSMCommandFailedException command failed exception
 * @throws YubiHSMErrorException error exception
 */
public static boolean validateAEAD(DeviceHandler device,String nonce,int keyHandle,String aead,String plaintext) throws YubiHSMInputException, YubiHSMCommandFailedException, YubiHSMErrorException {
  byte[] aeadBA=Utils.hexToByteArray(aead);
  byte[] plainBA=Utils.validateByteArray("String_Node_Str",plaintext.getBytes(),0,aeadBA.length - Defines.YSM_AEAD_MAC_SIZE,YubiHSM.minHashLength);
  byte[] plainAndAead=Utils.concatAllArrays(plainBA,aeadBA);
  if (plainAndAead.length > (Defines.YSM_MAX_PKT_SIZE - 0x10))   throw new YubiHSMInputException("String_Node_Str");
  byte[] nonceBA=Utils.validateNonce(Utils.hexToByteArray(nonce),true);
  byte[] cmdBuffer=Utils.concatAllArrays(nonceBA,Utils.leIntToBA(keyHandle),Utils.addLengthToData(plainAndAead));
  byte[] result=CommandHandler.execute(device,Defines.YSM_AEAD_DECRYPT_CMP,cmdBuffer,true);
  return parseValidationResult(result,nonce,keyHandle);
}
Program: 178980
Project: 178980
Buggy source:
/** 
 * Generate AEAD block of data buffer for a specific key. After a key has been loaded into the internal data buffer, this command can be used a number of times to get AEADs of the data buffer for different key handles. For example, to encrypt a YubiKey secrets to one or more Yubico KSM's that all have a YubiHSM attached to them.
 * @param device the YubiHSM device handler
 * @param nonce the nonce
 * @param keyHandle the key to use
 * @return a hash map with the AEAD and nonce
 * @throws YubiHSMInputException argmuent exceptions
 * @throws YubiHSMCommandFailedException command failed exception
 * @throws YubiHSMErrorException error exception
 */
public static Map<String,String> generateBufferAEAD(DeviceHandler device,String nonce,int keyHandle) throws YubiHSMInputException, YubiHSMCommandFailedException, YubiHSMErrorException {
  byte[] nonceBA=Utils.validateNonce(Utils.hexToByteArray(nonce),true);
  byte[] cmdBuffer=Utils.concatAllArrays(nonceBA,Utils.leIntToBA(keyHandle));
  byte[] result=CommandHandler.execute(device,Defines.YSM_BUFFER_AEAD_GENERATE,cmdBuffer,true);
  return parseResult(result,nonce,keyHandle);
}

Fixed version (ground truth):
/** 
 * Generate AEAD block of data buffer for a specific key. After a key has been loaded into the internal data buffer, this command can be used a number of times to get AEADs of the data buffer for different key handles. For example, to encrypt a YubiKey secrets to one or more Yubico KSM's that all have a YubiHSM attached to them.
 * @param device the YubiHSM device handler
 * @param nonce the nonce
 * @param keyHandle the key to use
 * @return a hash map with the AEAD and nonce
 * @throws YubiHSMInputException argmuent exceptions
 * @throws YubiHSMCommandFailedException command failed exception
 * @throws YubiHSMErrorException error exception
 */
public static Map<String,String> generateBufferAEAD(DeviceHandler device,String nonce,int keyHandle) throws YubiHSMInputException, YubiHSMCommandFailedException, YubiHSMErrorException {
  byte[] nonceBA=Utils.validateNonce(Utils.hexToByteArray(nonce),true);
  byte[] cmdBuffer=Utils.concatAllArrays(nonceBA,Utils.leIntToBA(keyHandle));
  byte[] result=CommandHandler.execute(device,Defines.YSM_BUFFER_AEAD_GENERATE,cmdBuffer,true);
  return parseResult(result,nonce,keyHandle,Defines.YSM_BUFFER_AEAD_GENERATE);
}
Program: 178981
Project: 178981
Buggy source:
/** 
 * Generate AEADCmd block from data for a specific key and nonce.
 * @param device the YubiHSM device handler
 * @param nonce the nonce
 * @param keyHandle the key to use
 * @param data is either a string or a YubiHSM YubiKey secret
 * @return a hash map with the AEAD and nonce
 * @throws YubiHSMInputException argument exceptions
 * @throws YubiHSMCommandFailedException command failed exception
 * @throws YubiHSMErrorException error exception
 */
public static Map<String,String> generateAEAD(DeviceHandler device,String nonce,int keyHandle,String data) throws YubiHSMInputException, YubiHSMCommandFailedException, YubiHSMErrorException {
  byte[] nonceBA=Utils.validateNonce(Utils.hexToByteArray(nonce),true);
  byte[] newdata=Utils.validateByteArray("String_Node_Str",data.getBytes(),0,0,YubiHSM.minHashLength);
  byte[] cmdBuffer=Utils.concatAllArrays(nonceBA,Utils.leIntToBA(keyHandle),Utils.addLengthToData(newdata));
  byte[] result=CommandHandler.execute(device,Defines.YSM_AEAD_GENERATE,cmdBuffer,true);
  return parseResult(result,nonce,keyHandle);
}

Fixed version (ground truth):
/** 
 * Generate AEADCmd block from data for a specific key and nonce.
 * @param device the YubiHSM device handler
 * @param nonce the nonce
 * @param keyHandle the key to use
 * @param data is either a string or a YubiHSM YubiKey secret
 * @return a hash map with the AEAD and nonce
 * @throws YubiHSMInputException argument exceptions
 * @throws YubiHSMCommandFailedException command failed exception
 * @throws YubiHSMErrorException error exception
 */
public static Map<String,String> generateAEAD(DeviceHandler device,String nonce,int keyHandle,String data) throws YubiHSMInputException, YubiHSMCommandFailedException, YubiHSMErrorException {
  byte[] nonceBA=Utils.validateNonce(Utils.hexToByteArray(nonce),true);
  byte[] newdata=Utils.validateByteArray("String_Node_Str",data.getBytes(),0,0,YubiHSM.minHashLength);
  byte[] cmdBuffer=Utils.concatAllArrays(nonceBA,Utils.leIntToBA(keyHandle),Utils.addLengthToData(newdata));
  byte[] result=CommandHandler.execute(device,Defines.YSM_AEAD_GENERATE,cmdBuffer,true);
  return parseResult(result,nonce,keyHandle,Defines.YSM_AEAD_GENERATE);
}
Program: 178982
Project: 178982
Buggy source:
/** 
 * Parse the response from the YubiHSM for a previous command.
 * @param data the data from the YubiHSM
 * @param nonce the original nonce
 * @param keyHandle the key used to generate AEAD
 * @return a hash map with the AEAD and nonce
 * @throws YubiHSMCommandFailedException command failed exception
 * @throws YubiHSMErrorException error exception
 */
private static Map<String,String> parseResult(byte[] data,String nonce,int keyHandle) throws YubiHSMCommandFailedException, YubiHSMErrorException {
  Map<String,String> result=new HashMap<String,String>();
  if (data[10] == Defines.YSM_STATUS_OK) {
    byte[] aead=Utils.rangeOfByteArray(data,Defines.YSM_AEAD_NONCE_SIZE + 6,data[11]);
    Utils.validateCmdResponseBA("String_Node_Str",Utils.rangeOfByteArray(data,6,4),Utils.leIntToBA(keyHandle));
    result.put("String_Node_Str",Utils.validateCmdResponseString("String_Node_Str",Utils.byteArrayToHex(Utils.rangeOfByteArray(data,0,Defines.YSM_AEAD_NONCE_SIZE)),nonce));
    result.put("String_Node_Str",Utils.byteArrayToHex(aead));
  }
 else {
    throw new YubiHSMCommandFailedException("String_Node_Str" + Defines.getCommandString(Defines.YSM_AEAD_GENERATE) + "String_Node_Str"+ Defines.getCommandStatus(data[10]));
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Parse the response from the YubiHSM for a previous command.
 * @param data the data from the YubiHSM
 * @param nonce the original nonce
 * @param keyHandle the key used to generate AEAD
 * @param command the YubiHSM command executed
 * @return a hash map with the AEAD and nonce
 * @throws YubiHSMCommandFailedException command failed exception
 * @throws YubiHSMErrorException error exception
 */
private static Map<String,String> parseResult(byte[] data,String nonce,int keyHandle,byte command) throws YubiHSMCommandFailedException, YubiHSMErrorException {
  Map<String,String> result=new HashMap<String,String>();
  if (data[10] == Defines.YSM_STATUS_OK) {
    byte[] aead=Utils.rangeOfByteArray(data,Defines.YSM_AEAD_NONCE_SIZE + 6,data[11]);
    Utils.validateCmdResponseBA("String_Node_Str",Utils.rangeOfByteArray(data,6,4),Utils.leIntToBA(keyHandle));
    result.put("String_Node_Str",Utils.validateCmdResponseString("String_Node_Str",Utils.byteArrayToHex(Utils.rangeOfByteArray(data,0,Defines.YSM_AEAD_NONCE_SIZE)),nonce));
    result.put("String_Node_Str",Utils.byteArrayToHex(aead));
  }
 else {
    throw new YubiHSMCommandFailedException("String_Node_Str" + Defines.getCommandString(command) + "String_Node_Str"+ Defines.getCommandStatus(data[10]));
  }
  return result;
}
Program: 178983
Project: 178983
Buggy source:
/** 
 * Generate a random AEAD block using the YubiHSM internal TRNG. To generate a secret for a YubiKey use public_id as nonce.
 * @param device the YubiHSM device handler
 * @param nonce the nonce or public_id
 * @param keyHandle the key to use
 * @param size the resulting byte length of the AEAD
 * @return a hash map with the AEAD and nonce
 * @throws YubiHSMInputException argument exceptions
 * @throws YubiHSMCommandFailedException command failed exception
 * @throws YubiHSMErrorException error exception
 */
public static Map<String,String> generateRandomAEAD(DeviceHandler device,String nonce,int keyHandle,int size) throws YubiHSMInputException, YubiHSMCommandFailedException, YubiHSMErrorException {
  byte[] nonceBA=Utils.validateNonce(Utils.hexToByteArray(nonce),true);
  byte[] len={(byte)((size << 24) >> 24)};
  byte[] cmdBuffer=Utils.concatAllArrays(nonceBA,Utils.leIntToBA(keyHandle),len);
  byte[] result=CommandHandler.execute(device,Defines.YSM_RANDOM_AEAD_GENERATE,cmdBuffer,true);
  return parseResult(result,nonce,keyHandle);
}

Fixed version (ground truth):
/** 
 * Generate a random AEAD block using the YubiHSM internal TRNG. To generate a secret for a YubiKey use public_id as nonce.
 * @param device the YubiHSM device handler
 * @param nonce the nonce or public_id
 * @param keyHandle the key to use
 * @param size the resulting byte length of the AEAD
 * @return a hash map with the AEAD and nonce
 * @throws YubiHSMInputException argument exceptions
 * @throws YubiHSMCommandFailedException command failed exception
 * @throws YubiHSMErrorException error exception
 */
public static Map<String,String> generateRandomAEAD(DeviceHandler device,String nonce,int keyHandle,int size) throws YubiHSMInputException, YubiHSMCommandFailedException, YubiHSMErrorException {
  byte[] nonceBA=Utils.validateNonce(Utils.hexToByteArray(nonce),true);
  byte[] len={(byte)((size << 24) >> 24)};
  byte[] cmdBuffer=Utils.concatAllArrays(nonceBA,Utils.leIntToBA(keyHandle),len);
  byte[] result=CommandHandler.execute(device,Defines.YSM_RANDOM_AEAD_GENERATE,cmdBuffer,true);
  return parseResult(result,nonce,keyHandle,Defines.YSM_RANDOM_AEAD_GENERATE);
}
Program: 178985
Project: 178985
Buggy source:
public Board(){
  gameboard=new int[3][3];
  isXTurn=true;
  myBot=new DumbBot(this,2);
}

Fixed version (ground truth):
public Board(){
  gameboard=new int[3][3];
  isXTurn=true;
  myBot=new GeniusBot(this,2);
}
Program: 178986
Project: 178986
Buggy source:
public int[][] getIntArray(){
  return gameboard;
}

Fixed version (ground truth):
public int[][] getIntArray(){
  int[][] temp=new int[3][3];
  for (int r=0; r < 3; r++) {
    for (int c=0; c < 3; c++) {
      temp[r][c]=gameboard[r][c];
    }
  }
  return temp;
}
Program: 178987
Project: 178987
Buggy source:
public int evaluate(int x,int y){
  int ans=0;
  if (!infoBoard.canMove(x,y))   return -100;
  if (isWinner(x,y))   ans+=500;
  if (isBlocker(x,y))   ans+=250;
  if (isCenter(x,y))   ans+=100;
  if (isCorner(x,y))   ans+=25;
  return ans + (int)(Math.random() * 10);
}

Fixed version (ground truth):
public int evaluate(int x,int y){
  int ans=0;
  if (!infoBoard.canMove(x,y))   return -100;
  if (isWinner(x,y))   ans+=500;
  if (isBlocker(x,y))   ans+=250;
  if (isCenter(x,y))   ans+=100;
  if (isCorner(x,y))   ans+=10;
  if (catchCornerTrap(x,y))   ans+=50;
  return ans + (int)(Math.random() * 5);
}
Program: 178988
Project: 178988
Buggy source:
public Board(){
  gameboard=new int[3][3];
  isXTurn=true;
}

Fixed version (ground truth):
public Board(){
  gameboard=new int[3][3];
  isXTurn=true;
  myBot=new DumbBot(this,2);
}
Program: 178989
Project: 178989
Buggy source:
public boolean makeMove(int x,int y){
  if (gameboard[x][y] == 0) {
    if (isXTurn) {
      gameboard[x][y]=1;
    }
 else {
      gameboard[x][y]=2;
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
public boolean makeMove(int x,int y){
  if (gameboard[x][y] == 0) {
    if (isXTurn) {
      gameboard[x][y]=1;
    }
 else {
      gameboard[x][y]=2;
    }
    switchTurn();
    return true;
  }
  return false;
}
Program: 178990
Project: 178990
Buggy source:
public void makeNextMove(){
  getNextMove();
  gameBoard.makeMove(next_move_xcor,next_move_ycor);
  displayBoard.display();
}

Fixed version (ground truth):
public void makeNextMove(){
  if (!gameBoard.isFilled()) {
    getNextMove();
    gameBoard.makeMove(next_move_xcor,next_move_ycor);
  }
}
Program: 178991
Project: 178991
Buggy source:
public DumbBot(Board newboard,int n,GameBoard display){
  gameBoard=newboard;
  displayBoard=display;
  team=n;
}

Fixed version (ground truth):
public DumbBot(Board newboard,int n){
  gameBoard=newboard;
  team=n;
}
Program: 178992
Project: 178992
Buggy source:
@Override public void sendTokens(Map<Connector,WorkToken> tokens){
  throw new IllegalStateException("String_Node_Str");
}

Fixed version (ground truth):
@Override public void sendTokens(Map<Connector,WorkToken> tokens){
  tokenOut.set(true);
  throw new IllegalStateException("String_Node_Str");
}
Program: 178993
Project: 178993
Buggy source:
@SuppressWarnings("String_Node_Str") private void cleanUpStartNodes(BusinessProcess process){
  acquireEntityManager();
  List<CatchEventNode> nodes=em.get().createNamedQuery("String_Node_Str").setParameter("String_Node_Str",process).getResultList();
  for (  CatchEventNode node : nodes) {
    if (em.get().contains(node)) {
      em.get().remove(node);
    }
  }
  releaseEntityManager();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private void cleanUpStartNodes(BusinessProcess process){
  acquireEntityManager();
  List<CatchEventNode> nodes=em.get().createNamedQuery("String_Node_Str").setParameter("String_Node_Str",process).getResultList();
  for (  CatchEventNode node : nodes) {
    em.get().remove(node);
  }
  releaseEntityManager();
}
Program: 178994
Project: 178994
Buggy source:
private Object merge(final Object o){
  if (isRunner()) {
    return em.get().merge(o);
  }
 else {
    final LinkedBlockingQueue<Object> kicker=new LinkedBlockingQueue<Object>();
    executor.execute(new Runnable(){
      @Override public void run(){
        acquireEntityManager();
        beginTransaction();
        Object mergedEntity=em.get().merge(o);
        commitTransaction();
        releaseEntityManager();
        kicker.add(mergedEntity);
      }
    }
);
    try {
      Object entity=null;
      int retries=40;
      while (entity == null && retries > 0) {
        --retries;
        entity=kicker.poll(500,TimeUnit.MILLISECONDS);
      }
      return entity;
    }
 catch (    InterruptedException e) {
      Thread.currentThread().interrupt();
    }
  }
  return null;
}

Fixed version (ground truth):
private Object merge(final Object o){
  if (isRunner()) {
    return em.get().merge(o);
  }
 else {
    final LinkedBlockingQueue<Object> kicker=new LinkedBlockingQueue<Object>();
    executor.execute(new Runnable(){
      @Override public void run(){
        acquireEntityManager();
        beginTransaction();
        Object mergedEntity=em.get().merge(o);
        commitTransaction();
        em.get().detach(mergedEntity);
        releaseEntityManager();
        kicker.add(mergedEntity);
      }
    }
);
    try {
      Object entity=null;
      int retries=40;
      while (entity == null && retries > 0) {
        --retries;
        entity=kicker.poll(500,TimeUnit.MILLISECONDS);
      }
      return entity;
    }
 catch (    InterruptedException e) {
      Thread.currentThread().interrupt();
    }
  }
  return null;
}