nus-yam/ex-repair huggingface dataset:
Program: 24202
Project: 24202
Buggy source:
private ChannelFutureListener whenAbortedOrFinished(final ChannelHandlerContext ctx){
  final AtomicBoolean latch=new AtomicBoolean();
  return new ChannelFutureListener(){
    @Override public void operationComplete(    ChannelFuture future) throws Exception {
      if (latch.compareAndSet(false,true)) {
        sendFinishedMessage(ctx);
      }
    }
  }
;
}

Fixed version (ground truth):
private ChannelFutureListener whenAbortedOrFinished(final ChannelHandlerContext ctx){
  final AtomicBoolean oneTimeOnly=new AtomicBoolean();
  return new ChannelFutureListener(){
    @Override public void operationComplete(    ChannelFuture future) throws Exception {
      if (oneTimeOnly.compareAndSet(false,true)) {
        for (        CountDownLatch latch : notifiedLatches) {
          latch.await();
        }
        sendFinishedMessage(ctx);
      }
    }
  }
;
}
Program: 24203
Project: 24203
Buggy source:
@Override public void operationComplete(ChannelFuture future) throws Exception {
  if (latch.compareAndSet(false,true)) {
    sendFinishedMessage(ctx);
  }
}

Fixed version (ground truth):
@Override public void operationComplete(ChannelFuture future) throws Exception {
  if (oneTimeOnly.compareAndSet(false,true)) {
    for (    CountDownLatch latch : notifiedLatches) {
      latch.await();
    }
    sendFinishedMessage(ctx);
  }
}
Program: 24204
Project: 24204
Buggy source:
private void writeNotifiedOnBarrier(final String barrier,final ChannelHandlerContext ctx) throws Exception {
  robot.awaitBarrier(barrier).addListener(new ChannelFutureListener(){
    @Override public void operationComplete(    ChannelFuture future) throws Exception {
      if (future.isSuccess()) {
        logger.debug("String_Node_Str" + barrier);
        final NotifiedMessage notified=new NotifiedMessage();
        notified.setBarrier(barrier);
        Channels.write(ctx,Channels.future(null),notified);
      }
    }
  }
);
}

Fixed version (ground truth):
private void writeNotifiedOnBarrier(final String barrier,final ChannelHandlerContext ctx) throws Exception {
  final CountDownLatch latch=new CountDownLatch(1);
  finishLatches.add(latch);
  robot.awaitBarrier(barrier).addListener(new ChannelFutureListener(){
    @Override public void operationComplete(    ChannelFuture future) throws Exception {
      try {
        if (future.isSuccess()) {
          logger.debug("String_Node_Str" + barrier);
          final NotifiedMessage notified=new NotifiedMessage();
          notified.setBarrier(barrier);
          Channels.write(ctx,Channels.future(null),notified);
        }
      }
  finally {
        latch.countDown();
      }
    }
  }
);
}
Program: 24205
Project: 24205
Buggy source:
private ChannelFutureListener whenAbortedOrFinished(final ChannelHandlerContext ctx){
  final AtomicBoolean latch=new AtomicBoolean();
  return new ChannelFutureListener(){
    @Override public void operationComplete(    ChannelFuture future) throws Exception {
      if (latch.compareAndSet(false,true)) {
        sendFinishedMessage(ctx);
      }
    }
  }
;
}

Fixed version (ground truth):
private ChannelFutureListener whenAbortedOrFinished(final ChannelHandlerContext ctx){
  return new ChannelFutureListener(){
    @Override public void operationComplete(    ChannelFuture future) throws Exception {
      for (      CountDownLatch latch : finishLatches) {
        latch.await();
      }
      sendFinishedMessage(ctx);
    }
  }
;
}
Program: 24206
Project: 24206
Buggy source:
@Override public void operationComplete(ChannelFuture future) throws Exception {
  if (latch.compareAndSet(false,true)) {
    sendFinishedMessage(ctx);
  }
}

Fixed version (ground truth):
@Override public void operationComplete(ChannelFuture future) throws Exception {
  for (  CountDownLatch latch : finishLatches) {
    latch.await();
  }
  sendFinishedMessage(ctx);
}
Program: 24207
Project: 24207
Buggy source:
@Override public void evaluate() throws Throwable {
  latch.setInterruptOnException(Thread.currentThread());
  FutureTask<ScriptPair> scriptFuture=new FutureTask<>(scriptRunner);
  try {
    new Thread(scriptFuture).start();
    latch.awaitPrepared();
    try {
      statement.evaluate();
    }
 catch (    AssumptionViolatedException e) {
      if (!latch.isFinished()) {
        scriptRunner.abort();
      }
      throw e;
    }
catch (    Throwable cause) {
      if (latch.hasException()) {
        throw cause;
      }
 else {
        if (!latch.isFinished()) {
          scriptRunner.abort();
        }
        try {
          ScriptPair scripts=scriptFuture.get(5,SECONDS);
          try {
            assertEquals("String_Node_Str",scripts.getExpectedScript(),scripts.getObservedScript());
            throw cause;
          }
 catch (          ComparisonFailure f) {
            f.initCause(cause);
            throw f;
          }
        }
 catch (        ExecutionException ee) {
          throw ee.getCause().initCause(cause);
        }
catch (        Exception e) {
          throw cause;
        }
      }
    }
    scriptRunner.dispose();
    String k3poSimpleName=K3poRule.class.getSimpleName();
    assertTrue(format("String_Node_Str",k3poSimpleName,k3poSimpleName),latch.isStartable());
    ScriptPair scripts=scriptFuture.get();
    assertEquals("String_Node_Str",scripts.getExpectedScript(),scripts.getObservedScript());
  }
  finally {
    scriptFuture.cancel(true);
  }
}

Fixed version (ground truth):
@Override public void evaluate() throws Throwable {
  latch.setInterruptOnException(Thread.currentThread());
  FutureTask<ScriptPair> scriptFuture=new FutureTask<>(scriptRunner);
  try {
    new Thread(scriptFuture).start();
    latch.awaitPrepared();
    try {
      statement.evaluate();
    }
 catch (    AssumptionViolatedException e) {
      if (!latch.isFinished()) {
        scriptRunner.abort();
      }
      throw e;
    }
catch (    Throwable cause) {
      if (latch.hasException()) {
        throw cause;
      }
 else {
        if (!latch.isFinished()) {
          scriptRunner.abort();
        }
        try {
          ScriptPair scripts=scriptFuture.get(5,SECONDS);
          try {
            assertEquals("String_Node_Str",scripts.getExpectedScript(),scripts.getObservedScript());
            throw cause;
          }
 catch (          ComparisonFailure f) {
            f.initCause(cause);
            throw f;
          }
        }
 catch (        ExecutionException ee) {
          throw ee.getCause().initCause(cause);
        }
catch (        Exception e) {
          throw cause;
        }
      }
    }
    String k3poSimpleName=K3poRule.class.getSimpleName();
    assertTrue(format("String_Node_Str",k3poSimpleName,k3poSimpleName),latch.isStartable());
    ScriptPair scripts=scriptFuture.get();
    assertEquals("String_Node_Str",scripts.getExpectedScript(),scripts.getObservedScript());
  }
  finally {
    try {
      scriptRunner.dispose();
    }
  finally {
      scriptFuture.cancel(true);
    }
  }
}
Program: 24208
Project: 24208
Buggy source:
@Override protected void closeRequested(ChannelPipeline pipeline,ChannelStateEvent evt) throws Exception {
}

Fixed version (ground truth):
@Override protected void closeRequested(ChannelPipeline pipeline,ChannelStateEvent evt) throws Exception {
  HttpClientChannel httpClientChannel=(HttpClientChannel)pipeline.getChannel();
  ChannelFuture httpFuture=evt.getFuture();
  httpFuture.setSuccess();
switch (httpClientChannel.state()) {
case UPGRADEABLE:
    transport.close();
  break;
default :
ChannelFuture inputShutdown=future(httpClientChannel);
shutdownOutputRequested(httpClientChannel,inputShutdown);
break;
}
boolean wasConnected=httpClientChannel.isConnected();
boolean wasBound=httpClientChannel.isBound();
if (httpClientChannel.setClosed()) {
if (wasConnected) {
fireChannelDisconnected(httpClientChannel);
}
if (wasBound) {
fireChannelUnbound(httpClientChannel);
}
fireChannelClosed(httpClientChannel);
}
}
Program: 24209
Project: 24209
Buggy source:
@Override protected void closeRequested(ChannelPipeline pipeline,ChannelStateEvent evt) throws Exception {
}

Fixed version (ground truth):
@Override protected void closeRequested(ChannelPipeline pipeline,ChannelStateEvent evt) throws Exception {
  HttpClientChannel httpClientChannel=(HttpClientChannel)pipeline.getChannel();
  ChannelFuture httpFuture=evt.getFuture();
  httpFuture.setSuccess();
switch (httpClientChannel.state()) {
case UPGRADEABLE:
    transport.close();
  break;
default :
ChannelFuture inputShutdown=future(httpClientChannel);
shutdownOutputRequested(httpClientChannel,inputShutdown);
break;
}
boolean wasConnected=httpClientChannel.isConnected();
boolean wasBound=httpClientChannel.isBound();
if (httpClientChannel.setClosed()) {
if (wasConnected) {
fireChannelDisconnected(httpClientChannel);
}
if (wasBound) {
fireChannelUnbound(httpClientChannel);
}
fireChannelClosed(httpClientChannel);
}
}
Program: 24210
Project: 24210
Buggy source:
@Override protected void closeRequested(ChannelPipeline pipeline,ChannelStateEvent evt) throws Exception {
  AgronaChannel channel=(AgronaChannel)evt.getChannel();
  channel.worker.close(channel);
}

Fixed version (ground truth):
@Override protected void closeRequested(ChannelPipeline pipeline,ChannelStateEvent evt) throws Exception {
  AgronaChannel channel=(AgronaChannel)evt.getChannel();
  ChannelFuture future=evt.getFuture();
  channel.worker.close(channel,future);
}
Program: 24211
Project: 24211
Buggy source:
@Override protected void shutdownOutputRequested(ChannelPipeline pipeline,ShutdownOutputEvent evt) throws Exception {
  AgronaChannel channel=(AgronaChannel)evt.getChannel();
  ChannelFuture shutdownOutputFuture=evt.getFuture();
  channel.worker.shutdownOutput(channel,shutdownOutputFuture);
}

Fixed version (ground truth):
@Override protected void shutdownOutputRequested(ChannelPipeline pipeline,ShutdownOutputEvent evt) throws Exception {
  AgronaChannel channel=(AgronaChannel)evt.getChannel();
  ChannelFuture future=evt.getFuture();
  channel.worker.shutdownOutput(channel,future);
}
Program: 24212
Project: 24212
Buggy source:
@Override protected void writeRequested(ChannelPipeline pipeline,MessageEvent evt) throws Exception {
  ChannelBuffer channelBuffer=(ChannelBuffer)evt.getMessage();
  AgronaChannel channel=(AgronaChannel)evt.getChannel();
  ChannelFuture writeFuture=evt.getFuture();
  channel.worker.write(channel,channelBuffer,writeFuture);
}

Fixed version (ground truth):
@Override protected void writeRequested(ChannelPipeline pipeline,MessageEvent evt) throws Exception {
  ChannelBuffer channelBuffer=(ChannelBuffer)evt.getMessage();
  AgronaChannel channel=(AgronaChannel)evt.getChannel();
  ChannelFuture future=evt.getFuture();
  channel.worker.write(channel,channelBuffer,future);
}
Program: 24213
Project: 24213
Buggy source:
@Override protected void flushRequested(ChannelPipeline pipeline,FlushEvent evt) throws Exception {
  AgronaChannel channel=(AgronaChannel)evt.getChannel();
  ChannelFuture flushFuture=evt.getFuture();
  channel.worker.flush(channel,flushFuture);
}

Fixed version (ground truth):
@Override protected void flushRequested(ChannelPipeline pipeline,FlushEvent evt) throws Exception {
  AgronaChannel channel=(AgronaChannel)evt.getChannel();
  ChannelFuture future=evt.getFuture();
  channel.worker.flush(channel,future);
}
Program: 24214
Project: 24214
Buggy source:
@Override protected void closeRequested(ChannelPipeline pipeline,ChannelStateEvent evt) throws Exception {
  AgronaChannel channel=(AgronaChannel)evt.getChannel();
  channel.worker.close(channel);
}

Fixed version (ground truth):
@Override protected void closeRequested(ChannelPipeline pipeline,ChannelStateEvent evt) throws Exception {
  AgronaChannel channel=(AgronaChannel)evt.getChannel();
  ChannelFuture future=evt.getFuture();
  channel.worker.close(channel,future);
}
Program: 24215
Project: 24215
Buggy source:
@Override protected void connectRequested(ChannelPipeline pipeline,ChannelStateEvent evt) throws Exception {
  AgronaClientChannel channel=(AgronaClientChannel)evt.getChannel();
  AgronaChannelAddress remoteAddress=(AgronaChannelAddress)evt.getValue();
  if (!channel.isBound()) {
    ChannelAddress localAddress=remoteAddress;
    channel.setLocalAddress(localAddress);
    channel.setBound();
    fireChannelBound(channel,localAddress);
  }
  ChannelFuture connectFuture=evt.getFuture();
  channel.boss.connect(channel,remoteAddress,connectFuture);
}

Fixed version (ground truth):
@Override protected void connectRequested(ChannelPipeline pipeline,ChannelStateEvent evt) throws Exception {
  AgronaClientChannel channel=(AgronaClientChannel)evt.getChannel();
  AgronaChannelAddress remoteAddress=(AgronaChannelAddress)evt.getValue();
  if (!channel.isBound()) {
    ChannelAddress localAddress=remoteAddress;
    channel.setLocalAddress(localAddress);
    channel.setBound();
    fireChannelBound(channel,localAddress);
  }
  ChannelFuture future=evt.getFuture();
  channel.boss.connect(channel,remoteAddress,future);
}
Program: 24216
Project: 24216
Buggy source:
@Override protected void shutdownOutputRequested(ChannelPipeline pipeline,ShutdownOutputEvent evt) throws Exception {
  AgronaChannel channel=(AgronaChannel)evt.getChannel();
  ChannelFuture shutdownOutputFuture=evt.getFuture();
  channel.worker.shutdownOutput(channel,shutdownOutputFuture);
}

Fixed version (ground truth):
@Override protected void shutdownOutputRequested(ChannelPipeline pipeline,ShutdownOutputEvent evt) throws Exception {
  AgronaChannel channel=(AgronaChannel)evt.getChannel();
  ChannelFuture future=evt.getFuture();
  channel.worker.shutdownOutput(channel,future);
}
Program: 24217
Project: 24217
Buggy source:
@Override protected void writeRequested(ChannelPipeline pipeline,MessageEvent evt) throws Exception {
  ChannelBuffer channelBuffer=(ChannelBuffer)evt.getMessage();
  AgronaChannel channel=(AgronaChannel)evt.getChannel();
  ChannelFuture writeFuture=evt.getFuture();
  channel.worker.write(channel,channelBuffer,writeFuture);
}

Fixed version (ground truth):
@Override protected void writeRequested(ChannelPipeline pipeline,MessageEvent evt) throws Exception {
  ChannelBuffer channelBuffer=(ChannelBuffer)evt.getMessage();
  AgronaChannel channel=(AgronaChannel)evt.getChannel();
  ChannelFuture future=evt.getFuture();
  channel.worker.write(channel,channelBuffer,future);
}
Program: 24218
Project: 24218
Buggy source:
@Override protected void flushRequested(ChannelPipeline pipeline,FlushEvent evt) throws Exception {
  AgronaChannel channel=(AgronaChannel)evt.getChannel();
  ChannelFuture flushFuture=evt.getFuture();
  channel.worker.flush(channel,flushFuture);
}

Fixed version (ground truth):
@Override protected void flushRequested(ChannelPipeline pipeline,FlushEvent evt) throws Exception {
  AgronaChannel channel=(AgronaChannel)evt.getChannel();
  ChannelFuture future=evt.getFuture();
  channel.worker.flush(channel,future);
}
Program: 24219
Project: 24219
Buggy source:
@Override public void run(){
  flushWriteBufferIfNecessary(channel);
  if (channel.setClosed()) {
    fireChannelDisconnected(channel);
    fireChannelUnbound(channel);
    fireChannelClosed(channel);
  }
}

Fixed version (ground truth):
@Override public void run(){
  flushWriteBufferIfNecessary(channel);
  future.setSuccess();
  if (channel.setClosed()) {
    fireChannelDisconnected(channel);
    fireChannelUnbound(channel);
    fireChannelClosed(channel);
  }
}
Program: 24220
Project: 24220
Buggy source:
public void shutdownOutput(AgronaChannel channel,ChannelFuture shutdownOutputFuture){
  registerTask(new ShutdownOutputTask(channel,shutdownOutputFuture));
}

Fixed version (ground truth):
public void shutdownOutput(AgronaChannel channel,ChannelFuture future){
  registerTask(new ShutdownOutputTask(channel,future));
}
Program: 24221
Project: 24221
Buggy source:
public CloseTask(AgronaChannel channel){
  this.channel=channel;
}

Fixed version (ground truth):
public CloseTask(AgronaChannel channel,ChannelFuture future){
  this.channel=channel;
  this.future=future;
}
Program: 24222
Project: 24222
Buggy source:
public void flush(AgronaChannel channel,ChannelFuture flushFuture){
  registerTask(new FlushTask(channel,flushFuture));
}

Fixed version (ground truth):
public void flush(AgronaChannel channel,ChannelFuture future){
  registerTask(new FlushTask(channel,future));
}
Program: 24223
Project: 24223
Buggy source:
public void write(AgronaChannel channel,ChannelBuffer channelBuffer,ChannelFuture writeFuture){
  registerTask(new WriteTask(channel,channelBuffer,writeFuture));
}

Fixed version (ground truth):
public void write(AgronaChannel channel,ChannelBuffer channelBuffer,ChannelFuture future){
  registerTask(new WriteTask(channel,channelBuffer,future));
}
Program: 24224
Project: 24224
Buggy source:
public void close(AgronaChannel channel){
  readableChannels.remove(channel);
  registerTask(new CloseTask(channel));
}

Fixed version (ground truth):
public void close(AgronaChannel channel,ChannelFuture future){
  readableChannels.remove(channel);
  registerTask(new CloseTask(channel,future));
}
Program: 24225
Project: 24225
Buggy source:
public boolean destroy(){
  if (destroyed) {
    return true;
  }
  abort();
  if (createdBootstrapFactory) {
    try {
      bootstrapFactory.shutdown();
      bootstrapFactory.releaseExternalResources();
    }
 catch (    Exception e) {
      if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("String_Node_Str",e);
      }
      return false;
    }
  }
  if (this.configuration != null) {
    for (    ServerBootstrap serverBootstrap : this.configuration.getServerBootstraps()) {
      serverBootstrap.shutdown();
      serverBootstrap.releaseExternalResources();
    }
  }
  return destroyed=true;
}

Fixed version (ground truth):
public boolean destroy(){
  if (destroyed) {
    return true;
  }
  abort();
  if (createdBootstrapFactory) {
    try {
      bootstrapFactory.shutdown();
      bootstrapFactory.releaseExternalResources();
    }
 catch (    Exception e) {
      if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("String_Node_Str",e);
      }
      return false;
    }
  }
  if (this.configuration != null && !this.preparedFuture.isDone()) {
    for (    ServerBootstrap serverBootstrap : this.configuration.getServerBootstraps()) {
      this.configuration.getServerBootstraps();
      serverBootstrap.shutdown();
      serverBootstrap.releaseExternalResources();
    }
  }
  return destroyed=true;
}
Program: 24226
Project: 24226
Buggy source:
@Override public void evaluate() throws Throwable {
  ScriptRunner scriptRunner=new ScriptRunner(controlURL,scriptNames,latch);
  FutureTask<ScriptPair> scriptFuture=new FutureTask<ScriptPair>(scriptRunner);
  try {
    new Thread(scriptFuture).start();
    latch.awaitPrepared();
    try {
      statement.evaluate();
    }
 catch (    AssumptionViolatedException e) {
      if (!latch.isFinished()) {
        scriptRunner.abort();
      }
      throw e;
    }
catch (    Throwable cause) {
      if (latch.hasException()) {
        throw cause;
      }
 else {
        if (!latch.isFinished()) {
          scriptRunner.abort();
        }
        try {
          ScriptPair scripts=scriptFuture.get(5,SECONDS);
          try {
            assertEquals("String_Node_Str",scripts.getExpectedScript(),scripts.getObservedScript());
            throw cause;
          }
 catch (          ComparisonFailure f) {
            f.initCause(cause);
            throw f;
          }
        }
 catch (        ExecutionException ee) {
          throw ee.getCause().initCause(cause);
        }
catch (        Exception e) {
          throw cause;
        }
      }
    }
    assertTrue(format("String_Node_Str",K3poRule.class.getSimpleName()),latch.isStartable());
    ScriptPair scripts=scriptFuture.get();
    assertEquals("String_Node_Str",scripts.getExpectedScript(),scripts.getObservedScript());
  }
  finally {
    scriptFuture.cancel(true);
  }
}

Fixed version (ground truth):
@Override public void evaluate() throws Throwable {
  ScriptRunner scriptRunner=new ScriptRunner(controlURL,scriptNames,latch);
  FutureTask<ScriptPair> scriptFuture=new FutureTask<ScriptPair>(scriptRunner);
  try {
    new Thread(scriptFuture).start();
    latch.awaitPrepared();
    try {
      statement.evaluate();
    }
 catch (    AssumptionViolatedException e) {
      if (!latch.isFinished()) {
        scriptRunner.abort();
      }
      throw e;
    }
catch (    Throwable cause) {
      if (latch.hasException()) {
        throw cause;
      }
 else {
        if (!latch.isFinished()) {
          scriptRunner.abort();
        }
        try {
          ScriptPair scripts=scriptFuture.get(5,SECONDS);
          try {
            assertEquals("String_Node_Str",scripts.getExpectedScript(),scripts.getObservedScript());
            throw cause;
          }
 catch (          ComparisonFailure f) {
            f.initCause(cause);
            throw f;
          }
        }
 catch (        ExecutionException ee) {
          throw ee.getCause().initCause(cause);
        }
catch (        Exception e) {
          throw cause;
        }
      }
    }
    String k3poSimpleName=K3poRule.class.getSimpleName();
    assertTrue(format("String_Node_Str",k3poSimpleName,k3poSimpleName),latch.isStartable());
    ScriptPair scripts=scriptFuture.get();
    assertEquals("String_Node_Str",scripts.getExpectedScript(),scripts.getObservedScript());
  }
  finally {
    scriptFuture.cancel(true);
  }
}
Program: 24227
Project: 24227
Buggy source:
private boolean equals(LocationInfo that){
  return this.line == that.line && this.column == that.column;
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  return (this == obj) || ((obj instanceof LocationInfo) && equalTo((LocationInfo)obj));
}
Program: 24228
Project: 24228
Buggy source:
@Override public String toString(){
  return String.format("String_Node_Str",line,column);
}

Fixed version (ground truth):
@Override public String toString(){
  return format("String_Node_Str",line,column);
}
Program: 24229
Project: 24229
Buggy source:
@Override public CommandEvent readEvent(int timeout,TimeUnit unit) throws Exception {
  checkConnected();
  connection.setReadTimeout((int)unit.toMillis(timeout));
  InputStream bytesIn=connection.getInputStream();
  CharsetDecoder decoder=UTF_8.newDecoder();
  BufferedReader textIn=new BufferedReader(new InputStreamReader(bytesIn,decoder));
  String eventType=textIn.readLine();
switch (eventType.charAt(0)) {
case 'P':
    if ("String_Node_Str".equals(eventType)) {
      return readPreparedEvent(textIn);
    }
  break;
case 'S':
if ("String_Node_Str".equals(eventType)) {
  return readStartedEvent(textIn);
}
break;
case 'E':
if ("String_Node_Str".equals(eventType)) {
return readErrorEvent(textIn);
}
break;
case 'F':
if ("String_Node_Str".equals(eventType)) {
return readFinishedEvent(textIn);
}
break;
}
throw new IllegalStateException("String_Node_Str" + eventType);
}

Fixed version (ground truth):
@Override public CommandEvent readEvent(int timeout,TimeUnit unit) throws Exception {
  checkConnected();
  connection.setReadTimeout((int)unit.toMillis(timeout));
  String eventType=textIn.readLine();
switch (eventType.charAt(0)) {
case 'P':
    if ("String_Node_Str".equals(eventType)) {
      return readPreparedEvent();
    }
  break;
case 'S':
if ("String_Node_Str".equals(eventType)) {
  return readStartedEvent();
}
break;
case 'E':
if ("String_Node_Str".equals(eventType)) {
return readErrorEvent();
}
break;
case 'F':
if ("String_Node_Str".equals(eventType)) {
return readFinishedEvent();
}
break;
}
throw new IllegalStateException("String_Node_Str" + eventType);
}
Program: 24230
Project: 24230
Buggy source:
private FinishedEvent readFinishedEvent(BufferedReader textIn) throws IOException {
  FinishedEvent finished=new FinishedEvent();
  String line;
  int length=-1;
  do {
    line=textIn.readLine();
    Matcher matcher=HEADER_PATTERN.matcher(line);
    if (matcher.matches()) {
      String headerName=matcher.group(1);
      String headerValue=matcher.group(2);
switch (headerName.charAt(0)) {
case 'c':
        if ("String_Node_Str".equals(headerName)) {
          length=parseInt(headerValue);
        }
      break;
case 'n':
    if ("String_Node_Str".equals(headerName)) {
      finished.setName(headerValue);
    }
  break;
default :
throw new IllegalStateException("String_Node_Str" + headerName);
}
}
}
 while (!line.isEmpty());
if (length >= 0) {
finished.setExpectedScript(readContent(textIn,length));
}
do {
line=textIn.readLine();
Matcher matcher=HEADER_PATTERN.matcher(line);
if (matcher.matches()) {
String headerName=matcher.group(1);
String headerValue=matcher.group(2);
switch (headerName.charAt(0)) {
case 'c':
if ("String_Node_Str".equals(headerName)) {
length=parseInt(headerValue);
}
break;
default :
throw new IllegalStateException("String_Node_Str" + headerName);
}
}
}
 while (!line.isEmpty());
if (length >= 0) {
finished.setObservedScript(readContent(textIn,length));
}
return finished;
}

Fixed version (ground truth):
private FinishedEvent readFinishedEvent() throws IOException {
  FinishedEvent finished=new FinishedEvent();
  String line;
  int length=-1;
  do {
    line=textIn.readLine();
    Matcher matcher=HEADER_PATTERN.matcher(line);
    if (matcher.matches()) {
      String headerName=matcher.group(1);
      String headerValue=matcher.group(2);
switch (headerName.charAt(0)) {
case 'c':
        if ("String_Node_Str".equals(headerName)) {
          length=parseInt(headerValue);
        }
      break;
case 'n':
    if ("String_Node_Str".equals(headerName)) {
      finished.setName(headerValue);
    }
  break;
default :
throw new IllegalStateException("String_Node_Str" + headerName);
}
}
}
 while (!line.isEmpty());
if (length >= 0) {
finished.setExpectedScript(readContent(length));
}
do {
line=textIn.readLine();
Matcher matcher=HEADER_PATTERN.matcher(line);
if (matcher.matches()) {
String headerName=matcher.group(1);
String headerValue=matcher.group(2);
switch (headerName.charAt(0)) {
case 'c':
if ("String_Node_Str".equals(headerName)) {
length=parseInt(headerValue);
}
break;
default :
throw new IllegalStateException("String_Node_Str" + headerName);
}
}
}
 while (!line.isEmpty());
if (length >= 0) {
finished.setObservedScript(readContent(length));
}
return finished;
}
Program: 24231
Project: 24231
Buggy source:
private PreparedEvent readPreparedEvent(BufferedReader textIn) throws IOException {
  PreparedEvent prepared=new PreparedEvent();
  String line;
  do {
    line=textIn.readLine();
    Matcher matcher=HEADER_PATTERN.matcher(line);
    if (matcher.matches()) {
      String headerName=matcher.group(1);
      String headerValue=matcher.group(2);
switch (headerName.charAt(0)) {
case 'n':
        if ("String_Node_Str".equals(headerName)) {
          prepared.setName(headerValue);
        }
      break;
default :
    throw new IllegalStateException("String_Node_Str" + headerName);
}
}
}
 while (!line.isEmpty());
return prepared;
}

Fixed version (ground truth):
private PreparedEvent readPreparedEvent() throws IOException {
  PreparedEvent prepared=new PreparedEvent();
  String line;
  do {
    line=textIn.readLine();
    Matcher matcher=HEADER_PATTERN.matcher(line);
    if (matcher.matches()) {
      String headerName=matcher.group(1);
      String headerValue=matcher.group(2);
switch (headerName.charAt(0)) {
case 'n':
        if ("String_Node_Str".equals(headerName)) {
          prepared.setName(headerValue);
        }
      break;
default :
    throw new IllegalStateException("String_Node_Str" + headerName);
}
}
}
 while (!line.isEmpty());
return prepared;
}
Program: 24232
Project: 24232
Buggy source:
private StartedEvent readStartedEvent(BufferedReader textIn) throws IOException {
  StartedEvent started=new StartedEvent();
  String line;
  do {
    line=textIn.readLine();
    Matcher matcher=HEADER_PATTERN.matcher(line);
    if (matcher.matches()) {
      String headerName=matcher.group(1);
      String headerValue=matcher.group(2);
switch (headerName.charAt(0)) {
case 'n':
        if ("String_Node_Str".equals(headerName)) {
          started.setName(headerValue);
        }
      break;
default :
    throw new IllegalStateException("String_Node_Str" + headerName);
}
}
}
 while (!line.isEmpty());
return started;
}

Fixed version (ground truth):
private StartedEvent readStartedEvent() throws IOException {
  StartedEvent started=new StartedEvent();
  String line;
  do {
    line=textIn.readLine();
    Matcher matcher=HEADER_PATTERN.matcher(line);
    if (matcher.matches()) {
      String headerName=matcher.group(1);
      String headerValue=matcher.group(2);
switch (headerName.charAt(0)) {
case 'n':
        if ("String_Node_Str".equals(headerName)) {
          started.setName(headerValue);
        }
      break;
default :
    throw new IllegalStateException("String_Node_Str" + headerName);
}
}
}
 while (!line.isEmpty());
return started;
}
Program: 24233
Project: 24233
Buggy source:
private String readContent(final BufferedReader textIn,final int length) throws IOException {
  final char[] content=new char[length];
  int bytesRead=0;
  do {
    int result=textIn.read(content,bytesRead,length - bytesRead);
    if (result == -1) {
      throw new EOFException("String_Node_Str");
    }
    bytesRead+=result;
  }
 while (bytesRead != length);
  return new String(content);
}

Fixed version (ground truth):
private String readContent(final int length) throws IOException {
  final char[] content=new char[length];
  int bytesRead=0;
  do {
    int result=textIn.read(content,bytesRead,length - bytesRead);
    if (result == -1) {
      throw new EOFException("String_Node_Str");
    }
    bytesRead+=result;
  }
 while (bytesRead != length);
  return new String(content);
}
Program: 24234
Project: 24234
Buggy source:
public TcpRobotControl(URL location){
  this.location=location;
}

Fixed version (ground truth):
public TcpRobotControl(URL location) throws Exception {
  this.location=location;
}
Program: 24235
Project: 24235
Buggy source:
private ErrorEvent readErrorEvent(BufferedReader textIn) throws IOException {
  ErrorEvent error=new ErrorEvent();
  String line;
  int length=0;
  do {
    line=textIn.readLine();
    Matcher matcher=HEADER_PATTERN.matcher(line);
    if (matcher.matches()) {
      String headerName=matcher.group(1);
      String headerValue=matcher.group(2);
switch (headerName.charAt(0)) {
case 'c':
        if ("String_Node_Str".equals(headerName)) {
          length=parseInt(headerValue);
        }
      break;
case 'n':
    if ("String_Node_Str".equals(headerName)) {
      error.setName(headerValue);
    }
  break;
case 's':
if ("String_Node_Str".equals(headerName)) {
  error.setSummary(headerValue);
}
break;
default :
throw new IllegalStateException("String_Node_Str" + headerName);
}
}
}
 while (!line.isEmpty());
if (length > 0) {
error.setDescription(readContent(textIn,length));
}
return error;
}

Fixed version (ground truth):
private ErrorEvent readErrorEvent() throws IOException {
  ErrorEvent error=new ErrorEvent();
  String line;
  int length=0;
  do {
    line=textIn.readLine();
    Matcher matcher=HEADER_PATTERN.matcher(line);
    if (matcher.matches()) {
      String headerName=matcher.group(1);
      String headerValue=matcher.group(2);
switch (headerName.charAt(0)) {
case 'c':
        if ("String_Node_Str".equals(headerName)) {
          length=parseInt(headerValue);
        }
      break;
case 'n':
    if ("String_Node_Str".equals(headerName)) {
      error.setName(headerValue);
    }
  break;
case 's':
if ("String_Node_Str".equals(headerName)) {
  error.setSummary(headerValue);
}
break;
default :
throw new IllegalStateException("String_Node_Str" + headerName);
}
}
}
 while (!line.isEmpty());
if (length > 0) {
error.setDescription(readContent(length));
}
return error;
}
Program: 24236
Project: 24236
Buggy source:
@Override public void connect() throws Exception {
  connection=location.openConnection();
  connection.connect();
}

Fixed version (ground truth):
@Override public void connect() throws Exception {
  connection=location.openConnection();
  connection.connect();
  InputStream bytesIn=connection.getInputStream();
  CharsetDecoder decoder=UTF_8.newDecoder();
  textIn=new BufferedReader(new InputStreamReader(bytesIn,decoder));
}
Program: 24241
Project: 24241
Buggy source:
@Test public void testInvalidScriptLocation() throws Exception {
  String script=loadScript("String_Node_Str");
  robot.prepareAndStart(script).await();
  RobotCompletionFuture doneFuture=robot.getScriptCompleteFuture();
  doneFuture.await();
}

Fixed version (ground truth):
@Test(timeout=TEST_TIMEOUT) public void testInvalidScriptLocation() throws Exception {
  String script=loadScript("String_Node_Str");
  robot.prepareAndStart(script).await();
  RobotCompletionFuture doneFuture=robot.getScriptCompleteFuture();
  doneFuture.await();
}
Program: 24243
Project: 24243
Buggy source:
@Test public void testAbortBeforePrepare() throws Exception {
  String path=Paths.get(String.format("String_Node_Str",Paths.get("String_Node_Str").toAbsolutePath().toString(),SCRIPT_PATH,"String_Node_Str")).toString();
  Socket client=new Socket();
  client.connect(new InetSocketAddress("String_Node_Str",61234));
  OutputStream outputStream=client.getOutputStream();
  InputStream inputStream=client.getInputStream();
  byte[] abort=("String_Node_Str" + "String_Node_Str" + ("String_Node_Str".length() + path.length() + "String_Node_Str".length()) + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ path+ "String_Node_Str").getBytes("String_Node_Str");
  outputStream.write(abort);
  outputStream.flush();
  String badRequestContent="String_Node_Str" + "String_Node_Str" + "String_Node_Str" + path + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  ByteBuffer badRequestExpected=ByteBuffer.wrap(("String_Node_Str" + "String_Node_Str" + "String_Node_Str" + badRequestContent.length() + "String_Node_Str"+ "String_Node_Str"+ badRequestContent).getBytes("String_Node_Str"));
  ByteBuffer badRequest=ByteBuffer.allocate(badRequestExpected.capacity());
  while (badRequest.hasRemaining()) {
    badRequest.put((byte)inputStream.read());
  }
  badRequest.flip();
  client.close();
  assertEquals(badRequestExpected,badRequest);
}

Fixed version (ground truth):
@Test(timeout=TEST_TIMEOUT) public void testAbortBeforePrepare() throws Exception {
  String path=Paths.get(String.format("String_Node_Str",Paths.get("String_Node_Str").toAbsolutePath().toString(),SCRIPT_PATH,"String_Node_Str")).toString();
  Socket client=new Socket();
  client.connect(new InetSocketAddress("String_Node_Str",61234));
  OutputStream outputStream=client.getOutputStream();
  InputStream inputStream=client.getInputStream();
  byte[] abort=("String_Node_Str" + "String_Node_Str" + ("String_Node_Str".length() + path.length()) + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ path+ "String_Node_Str").getBytes("String_Node_Str");
  outputStream.write(abort);
  outputStream.flush();
  String badRequestContent="String_Node_Str" + "String_Node_Str" + "String_Node_Str" + path + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  ByteBuffer badRequestExpected=ByteBuffer.wrap(("String_Node_Str" + "String_Node_Str" + "String_Node_Str" + badRequestContent.length() + "String_Node_Str"+ "String_Node_Str"+ badRequestContent).getBytes("String_Node_Str"));
  ByteBuffer badRequest=ByteBuffer.allocate(badRequestExpected.capacity());
  while (badRequest.hasRemaining()) {
    badRequest.put((byte)inputStream.read());
  }
  badRequest.flip();
  client.close();
  assertEquals(badRequestExpected,badRequest);
}
Program: 24246
Project: 24246
Buggy source:
@Override public void startReceived(final ChannelHandlerContext ctx,MessageEvent evt) throws Exception {
  final boolean infoDebugEnabled=logger.isDebugEnabled();
  final StartMessage start=(StartMessage)evt.getMessage();
  final String name=start.getName();
  if (infoDebugEnabled) {
    logger.debug("String_Node_Str" + name);
  }
  try {
    ChannelFuture startFuture=robot.start();
    startFuture.addListener(new ChannelFutureListener(){
      @Override public void operationComplete(      final ChannelFuture f){
        final StartedMessage started=new StartedMessage();
        started.setName(name);
        Channels.write(ctx,Channels.future(null),started);
      }
    }
);
  }
 catch (  Exception e) {
    sendErrorMessage(ctx,e,name);
    return;
  }
  scriptDoneFuture=robot.getScriptCompleteFuture();
  scriptDoneFuture.addListener(new ChannelFutureListener(){
    @Override public void operationComplete(    final ChannelFuture f){
      String expectedScript=scriptDoneFuture.getExpectedScript();
      String observedScript=scriptDoneFuture.getObservedScript();
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + name + "String_Node_Str");
      }
      FinishedMessage finished=new FinishedMessage();
      finished.setName(name);
      finished.setExpectedScript(expectedScript);
      finished.setObservedScript(observedScript);
      Channels.write(ctx,Channels.future(null),finished);
    }
  }
);
}

Fixed version (ground truth):
@Override public void startReceived(final ChannelHandlerContext ctx,MessageEvent evt) throws Exception {
  final boolean infoDebugEnabled=logger.isDebugEnabled();
  final StartMessage start=(StartMessage)evt.getMessage();
  final String name=start.getName();
  if (infoDebugEnabled) {
    logger.debug("String_Node_Str" + name);
  }
  try {
    ChannelFuture startFuture=robot.start();
    startFuture.addListener(new ChannelFutureListener(){
      @Override public void operationComplete(      final ChannelFuture f){
        final StartedMessage started=new StartedMessage();
        started.setName(name);
        Channels.write(ctx,Channels.future(null),started);
      }
    }
);
  }
 catch (  Exception e) {
    sendErrorMessage(ctx,e,name);
    return;
  }
  scriptDoneFuture=robot.getScriptCompleteFuture();
  scriptDoneFuture.addListener(new ChannelFutureListener(){
    @Override public void operationComplete(    final ChannelFuture f){
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + name + "String_Node_Str");
      }
      sendFinishedMessage(ctx,name,scriptDoneFuture);
    }
  }
);
}
Program: 24247
Project: 24247
Buggy source:
@Override public void abortReceived(ChannelHandlerContext ctx,MessageEvent evt) throws Exception {
  AbortMessage abort=(AbortMessage)evt.getMessage();
  if (logger.isInfoEnabled()) {
    logger.debug("String_Node_Str" + abort.getName());
  }
  robot.abort();
  if (robot != null && robot.getScriptCompleteFuture().isDone()) {
    FinishedMessage finished=new FinishedMessage();
    finished.setName(abort.getName());
    finished.setExpectedScript(robot.getScriptCompleteFuture().getExpectedScript());
    finished.setObservedScript(robot.getScriptCompleteFuture().getObservedScript());
    Channels.write(ctx,Channels.future(null),finished);
  }
}

Fixed version (ground truth):
@Override public void abortReceived(ChannelHandlerContext ctx,MessageEvent evt) throws Exception {
  AbortMessage abort=(AbortMessage)evt.getMessage();
  if (logger.isInfoEnabled()) {
    logger.debug("String_Node_Str" + abort.getName());
  }
  robot.abort();
  if (ctx.getPipeline().get("String_Node_Str") != null && robot != null && robot.getScriptCompleteFuture().isDone()) {
    sendFinishedMessage(ctx,abort.getName(),robot.getScriptCompleteFuture());
  }
 else   if (robot != null && !robot.getStartedFuture().isDone()) {
    sendFinishedMessage(ctx,abort.getName(),robot.getScriptCompleteFuture());
  }
}
Program: 24248
Project: 24248
Buggy source:
@Override public void operationComplete(final ChannelFuture f){
  String expectedScript=scriptDoneFuture.getExpectedScript();
  String observedScript=scriptDoneFuture.getObservedScript();
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + name + "String_Node_Str");
  }
  FinishedMessage finished=new FinishedMessage();
  finished.setName(name);
  finished.setExpectedScript(expectedScript);
  finished.setObservedScript(observedScript);
  Channels.write(ctx,Channels.future(null),finished);
}

Fixed version (ground truth):
@Override public void operationComplete(final ChannelFuture f){
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + name + "String_Node_Str");
  }
  sendFinishedMessage(ctx,name,scriptDoneFuture);
}
Program: 24250
Project: 24250
Buggy source:
@Test(timeout=TEST_TIMEOUT) public void shouldRecieveGetRequestAndProvideResponse() throws Exception {
  String script=combineScripts("String_Node_Str","String_Node_Str");
  String expected=script;
  robot.prepareAndStart(script).await();
  RobotCompletionFuture doneFuture=robot.getScriptCompleteFuture();
  doneFuture.await();
  assertEquals(expected,doneFuture.getObservedScript());
}

Fixed version (ground truth):
@Test(timeout=TEST_TIMEOUT) public void shouldRecieveGetRequestAndProvideResponse() throws Exception {
  String script=combineScripts("String_Node_Str","String_Node_Str");
  String expected=script;
  System.out.println(expected);
  robot.prepareAndStart(script).await();
  RobotCompletionFuture doneFuture=robot.getScriptCompleteFuture();
  doneFuture.await();
  assertEquals(expected,doneFuture.getObservedScript());
}
Program: 24251
Project: 24251
Buggy source:
@Override public int hashCode(){
  int hashCode=super.hashTo();
  hashCode<<=4;
  hashCode^=(expectedScript != null) ? expectedScript.hashCode() : 0;
  hashCode<<=4;
  hashCode+=(scriptFormatOverride != null) ? scriptFormatOverride.hashCode() : 0;
  return hashCode;
}

Fixed version (ground truth):
@Override public int hashCode(){
  int hashCode=super.hashTo();
  hashCode<<=4;
  hashCode^=(expectedScriptPath != null) ? expectedScriptPath.hashCode() : 0;
  hashCode<<=4;
  hashCode+=(scriptFormatOverride != null) ? scriptFormatOverride.hashCode() : 0;
  return hashCode;
}
Program: 24252
Project: 24252
Buggy source:
protected final boolean equals(PrepareMessage that){
  return super.equalTo(that) && (this.compatibilityKind == that.compatibilityKind) && (this.expectedScriptPath == that.expectedScriptPath || (this.expectedScriptPath != null && this.expectedScriptPath.equals(that.expectedScriptPath)))&& (this.expectedScript == that.expectedScript || (this.expectedScript != null && this.expectedScript.equals(that.expectedScript)) && (this.scriptFormatOverride == that.scriptFormatOverride));
}

Fixed version (ground truth):
protected final boolean equals(PrepareMessage that){
  return super.equalTo(that) && (this.compatibilityKind == that.compatibilityKind) && (this.expectedScriptPath == that.expectedScriptPath || (this.expectedScriptPath != null && this.expectedScriptPath.equals(that.expectedScriptPath)))&& (this.scriptFormatOverride == that.scriptFormatOverride);
}
Program: 24253
Project: 24253
Buggy source:
@Override public void prepareReceived(final ChannelHandlerContext ctx,MessageEvent evt) throws Exception {
  final PrepareMessage prepare=(PrepareMessage)evt.getMessage();
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + prepare.getScriptName());
  }
  robot=new Robot();
  ChannelFuture prepareFuture;
  try {
    prepareFuture=robot.prepare(prepare.getExpectedScript());
  }
 catch (  Exception e) {
    sendErrorMessage(ctx,e,prepare.getScriptName());
    return;
  }
  prepareFuture.addListener(new ChannelFutureListener(){
    @Override public void operationComplete(    final ChannelFuture f){
      PreparedMessage prepared=new PreparedMessage();
      prepared.setCompatibilityKind(prepare.getCompatibilityKind());
      prepared.setScriptName(prepare.getScriptName());
      Channels.write(ctx,Channels.future(null),prepared);
    }
  }
);
}

Fixed version (ground truth):
@Override public void prepareReceived(final ChannelHandlerContext ctx,MessageEvent evt) throws Exception {
  final PrepareMessage prepare=(PrepareMessage)evt.getMessage();
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + prepare.getScriptName());
  }
  robot=new Robot();
  ChannelFuture prepareFuture;
  try {
    byte[] encoded=Files.readAllBytes(Paths.get(prepare.getExpectedScriptPath()));
    new String(encoded,UTF_8);
    prepareFuture=robot.prepare(new String(encoded,UTF_8));
  }
 catch (  Exception e) {
    sendErrorMessage(ctx,e,prepare.getScriptName());
    return;
  }
  prepareFuture.addListener(new ChannelFutureListener(){
    @Override public void operationComplete(    final ChannelFuture f){
      PreparedMessage prepared=new PreparedMessage();
      prepared.setCompatibilityKind(prepare.getCompatibilityKind());
      prepared.setScriptName(prepare.getScriptName());
      Channels.write(ctx,Channels.future(null),prepared);
    }
  }
);
}
Program: 24255
Project: 24255
Buggy source:
private void sendErrorMessage(ChannelHandlerContext ctx,Exception exception,String scriptName){
  ErrorMessage error=new ErrorMessage();
  error.setDescription(exception.getMessage());
  error.setScriptName(scriptName);
  if (exception instanceof ScriptParseException) {
    if (logger.isDebugEnabled()) {
      logger.error("String_Node_Str",exception);
    }
 else {
      logger.error("String_Node_Str" + exception);
    }
    error.setSummary("String_Node_Str");
    Channels.write(ctx,Channels.future(null),error);
  }
 else {
    logger.error("String_Node_Str",exception);
    error.setSummary("String_Node_Str");
  }
  Channels.write(ctx,Channels.future(null),error);
}

Fixed version (ground truth):
private void sendErrorMessage(ChannelHandlerContext ctx,Exception exception,String scriptName){
  ErrorMessage error=new ErrorMessage();
  error.setDescription(exception.getMessage());
  error.setScriptName(scriptName);
  if (exception instanceof ScriptParseException) {
    if (logger.isDebugEnabled()) {
      logger.error("String_Node_Str",exception);
    }
 else {
      logger.error("String_Node_Str" + exception);
    }
    error.setSummary("String_Node_Str");
    Channels.write(ctx,Channels.future(null),error);
  }
 else {
    logger.error("String_Node_Str",exception);
    error.setSummary("String_Node_Str");
    Channels.write(ctx,Channels.future(null),error);
  }
}
Program: 24256
Project: 24256
Buggy source:
private void sendErrorMessage(ChannelHandlerContext ctx,Exception exception,String scriptName){
  ErrorMessage error=new ErrorMessage();
  error.setDescription(exception.getMessage());
  error.setScriptName(scriptName);
  if (exception instanceof ScriptParseException) {
    if (logger.isDebugEnabled()) {
      logger.error("String_Node_Str",exception);
    }
 else {
      logger.error("String_Node_Str" + exception);
    }
    error.setSummary("String_Node_Str");
    Channels.write(ctx,Channels.future(null),error);
  }
 else {
    logger.error("String_Node_Str",exception);
    error.setSummary("String_Node_Str");
  }
  Channels.write(ctx,Channels.future(null),error);
}

Fixed version (ground truth):
private void sendErrorMessage(ChannelHandlerContext ctx,Exception exception,String scriptName){
  ErrorMessage error=new ErrorMessage();
  error.setDescription(exception.getMessage());
  error.setScriptName(scriptName);
  if (exception instanceof ScriptParseException) {
    if (logger.isDebugEnabled()) {
      logger.error("String_Node_Str",exception);
    }
 else {
      logger.error("String_Node_Str" + exception);
    }
    error.setSummary("String_Node_Str");
    Channels.write(ctx,Channels.future(null),error);
  }
 else {
    logger.error("String_Node_Str",exception);
    error.setSummary("String_Node_Str");
    Channels.write(ctx,Channels.future(null),error);
  }
}
Program: 24257
Project: 24257
Buggy source:
@Override public void deliverResult(final QueryResult result){
  mTracker.registerObserver(result,mObserver);
  if (isReset()) {
    mTracker.reset();
  }
 else {
    if (isStarted() && result.isValid()) {
      super.deliverResult(result);
    }
    if (result.isValid() && !result.hasError()) {
      mTracker.trackValidResult(result);
    }
 else {
      mTracker.trackInvalidResult(result,mObserver);
    }
  }
}

Fixed version (ground truth):
@Override public void deliverResult(final QueryResult result){
  mTracker.registerObserver(result,mObserver);
  if (isReset()) {
    mTracker.reset();
  }
 else {
    if (isStarted() && result.isValid()) {
      super.deliverResult(result);
    }
    if (!result.hasError()) {
      trackResult(result);
    }
  }
}