nus-yam/ex-repair huggingface dataset:
Program: 87323
Project: 87323
Buggy source:
@Test public void testTemplateModes() throws Throwable {
  try {
    conn.execute(SchemaTest.buildAlterTemplateModeStmt(TemplateMode.OPTIONAL));
    conn.execute(SchemaTest.buildAlterTemplateModeStmt(TemplateMode.REQUIRED));
    conn.execute(SchemaTest.buildAlterTemplateModeStmt(TemplateMode.STRICT));
    new ExpectedExceptionTester(){
      @Override public void test() throws Throwable {
        conn.execute("String_Node_Str" + VariableConstants.TEMPLATE_MODE_NAME + "String_Node_Str");
      }
    }
.assertException(PEException.class,"String_Node_Str");
  }
  finally {
    conn.execute(SchemaTest.buildAlterTemplateModeStmt(TemplateMode.REQUIRED));
  }
}

Fixed version (ground truth):
@Test public void testTemplateModes() throws Throwable {
  try {
    conn.execute(SchemaTest.buildAlterTemplateModeStmt(TemplateMode.OPTIONAL));
    conn.execute(SchemaTest.buildAlterTemplateModeStmt(TemplateMode.REQUIRED));
    conn.execute(SchemaTest.buildAlterTemplateModeStmt(TemplateMode.STRICT));
    new ExpectedSqlErrorTester(){
      @Override public void test() throws Throwable {
        conn.execute("String_Node_Str" + VariableConstants.TEMPLATE_MODE_NAME + "String_Node_Str");
      }
    }
.assertError(SchemaException.class,MySQLErrors.wrongValueForVariable,VariableConstants.TEMPLATE_MODE_NAME,"String_Node_Str");
  }
  finally {
    conn.execute(SchemaTest.buildAlterTemplateModeStmt(TemplateMode.REQUIRED));
  }
}
Program: 87324
Project: 87324
Buggy source:
@Test public void testPE1603() throws Throwable {
  assertTimestampValue(2,null);
  conn.execute("String_Node_Str");
  assertTimestampValue(2,10l);
  conn.execute("String_Node_Str");
  assertTimestampValue(2,null);
  conn.execute("String_Node_Str");
  assertTimestampValue(2,300000000l);
  conn.execute("String_Node_Str");
  assertTimestampValue(2,null);
  new ExpectedExceptionTester(){
    @Override public void test() throws Throwable {
      conn.execute("String_Node_Str");
    }
  }
.assertException(PESQLStateException.class,"String_Node_Str");
  new ExpectedExceptionTester(){
    @Override public void test() throws Throwable {
      conn.execute("String_Node_Str");
    }
  }
.assertException(PESQLStateException.class,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testPE1603() throws Throwable {
  assertTimestampValue(2,null);
  conn.execute("String_Node_Str");
  assertTimestampValue(2,10l);
  conn.execute("String_Node_Str");
  assertTimestampValue(2,null);
  conn.execute("String_Node_Str");
  assertTimestampValue(2,300000000l);
  conn.execute("String_Node_Str");
  assertTimestampValue(2,null);
  new ExpectedSqlErrorTester(){
    @Override public void test() throws Throwable {
      conn.execute("String_Node_Str");
    }
  }
.assertError(SchemaException.class,MySQLErrors.wrongTypeForVariable,"String_Node_Str");
  new ExpectedSqlErrorTester(){
    @Override public void test() throws Throwable {
      conn.execute("String_Node_Str");
    }
  }
.assertError(SchemaException.class,MySQLErrors.wrongTypeForVariable,"String_Node_Str");
}
Program: 87325
Project: 87325
Buggy source:
@Test public void testStorageEngines() throws Throwable {
  testCreateWithStorageEngine("String_Node_Str");
  testCreateWithStorageEngine("String_Node_Str");
  testCreateWithStorageEngine("String_Node_Str");
  testCreateWithStorageEngine("String_Node_Str");
  testCreateWithStorageEngine("String_Node_Str");
  new ExpectedExceptionTester(){
    @Override public void test() throws Throwable {
      testCreateWithStorageEngine("String_Node_Str");
    }
  }
.assertException(PEException.class,"String_Node_Str");
  new ExpectedExceptionTester(){
    @Override public void test() throws Throwable {
      testCreateWithStorageEngine("String_Node_Str");
    }
  }
.assertException(PEException.class,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testStorageEngines() throws Throwable {
  testCreateWithStorageEngine("String_Node_Str");
  testCreateWithStorageEngine("String_Node_Str");
  testCreateWithStorageEngine("String_Node_Str");
  testCreateWithStorageEngine("String_Node_Str");
  testCreateWithStorageEngine("String_Node_Str");
  new ExpectedSqlErrorTester(){
    @Override public void test() throws Throwable {
      testCreateWithStorageEngine("String_Node_Str");
    }
  }
.assertError(SchemaException.class,MySQLErrors.wrongValueForVariable,"String_Node_Str","String_Node_Str");
  new ExpectedSqlErrorTester(){
    @Override public void test() throws Throwable {
      testCreateWithStorageEngine("String_Node_Str");
    }
  }
.assertError(SchemaException.class,MySQLErrors.wrongValueForVariable,"String_Node_Str","String_Node_Str");
}
Program: 87326
Project: 87326
Buggy source:
/** 
 * PE-1128 
 */
@Test public void setAutocommit() throws Throwable {
  assertEquals(Boolean.TRUE,KnownVariables.AUTOCOMMIT.getSessionValue(ssConnection));
  KnownVariables.AUTOCOMMIT.setSessionValue(ssConnection,"String_Node_Str");
  assertEquals(Boolean.FALSE,KnownVariables.AUTOCOMMIT.getSessionValue(ssConnection));
  KnownVariables.AUTOCOMMIT.setSessionValue(ssConnection,"String_Node_Str");
  assertEquals(Boolean.TRUE,KnownVariables.AUTOCOMMIT.getSessionValue(ssConnection));
  KnownVariables.AUTOCOMMIT.setSessionValue(ssConnection,"String_Node_Str");
  assertEquals(Boolean.FALSE,KnownVariables.AUTOCOMMIT.getSessionValue(ssConnection));
  new ExpectedExceptionTester(){
    @Override public void test() throws Throwable {
      KnownVariables.AUTOCOMMIT.setSessionValue(ssConnection,null);
    }
  }
.assertException(PEException.class,"String_Node_Str");
  new ExpectedExceptionTester(){
    @Override public void test() throws Throwable {
      KnownVariables.AUTOCOMMIT.setSessionValue(ssConnection,"String_Node_Str");
    }
  }
.assertException(PEException.class,"String_Node_Str");
  new ExpectedExceptionTester(){
    @Override public void test() throws Throwable {
      KnownVariables.AUTOCOMMIT.setSessionValue(ssConnection,"String_Node_Str");
    }
  }
.assertException(PEException.class,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * PE-1128 
 */
@Test public void setAutocommit() throws Throwable {
  assertEquals(Boolean.TRUE,KnownVariables.AUTOCOMMIT.getSessionValue(ssConnection));
  KnownVariables.AUTOCOMMIT.setSessionValue(ssConnection,"String_Node_Str");
  assertEquals(Boolean.FALSE,KnownVariables.AUTOCOMMIT.getSessionValue(ssConnection));
  KnownVariables.AUTOCOMMIT.setSessionValue(ssConnection,"String_Node_Str");
  assertEquals(Boolean.TRUE,KnownVariables.AUTOCOMMIT.getSessionValue(ssConnection));
  KnownVariables.AUTOCOMMIT.setSessionValue(ssConnection,"String_Node_Str");
  assertEquals(Boolean.FALSE,KnownVariables.AUTOCOMMIT.getSessionValue(ssConnection));
  new ExpectedSqlErrorTester(){
    @Override public void test() throws Throwable {
      KnownVariables.AUTOCOMMIT.setSessionValue(ssConnection,null);
    }
  }
.assertError(SchemaException.class,MySQLErrors.wrongValueForVariable,"String_Node_Str","String_Node_Str");
  new ExpectedSqlErrorTester(){
    @Override public void test() throws Throwable {
      KnownVariables.AUTOCOMMIT.setSessionValue(ssConnection,"String_Node_Str");
    }
  }
.assertError(SchemaException.class,MySQLErrors.wrongValueForVariable,"String_Node_Str","String_Node_Str");
  new ExpectedSqlErrorTester(){
    @Override public void test() throws Throwable {
      KnownVariables.AUTOCOMMIT.setSessionValue(ssConnection,"String_Node_Str");
    }
  }
.assertError(SchemaException.class,MySQLErrors.wrongValueForVariable,"String_Node_Str","String_Node_Str");
}
Program: 87327
Project: 87327
Buggy source:
public void startTableCleanup(){
  if (tableCleanupInterval > 0) {
    tgc=new TableGarbageCollector(tableCleanupInterval);
    tgc.start();
  }
}

Fixed version (ground truth):
public void startTableCleanup(){
  if (tableCleanupInterval > 0) {
    if (tgc != null)     tgc.stopTableCleanup();
    tgc=new TableGarbageCollector(tableCleanupInterval);
    tgc.startTableCleanup();
  }
}
Program: 87328
Project: 87328
Buggy source:
private void stopTableCleanup(){
  if (tgc != null) {
    tgc.interrupt();
    try {
      tgc.join();
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
private void stopTableCleanup(){
  if (tgc != null)   tgc.stopTableCleanup();
}
Program: 87329
Project: 87329
Buggy source:
public TableGarbageCollector(int cleanupInterval){
  super("String_Node_Str");
  setDaemon(true);
  persistentConnection=null;
  request=new AtomicInteger(1);
  interval=new AtomicInteger(cleanupInterval);
}

Fixed version (ground truth):
public TableGarbageCollector(int cleanupInterval){
  persistentConnection=null;
  request=new AtomicInteger(1);
  interval=new AtomicInteger(cleanupInterval);
}
Program: 87330
Project: 87330
Buggy source:
@Override public void run(){
  logger.info("String_Node_Str" + interval.get());
  boolean running=true;
  while (running) {
    try {
      sleep(interval.get());
      doCleanup();
      if (Thread.currentThread().isInterrupted())       running=false;
    }
 catch (    InterruptedException e) {
      running=false;
    }
catch (    Throwable t) {
      logger.error("String_Node_Str",t);
    }
    if (!running)     logger.info("String_Node_Str");
  }
  try {
    closeConnection();
  }
 catch (  Throwable t) {
    logger.error("String_Node_Str",t);
  }
}

Fixed version (ground truth):
@Override public void run(){
  logger.info("String_Node_Str" + interval.get());
  while (isActiveThread(Thread.currentThread())) {
    try {
      Thread.sleep(interval.get());
      doCleanup();
    }
 catch (    InterruptedException e) {
    }
catch (    Error td) {
      logger.error("String_Node_Str",td);
      throw td;
    }
catch (    Throwable t) {
      logger.error("String_Node_Str",t);
    }
  }
  logger.info("String_Node_Str");
  try {
    closeConnection();
  }
 catch (  Throwable t) {
    logger.error("String_Node_Str",t);
  }
}
Program: 87331
Project: 87331
Buggy source:
@Override public void unmarshallMessage(ByteBuf cb){
  binaryLogVersion=cb.readShort();
  serverVersion=MysqlAPIUtils.readBytesAsString(cb,ST_SERVER_VER_LEN,CharsetUtil.UTF_8);
  createTime=cb.readUnsignedInt();
  int eventTypeLength=cb.readableBytes();
switch (MyBinLogVerType.fromByte((byte)binaryLogVersion)) {
case MySQL_5_0:
    for (int i=1; i <= eventTypeLength; i++) {
      eventTypeValues.put(MyLogEventType.fromByte((byte)i),cb.readByte());
    }
  break;
default :
logger.error("String_Node_Str");
}
}

Fixed version (ground truth):
@Override public void unmarshallMessage(ByteBuf cb){
  binaryLogVersion=cb.readShort();
  serverVersion=MysqlAPIUtils.readBytesAsString(cb,ST_SERVER_VER_LEN,CharsetUtil.UTF_8);
  createTime=cb.readUnsignedInt();
  int eventTypeLength=cb.readUnsignedByte();
switch (MyBinLogVerType.fromByte((byte)binaryLogVersion)) {
case MySQL_5_0:
    for (int i=1; i <= eventTypeLength; i++) {
      eventTypeValues.put(MyLogEventType.fromByte((byte)i),cb.readByte());
    }
  break;
default :
logger.error("String_Node_Str");
}
}
Program: 87332
Project: 87332
Buggy source:
private void closeActivePreparedStatement(){
  if (this.pstmtId >= 0) {
    MSPComStmtCloseRequestMessage closeRequestMessage=MSPComStmtCloseRequestMessage.newMessage((byte)0,this.pstmtId);
    this.ctx.write(closeRequestMessage);
    this.pstmtId=-1;
    this.pstmtTupleCount=-1;
    this.needsNewParam=true;
  }
}

Fixed version (ground truth):
private void closeActivePreparedStatement(){
  if (this.pstmtId >= 0) {
    MSPComStmtCloseRequestMessage closeRequestMessage=MSPComStmtCloseRequestMessage.newMessage((byte)0,this.pstmtId);
    this.ctx.write(closeRequestMessage);
    this.pstmtId=-1;
    this.pstmtTupleCount=-1;
  }
}
Program: 87333
Project: 87333
Buggy source:
private void executePendingInsert(){
  BufferedExecute buffersToFlush=pendingFlush;
  int currentStatementID=this.pstmtId;
  buffersToFlush.setStmtID(currentStatementID);
  buffersToFlush.setNeedsNewParams(this.needsNewParam);
  buffersToFlush.setRowSetMetadata(policy.getRowsetMetadata());
  buffersToFlush.setColumnsPerTuple(columnsPerTuple);
  int rowsWritten=buffersToFlush.size();
  this.ctx.channel().writeAndFlush(new WrappedExecuteCommand(buffersToFlush,builder));
  this.pendingFlush=null;
  this.queuedRowSetCount.getAndAdd(-rowsWritten);
  this.needsNewParam=false;
}

Fixed version (ground truth):
private void executePendingInsert(){
  BufferedExecute buffersToFlush=pendingFlush;
  int currentStatementID=this.pstmtId;
  buffersToFlush.setStmtID(currentStatementID);
  buffersToFlush.setNeedsNewParams(true);
  buffersToFlush.setRowSetMetadata(policy.getRowsetMetadata());
  buffersToFlush.setColumnsPerTuple(columnsPerTuple);
  int rowsWritten=buffersToFlush.size();
  this.ctx.channel().writeAndFlush(new WrappedExecuteCommand(buffersToFlush,builder));
  this.pendingFlush=null;
  this.queuedRowSetCount.getAndAdd(-rowsWritten);
}
Program: 87334
Project: 87334
Buggy source:
protected void pauseSourceStreams(){
  if (!sourcePaused) {
    sourcePaused=true;
    for (    ChannelHandlerContext ctx : sourceSites.keySet()) {
      StreamValve.pipelinePause(ctx.pipeline());
    }
  }
}

Fixed version (ground truth):
protected void pauseSourceStreams(){
  sourcePaused=true;
  for (  ChannelHandlerContext ctx : sourceSites.keySet()) {
    StreamValve.pipelinePause(ctx.pipeline());
  }
}
Program: 87335
Project: 87335
Buggy source:
private boolean processTargetPacket(ChannelHandlerContext ctx,MyMessage message){
  RedistTargetSite siteCtx=siteCtxByChannel.get(ctx.channel());
  if (!isProcessingComplete(siteCtx)) {
    try {
      if (message instanceof MyOKResponse) {
        if (!isProcessingComplete(siteCtx) && !completionPromise.isFulfilled()) {
          int rowCount=(int)((MyOKResponse)message).getAffectedRows();
          updatedRowsCount+=rowCount;
        }
      }
 else {
        MyErrorResponse err=(MyErrorResponse)message;
        failure(err.asException());
      }
    }
  finally {
      siteCtx.handleAck(message);
      blockedTargetSites.remove(siteCtx);
      if (blockedTargetSites.isEmpty())       resumeSourceStreams();
    }
  }
  testRedistributionComplete();
  return isProcessingComplete(siteCtx);
}

Fixed version (ground truth):
private boolean processTargetPacket(ChannelHandlerContext ctx,MyMessage message){
  RedistTargetSite siteCtx=siteCtxByChannel.get(ctx.channel());
  if (!isProcessingComplete(siteCtx)) {
    try {
      if (message instanceof MyOKResponse) {
        if (!isProcessingComplete(siteCtx) && !completionPromise.isFulfilled()) {
          int rowCount=(int)((MyOKResponse)message).getAffectedRows();
          updatedRowsCount+=rowCount;
        }
      }
 else {
        MyErrorResponse err=(MyErrorResponse)message;
        failure(err.asException());
      }
    }
  finally {
      siteCtx.handleAck(message);
      if (!siteCtx.hasPendingFlush())       blockedTargetSites.remove(siteCtx);
      if (blockedTargetSites.isEmpty())       resumeSourceStreams();
    }
  }
  testRedistributionComplete();
  return isProcessingComplete(siteCtx);
}
Program: 87336
Project: 87336
Buggy source:
public void processSourcePacket(MappingSolution mappingSolution,MyBinaryResultRow binRow,int fieldCount,ColumnSet columnSet,long[] autoIncrBlocks) throws PEException {
  if (!receivingSourcePackets)   receivingSourcePackets=true;
  if (mappingSolution == MappingSolution.AllWorkers || mappingSolution == MappingSolution.AllWorkersSerialized) {
    for (    RedistTargetSite siteCtx : siteCtxBySite.values())     handleSourceRow(binRow,(autoIncrBlocks == null) ? null : new long[]{autoIncrBlocks[0]},siteCtx);
  }
 else   if (mappingSolution == MappingSolution.AnyWorker || mappingSolution == MappingSolution.AnyWorkerSerialized) {
    handleSourceRow(binRow,autoIncrBlocks,PECollectionUtils.selectRandom(siteCtxBySite.values()));
  }
 else {
    StorageSite executionSite=targetWG.resolveSite(mappingSolution.getSite());
    handleSourceRow(binRow,autoIncrBlocks,siteCtxBySite.get(executionSite));
  }
  if (!blockedTargetSites.isEmpty()) {
    pauseSourceStreams();
  }
}

Fixed version (ground truth):
public void processSourcePacket(MappingSolution mappingSolution,MyBinaryResultRow binRow,int fieldCount,ColumnSet columnSet,long[] autoIncrBlocks) throws PEException {
  if (mappingSolution == MappingSolution.AllWorkers || mappingSolution == MappingSolution.AllWorkersSerialized) {
    for (    RedistTargetSite siteCtx : siteCtxBySite.values())     handleSourceRow(binRow,(autoIncrBlocks == null) ? null : new long[]{autoIncrBlocks[0]},siteCtx);
  }
 else   if (mappingSolution == MappingSolution.AnyWorker || mappingSolution == MappingSolution.AnyWorkerSerialized) {
    handleSourceRow(binRow,autoIncrBlocks,PECollectionUtils.selectRandom(siteCtxBySite.values()));
  }
 else {
    StorageSite executionSite=targetWG.resolveSite(mappingSolution.getSite());
    handleSourceRow(binRow,autoIncrBlocks,siteCtxBySite.get(executionSite));
  }
  if (!blockedTargetSites.isEmpty()) {
    pauseSourceStreams();
  }
}
Program: 87337
Project: 87337
Buggy source:
public void sourceActive(ChannelHandlerContext ctx){
  if (sourceSites.get(ctx) == null) {
    sourceSites.put(ctx,ctx);
    if (receivingSourcePackets && sourcePaused) {
      StreamValve.pipelinePause(ctx.pipeline());
    }
  }
}

Fixed version (ground truth):
public void sourceActive(ChannelHandlerContext ctx){
  if (sourceSites.get(ctx) == null) {
    sourceSites.put(ctx,ctx);
    if (sourcePaused) {
      StreamValve.pipelinePause(ctx.pipeline());
    }
  }
}
Program: 87338
Project: 87338
Buggy source:
public static WorkerGroup newInstance(SSConnection ssCon,StorageGroup sg,PersistentDatabase ctxDB) throws PEException {
  WorkerGroup wg=workerGroupPool.get(sg,ssCon.getUserAuthentication());
  Channel channel=ssCon.getChannel();
  EventLoop eventLoop=channel == null ? null : channel.eventLoop();
  if (wg == null) {
    wg=new WorkerGroup(sg).provision(ssCon,ssCon,ssCon.getUserAuthentication(),eventLoop);
  }
 else {
    wg.bindToClientThread(eventLoop);
  }
  try {
    if (ctxDB != null)     wg.setDatabase(ssCon,ctxDB);
    wg.assureSessionVariables(ssCon);
  }
 catch (  PEException e) {
    if (logger.isDebugEnabled())     logger.debug("String_Node_Str" + wg);
    wg.releaseWorkers(ssCon);
    throw e;
  }
  if (wg.workerMap == null)   throw new PECodingException("String_Node_Str");
  return wg;
}

Fixed version (ground truth):
public static WorkerGroup newInstance(SSConnection ssCon,StorageGroup sg,PersistentDatabase ctxDB) throws PEException {
  WorkerGroup wg=workerGroupPool.get(sg,ssCon.getUserAuthentication());
  Channel channel=ssCon.getChannel();
  EventLoop eventLoop=channel == null ? null : channel.eventLoop();
  if (wg == null) {
    wg=new WorkerGroup(sg).provision(ssCon,ssCon,ssCon.getUserAuthentication(),eventLoop);
  }
 else {
    wg.bindToClientThread(eventLoop);
  }
  try {
    if (ctxDB != null)     wg.setDatabase(ssCon,ctxDB);
    wg.assureSessionVariables(ssCon);
  }
 catch (  PEException e) {
    e.printStackTrace(System.out);
    if (logger.isDebugEnabled())     logger.debug("String_Node_Str" + wg);
    wg.releaseWorkers(ssCon);
    throw e;
  }
  if (wg.workerMap == null)   throw new PECodingException("String_Node_Str");
  return wg;
}
Program: 87339
Project: 87339
Buggy source:
private void submitWork(final Worker w,final WorkerRequest req,final DBResultConsumer resultConsumer,final CompletionHandle<Worker> workerComplete){
  final long reqStartTime=System.currentTimeMillis();
  final CompletionHandle<Boolean> promise=new PEDefaultPromise<Boolean>(){
    @Override public void success(    Boolean returnValue){
      try {
        w.sendStatistics(req,System.currentTimeMillis() - reqStartTime);
        workerComplete.success(w);
      }
 catch (      PEException e) {
        this.failure(e);
      }
    }
    @Override public void failure(    Exception t){
      try {
        w.setLastException(t);
        if (t instanceof PEException && ((PEException)t).hasCause(PECommunicationsException.class)) {
          markForPurge();
        }
      }
  finally {
        workerComplete.failure(t);
      }
    }
  }
;
  try {
    w.getConnectionId();
  }
 catch (  PESQLException e) {
  }
  clientEventLoop.submit(new Callable<Worker>(){
    @Override public Worker call() throws Exception {
      req.executeRequest(w,resultConsumer,promise);
      return w;
    }
  }
);
}

Fixed version (ground truth):
private void submitWork(final Worker w,final WorkerRequest req,final DBResultConsumer resultConsumer,final CompletionHandle<Worker> workerComplete){
  final long reqStartTime=System.currentTimeMillis();
  final CompletionHandle<Boolean> promise=new PEDefaultPromise<Boolean>(){
    @Override public void success(    Boolean returnValue){
      try {
        w.sendStatistics(req,System.currentTimeMillis() - reqStartTime);
        workerComplete.success(w);
      }
 catch (      PEException e) {
        this.failure(e);
      }
    }
    @Override public void failure(    Exception t){
      try {
        w.setLastException(t);
        if (t instanceof PEException && ((PEException)t).hasCause(PECommunicationsException.class)) {
          markForPurge();
        }
      }
  finally {
        workerComplete.failure(t);
      }
    }
  }
;
  try {
    w.getConnectionId();
  }
 catch (  Exception e) {
  }
  clientEventLoop.submit(new Callable<Worker>(){
    @Override public Worker call() throws Exception {
      req.executeRequest(w,resultConsumer,promise);
      return w;
    }
  }
);
}
Program: 87340
Project: 87340
Buggy source:
public SF readStructuredField() throws IOException {
  AfpInputStream afpin=null;
  try {
    afpin=new AfpInputStream(new AfpIn(this));
    return afpin.readStructuredField();
  }
  finally {
    if (afpin != null)     afpin.close();
  }
}

Fixed version (ground truth):
public SF readStructuredField() throws IOException {
  AfpInputStream afpin=null;
  try {
    afpin=new AfpInputStream(new AfpIn(this),leadingLengthBytes);
    SF sf=afpin.readStructuredField();
    if (leadingLengthBytes == -1)     leadingLengthBytes=afpin.getLeadingLengthBytes();
    return sf;
  }
  finally {
    if (afpin != null)     afpin.close();
  }
}
Program: 87342
Project: 87342
Buggy source:
@Test public void testWrite() throws IOException {
  new File("String_Node_Str").mkdirs();
  File testFile=new File("String_Node_Str");
  testFile.delete();
  Files.copy(new File("String_Node_Str").toPath(),testFile.toPath());
  try (AfpFile file=new AfpFile(testFile,"String_Node_Str")){
    SF sf;
    sf=file.readStructuredField();
    assertTrue(sf instanceof BRG);
    sf=file.readStructuredField();
    assertTrue(sf instanceof ERG);
    sf=file.readStructuredField();
    assertNull(sf);
    sf=AfplibFactory.eINSTANCE.createNOP();
    ((NOP)sf).setUndfData(new byte[]{1,2,3});
    file.writeStructuredField(sf);
    file.seek(0);
    sf=file.readStructuredField();
    assertTrue(sf instanceof BRG);
    sf=file.readStructuredField();
    assertTrue(sf instanceof ERG);
    sf=file.readStructuredField();
    assertTrue(sf instanceof NOP);
    sf=file.readStructuredField();
    assertNull(sf);
  }
 }

Fixed version (ground truth):
@Test public void testWrite() throws IOException {
  new File("String_Node_Str").mkdirs();
  File testFile=new File("String_Node_Str");
  testFile.delete();
  Files.copy(new File("String_Node_Str").toPath(),testFile.toPath());
  try (AfpFile file=new AfpFile(testFile,"String_Node_Str")){
    SF sf;
    sf=file.readStructuredField();
    assertTrue(sf instanceof BRG);
    sf=file.readStructuredField();
    assertTrue(sf instanceof ERG);
    sf=AfplibFactory.eINSTANCE.createNOP();
    ((NOP)sf).setUndfData(new byte[]{1,2,3});
    file.writeStructuredField(sf);
    file.seek(0);
    sf=file.readStructuredField();
    assertTrue(sf instanceof BRG);
    sf=file.readStructuredField();
    assertTrue(sf instanceof ERG);
    sf=file.readStructuredField();
    assertTrue(sf instanceof NOP);
  }
 }
Program: 87343
Project: 87343
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  resultTextView=(TextView)findViewById(R.id.result_text_view);
  Button syncNow=(Button)findViewById(R.id.sync_now_button);
  final TimeSyncProxy sync=TimeSync.get(this,RandomSync.class);
  syncNow.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      sync.sync();
    }
  }
);
  final Button toggle=(Button)findViewById(R.id.toggle_enabled_button);
  toggle.setText("String_Node_Str" + (sync.config().enabled() ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str");
  toggle.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      sync.edit(enable(!sync.config().enabled()));
      toggle.setText("String_Node_Str" + (sync.config().enabled() ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str");
    }
  }
);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  resultTextView=(TextView)findViewById(R.id.result_text_view);
  Button syncNow=(Button)findViewById(R.id.sync_now_button);
  Button syncSoon=(Button)findViewById(R.id.sync_soon_button);
  final Button toggle=(Button)findViewById(R.id.toggle_enabled_button);
  final TimeSyncProxy sync=TimeSync.get(this,RandomSync.class);
  syncNow.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      sync.sync();
    }
  }
);
  syncSoon.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      sync.syncInexact();
    }
  }
);
  toggle.setText("String_Node_Str" + (sync.config().enabled() ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str");
  toggle.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      sync.edit(enable(!sync.config().enabled()));
      toggle.setText("String_Node_Str" + (sync.config().enabled() ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str");
    }
  }
);
}
Program: 87344
Project: 87344
Buggy source:
@Override public void onSync(Context context) throws Exception {
  Thread.sleep(1000);
  long result=random.nextLong();
  if (random.nextInt(5) < 2) {
    Log.d("String_Node_Str","String_Node_Str" + System.currentTimeMillis());
    throw new Exception();
  }
  Log.d("String_Node_Str","String_Node_Str" + System.currentTimeMillis());
  Intent intent=new Intent(BROADCAST);
  intent.putExtra(EXTRA_RESULT,result);
  LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
}

Fixed version (ground truth):
@Override public void onSync(Context context) throws Exception {
  long result=random.nextLong();
  Intent intent=new Intent(BROADCAST);
  intent.putExtra(EXTRA_RESULT,result);
  LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
}
Program: 87345
Project: 87345
Buggy source:
public void selectByVisibleText(Object text){
  log.info("String_Node_Str" + this + "String_Node_Str"+ text+ "String_Node_Str");
  locate().selectByVisibleText(text.toString());
  if (!locate().getFirstSelectedOption().getAttribute("String_Node_Str").equals(text.toString())) {
    locate().getOptions().stream().filter((    WebElement e) -> e.getText().equals(text.toString())).findFirst().get().click();
  }
}

Fixed version (ground truth):
public void selectByVisibleText(Object text){
  log.info("String_Node_Str" + this + "String_Node_Str"+ text+ "String_Node_Str");
  locate().selectByVisibleText(text.toString());
  try {
    if (!locate().getFirstSelectedOption().getAttribute("String_Node_Str").equals(text.toString())) {
      locate().getOptions().stream().filter((      WebElement e) -> e.getText().equals(text.toString())).findFirst().get().click();
    }
  }
 catch (  Exception e) {
  }
}
Program: 87346
Project: 87346
Buggy source:
/** 
 * @return the value of the select radio
 */
public String getValue(){
  return locate(new FirstMatch<>(DISPLAYED.and(CHECKED.and(TRUE))).andThen(GET).andThen(element(PARENT)).andThen(TEXT));
}

Fixed version (ground truth):
/** 
 * @return the value of the select radio
 */
public String getValue(){
  return locate(new FirstMatch<>(DISPLAYED.and(CHECKED.and(TRUE))).andThen(GET).andThen(VALUE));
}
Program: 87347
Project: 87347
Buggy source:
/** 
 * @param value value to set
 */
public void setValue(Object value){
  locate(new FirstMatch<>(DISPLAYED.and(Locators.<Element>element(PARENT).andThen(TEXT).and(new StringContains(value.toString())))).andThen(GET).andThen(CLICK));
}

Fixed version (ground truth):
/** 
 * @param value value to set
 */
public void setValue(Object value){
  locate(new FirstMatch<>(VALUE.and(new StringContains(value.toString()))).andThen(GET).andThen(CLICK));
}
Program: 87348
Project: 87348
Buggy source:
default public void save(String title){
  logger.info("String_Node_Str",title);
  File scrFile=null;
  try {
    scrFile=this.getSupplier().takeScreenShot(this);
    copyFile(scrFile,new File("String_Node_Str" + title + new Date().getTime()+ "String_Node_Str"));
    scrFile.delete();
  }
 catch (  UnhandledAlertException e) {
    logger.info("String_Node_Str",e);
  }
catch (  IOException e) {
    try {
      copyFile(scrFile,new File("String_Node_Str" + new Date().getTime() + "String_Node_Str"));
    }
 catch (    IOException e1) {
      logger.info("String_Node_Str",e1);
    }
  }
}

Fixed version (ground truth):
default public void save(String title){
  T webDriver=get();
  if (webDriver instanceof TakesScreenshot) {
    logger.info("String_Node_Str",title);
    File scrFile=null;
    try {
      TakesScreenshot camera=(TakesScreenshot)webDriver;
      scrFile=camera.getScreenshotAs(FILE);
      copyFile(scrFile,new File("String_Node_Str" + title + new Date().getTime()+ "String_Node_Str"));
      scrFile.delete();
    }
 catch (    UnhandledAlertException e) {
      logger.info("String_Node_Str",e);
    }
catch (    IOException e) {
      try {
        copyFile(scrFile,new File("String_Node_Str" + new Date().getTime() + "String_Node_Str"));
      }
 catch (      IOException e1) {
        logger.info("String_Node_Str",e1);
      }
    }
  }
 else {
    logger.info("String_Node_Str");
  }
}
Program: 87349
Project: 87349
Buggy source:
@Test public void testZenkakuHiraganaToHankakuKatakana(){
  this.assertConverted(KanaConverter.OP_ZENKAKU_HIRAGANA_TO_HANKAKU_KATAKANA,"String_Node_Str","String_Node_Str");
  this.assertConverted(KanaConverter.OP_ZENKAKU_HIRAGANA_TO_HANKAKU_KATAKANA,"String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@Test public void testZenkakuHiraganaToHankakuKatakana(){
  this.assertConverted(KanaConverter.OP_ZENKAKU_HIRAGANA_TO_HANKAKU_KATAKANA,"String_Node_Str","String_Node_Str");
  this.assertConverted(KanaConverter.OP_ZENKAKU_HIRAGANA_TO_HANKAKU_KATAKANA,"String_Node_Str","String_Node_Str");
  this.assertConverted(KanaConverter.OP_ZENKAKU_HIRAGANA_TO_HANKAKU_KATAKANA,"String_Node_Str","String_Node_Str");
}
Program: 87350
Project: 87350
Buggy source:
@Override public void onUpdateSelection(final int oldSelStart,final int oldSelEnd,final int newSelStart,final int newSelEnd,final int composingSpanStart,final int composingSpanEnd){
  super.onUpdateSelection(oldSelStart,oldSelEnd,newSelStart,newSelEnd,composingSpanStart,composingSpanEnd);
  if (DEBUG) {
    Log.i(TAG,"String_Node_Str" + oldSelStart + "String_Node_Str"+ oldSelEnd+ "String_Node_Str"+ newSelStart+ "String_Node_Str"+ newSelEnd+ "String_Node_Str"+ composingSpanStart+ "String_Node_Str"+ composingSpanEnd);
  }
  final SettingsValues settingsValues=mSettings.getCurrent();
  if ((!settingsValues.mHasHardwareKeyboard || ProductionFlags.IS_HARDWARE_KEYBOARD_SUPPORTED) && mInputLogic.onUpdateSelection(oldSelStart,oldSelEnd,newSelStart,newSelEnd)) {
    mKeyboardSwitcher.requestUpdatingShiftState(getCurrentAutoCapsState(),getCurrentRecapitalizeState());
  }
}

Fixed version (ground truth):
@Override public void onUpdateSelection(final int oldSelStart,final int oldSelEnd,final int newSelStart,final int newSelEnd,final int composingSpanStart,final int composingSpanEnd){
  super.onUpdateSelection(oldSelStart,oldSelEnd,newSelStart,newSelEnd,composingSpanStart,composingSpanEnd);
  if (DEBUG) {
    Log.i(TAG,"String_Node_Str" + oldSelStart + "String_Node_Str"+ oldSelEnd+ "String_Node_Str"+ newSelStart+ "String_Node_Str"+ newSelEnd+ "String_Node_Str"+ composingSpanStart+ "String_Node_Str"+ composingSpanEnd);
  }
  final SettingsValues settingsValues=mSettings.getCurrent();
  if ((!settingsValues.mHasHardwareKeyboard || ProductionFlags.IS_HARDWARE_KEYBOARD_SUPPORTED) && mInputLogic.onUpdateSelection(oldSelStart,oldSelEnd,newSelStart,newSelEnd,settingsValues)) {
    mKeyboardSwitcher.requestUpdatingShiftState(getCurrentAutoCapsState(),getCurrentRecapitalizeState());
  }
}
Program: 87352
Project: 87352
Buggy source:
@Override public void onUpdateSelection(final int oldSelStart,final int oldSelEnd,final int newSelStart,final int newSelEnd,final int composingSpanStart,final int composingSpanEnd){
  super.onUpdateSelection(oldSelStart,oldSelEnd,newSelStart,newSelEnd,composingSpanStart,composingSpanEnd);
  if (DEBUG) {
    Log.i(TAG,"String_Node_Str" + oldSelStart + "String_Node_Str"+ oldSelEnd+ "String_Node_Str"+ newSelStart+ "String_Node_Str"+ newSelEnd+ "String_Node_Str"+ composingSpanStart+ "String_Node_Str"+ composingSpanEnd);
  }
  final SettingsValues settingsValues=mSettings.getCurrent();
  if ((!settingsValues.mHasHardwareKeyboard || ProductionFlags.IS_HARDWARE_KEYBOARD_SUPPORTED) && mInputLogic.onUpdateSelection(oldSelStart,oldSelEnd,newSelStart,newSelEnd)) {
    mKeyboardSwitcher.requestUpdatingShiftState(getCurrentAutoCapsState(),getCurrentRecapitalizeState());
  }
}

Fixed version (ground truth):
@Override public void onUpdateSelection(final int oldSelStart,final int oldSelEnd,final int newSelStart,final int newSelEnd,final int composingSpanStart,final int composingSpanEnd){
  super.onUpdateSelection(oldSelStart,oldSelEnd,newSelStart,newSelEnd,composingSpanStart,composingSpanEnd);
  if (DEBUG) {
    Log.i(TAG,"String_Node_Str" + oldSelStart + "String_Node_Str"+ oldSelEnd+ "String_Node_Str"+ newSelStart+ "String_Node_Str"+ newSelEnd+ "String_Node_Str"+ composingSpanStart+ "String_Node_Str"+ composingSpanEnd);
  }
  final SettingsValues settingsValues=mSettings.getCurrent();
  if ((!settingsValues.mHasHardwareKeyboard || ProductionFlags.IS_HARDWARE_KEYBOARD_SUPPORTED) && mInputLogic.onUpdateSelection(oldSelStart,oldSelEnd,newSelStart,newSelEnd,settingsValues)) {
    mKeyboardSwitcher.requestUpdatingShiftState(getCurrentAutoCapsState(),getCurrentRecapitalizeState());
  }
}
Program: 87354
Project: 87354
Buggy source:
@Override public void onUpdateSelection(final int oldSelStart,final int oldSelEnd,final int newSelStart,final int newSelEnd,final int composingSpanStart,final int composingSpanEnd){
  super.onUpdateSelection(oldSelStart,oldSelEnd,newSelStart,newSelEnd,composingSpanStart,composingSpanEnd);
  if (DEBUG) {
    Log.i(TAG,"String_Node_Str" + oldSelStart + "String_Node_Str"+ oldSelEnd+ "String_Node_Str"+ newSelStart+ "String_Node_Str"+ newSelEnd+ "String_Node_Str"+ composingSpanStart+ "String_Node_Str"+ composingSpanEnd);
  }
  final SettingsValues settingsValues=mSettings.getCurrent();
  if ((!settingsValues.mHasHardwareKeyboard || ProductionFlags.IS_HARDWARE_KEYBOARD_SUPPORTED) && mInputLogic.onUpdateSelection(oldSelStart,oldSelEnd,newSelStart,newSelEnd)) {
    mKeyboardSwitcher.requestUpdatingShiftState(getCurrentAutoCapsState(),getCurrentRecapitalizeState());
  }
}

Fixed version (ground truth):
@Override public void onUpdateSelection(final int oldSelStart,final int oldSelEnd,final int newSelStart,final int newSelEnd,final int composingSpanStart,final int composingSpanEnd){
  super.onUpdateSelection(oldSelStart,oldSelEnd,newSelStart,newSelEnd,composingSpanStart,composingSpanEnd);
  if (DEBUG) {
    Log.i(TAG,"String_Node_Str" + oldSelStart + "String_Node_Str"+ oldSelEnd+ "String_Node_Str"+ newSelStart+ "String_Node_Str"+ newSelEnd+ "String_Node_Str"+ composingSpanStart+ "String_Node_Str"+ composingSpanEnd);
  }
  final SettingsValues settingsValues=mSettings.getCurrent();
  if ((!settingsValues.mHasHardwareKeyboard || ProductionFlags.IS_HARDWARE_KEYBOARD_SUPPORTED) && mInputLogic.onUpdateSelection(oldSelStart,oldSelEnd,newSelStart,newSelEnd,settingsValues)) {
    mKeyboardSwitcher.requestUpdatingShiftState(getCurrentAutoCapsState(),getCurrentRecapitalizeState());
  }
}
Program: 87358
Project: 87358
Buggy source:
public SpacingAndPunctuations(final Resources res){
  mSortedSymbolsPrecededBySpace=StringUtils.toSortedCodePointArray(res.getString(R.string.symbols_preceded_by_space));
  mSortedSymbolsFollowedBySpace=StringUtils.toSortedCodePointArray(res.getString(R.string.symbols_followed_by_space));
  mSortedSymbolsClusteringTogether=StringUtils.toSortedCodePointArray(res.getString(R.string.symbols_clustering_together));
  mSortedWordConnectors=StringUtils.toSortedCodePointArray(res.getString(R.string.symbols_word_connectors));
  mSortedWordSeparators=StringUtils.toSortedCodePointArray(res.getString(R.string.symbols_word_separators));
  mSentenceSeparator=res.getInteger(R.integer.sentence_separator);
  mSentenceSeparatorAndSpace=new String(new int[]{mSentenceSeparator,Constants.CODE_SPACE},0,2);
  mCurrentLanguageHasSpaces=res.getBoolean(R.bool.current_language_has_spaces);
  final Locale locale=res.getConfiguration().locale;
  mUsesAmericanTypography=Locale.ENGLISH.getLanguage().equals(locale.getLanguage());
  mUsesGermanRules=Locale.GERMAN.getLanguage().equals(locale.getLanguage());
  final String[] suggestPuncsSpec=MoreKeySpec.splitKeySpecs(res.getString(R.string.suggested_punctuations));
  mSuggestPuncList=PunctuationSuggestions.newPunctuationSuggestions(suggestPuncsSpec);
}

Fixed version (ground truth):
@UsedForTesting public SpacingAndPunctuations(final SpacingAndPunctuations model,final int[] overrideSortedWordSeparators){
  mSortedSymbolsPrecededBySpace=model.mSortedSymbolsPrecededBySpace;
  mSortedSymbolsFollowedBySpace=model.mSortedSymbolsFollowedBySpace;
  mSortedSymbolsClusteringTogether=model.mSortedSymbolsClusteringTogether;
  mSortedWordConnectors=model.mSortedWordConnectors;
  mSortedWordSeparators=overrideSortedWordSeparators;
  mSuggestPuncList=model.mSuggestPuncList;
  mSentenceSeparator=model.mSentenceSeparator;
  mSentenceSeparatorAndSpace=model.mSentenceSeparatorAndSpace;
  mCurrentLanguageHasSpaces=model.mCurrentLanguageHasSpaces;
  mUsesAmericanTypography=model.mUsesAmericanTypography;
  mUsesGermanRules=model.mUsesGermanRules;
}
Program: 87363
Project: 87363
Buggy source:
public SpacingAndPunctuations(final Resources res){
  mSortedSymbolsPrecededBySpace=StringUtils.toSortedCodePointArray(res.getString(R.string.symbols_preceded_by_space));
  mSortedSymbolsFollowedBySpace=StringUtils.toSortedCodePointArray(res.getString(R.string.symbols_followed_by_space));
  mSortedSymbolsClusteringTogether=StringUtils.toSortedCodePointArray(res.getString(R.string.symbols_clustering_together));
  mSortedWordConnectors=StringUtils.toSortedCodePointArray(res.getString(R.string.symbols_word_connectors));
  mSortedWordSeparators=StringUtils.toSortedCodePointArray(res.getString(R.string.symbols_word_separators));
  mSentenceSeparator=res.getInteger(R.integer.sentence_separator);
  mSentenceSeparatorAndSpace=new String(new int[]{mSentenceSeparator,Constants.CODE_SPACE},0,2);
  mCurrentLanguageHasSpaces=res.getBoolean(R.bool.current_language_has_spaces);
  final Locale locale=res.getConfiguration().locale;
  mUsesAmericanTypography=Locale.ENGLISH.getLanguage().equals(locale.getLanguage());
  mUsesGermanRules=Locale.GERMAN.getLanguage().equals(locale.getLanguage());
  final String[] suggestPuncsSpec=MoreKeySpec.splitKeySpecs(res.getString(R.string.suggested_punctuations));
  mSuggestPuncList=PunctuationSuggestions.newPunctuationSuggestions(suggestPuncsSpec);
}

Fixed version (ground truth):
@UsedForTesting public SpacingAndPunctuations(final SpacingAndPunctuations model,final int[] overrideSortedWordSeparators){
  mSortedSymbolsPrecededBySpace=model.mSortedSymbolsPrecededBySpace;
  mSortedSymbolsFollowedBySpace=model.mSortedSymbolsFollowedBySpace;
  mSortedSymbolsClusteringTogether=model.mSortedSymbolsClusteringTogether;
  mSortedWordConnectors=model.mSortedWordConnectors;
  mSortedWordSeparators=overrideSortedWordSeparators;
  mSuggestPuncList=model.mSuggestPuncList;
  mSentenceSeparator=model.mSentenceSeparator;
  mSentenceSeparatorAndSpace=model.mSentenceSeparatorAndSpace;
  mCurrentLanguageHasSpaces=model.mCurrentLanguageHasSpaces;
  mUsesAmericanTypography=model.mUsesAmericanTypography;
  mUsesGermanRules=model.mUsesGermanRules;
}
Program: 87366
Project: 87366
Buggy source:
public static CharSequence getTextWithSuggestionSpan(final Context context,final String pickedWord,final SuggestedWords suggestedWords){
  if (TextUtils.isEmpty(pickedWord) || suggestedWords.isEmpty() || suggestedWords.mIsPrediction|| suggestedWords.isPunctuationSuggestions()) {
    return pickedWord;
  }
  final ArrayList<String> suggestionsList=new ArrayList<>();
  for (int i=0; i < suggestedWords.size(); ++i) {
    if (suggestionsList.size() >= SuggestionSpan.SUGGESTIONS_MAX_SIZE) {
      break;
    }
    final SuggestedWordInfo info=suggestedWords.getInfo(i);
    if (info.isKindOf(SuggestedWordInfo.KIND_PREDICTION)) {
      continue;
    }
    final String word=suggestedWords.getWord(i);
    if (!TextUtils.equals(pickedWord,word)) {
      suggestionsList.add(word.toString());
    }
  }
  final SuggestionSpan suggestionSpan=new SuggestionSpan(context,null,suggestionsList.toArray(new String[suggestionsList.size()]),0,SuggestionSpanPickedNotificationReceiver.class);
  final Spannable spannable=new SpannableString(pickedWord);
  spannable.setSpan(suggestionSpan,0,pickedWord.length(),Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
  return spannable;
}

Fixed version (ground truth):
public static CharSequence getTextWithSuggestionSpan(final Context context,final String pickedWord,final SuggestedWords suggestedWords){
  if (TextUtils.isEmpty(pickedWord) || suggestedWords.isEmpty() || suggestedWords.isPrediction()|| suggestedWords.isPunctuationSuggestions()) {
    return pickedWord;
  }
  final ArrayList<String> suggestionsList=new ArrayList<>();
  for (int i=0; i < suggestedWords.size(); ++i) {
    if (suggestionsList.size() >= SuggestionSpan.SUGGESTIONS_MAX_SIZE) {
      break;
    }
    final SuggestedWordInfo info=suggestedWords.getInfo(i);
    if (info.isKindOf(SuggestedWordInfo.KIND_PREDICTION)) {
      continue;
    }
    final String word=suggestedWords.getWord(i);
    if (!TextUtils.equals(pickedWord,word)) {
      suggestionsList.add(word.toString());
    }
  }
  final SuggestionSpan suggestionSpan=new SuggestionSpan(context,null,suggestionsList.toArray(new String[suggestionsList.size()]),0,SuggestionSpanPickedNotificationReceiver.class);
  final Spannable spannable=new SpannableString(pickedWord);
  spannable.setSpan(suggestionSpan,0,pickedWord.length(),Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
  return spannable;
}
Program: 87367
Project: 87367
Buggy source:
@Override public void onDisplayCompletions(final CompletionInfo[] applicationSpecifiedCompletions){
  if (DEBUG) {
    Log.i(TAG,"String_Node_Str");
    if (applicationSpecifiedCompletions != null) {
      for (int i=0; i < applicationSpecifiedCompletions.length; i++) {
        Log.i(TAG,"String_Node_Str" + i + "String_Node_Str"+ applicationSpecifiedCompletions[i]);
      }
    }
  }
  if (!mSettings.getCurrent().isApplicationSpecifiedCompletionsOn()) {
    return;
  }
  mHandler.cancelUpdateSuggestionStrip();
  if (applicationSpecifiedCompletions == null) {
    setNeutralSuggestionStrip();
    return;
  }
  final ArrayList<SuggestedWords.SuggestedWordInfo> applicationSuggestedWords=SuggestedWords.getFromApplicationSpecifiedCompletions(applicationSpecifiedCompletions);
  final SuggestedWords suggestedWords=new SuggestedWords(applicationSuggestedWords,null,false,false,false,false,SuggestedWords.INPUT_STYLE_APPLICATION_SPECIFIED);
  setSuggestedWords(suggestedWords);
}

Fixed version (ground truth):
@Override public void onDisplayCompletions(final CompletionInfo[] applicationSpecifiedCompletions){
  if (DEBUG) {
    Log.i(TAG,"String_Node_Str");
    if (applicationSpecifiedCompletions != null) {
      for (int i=0; i < applicationSpecifiedCompletions.length; i++) {
        Log.i(TAG,"String_Node_Str" + i + "String_Node_Str"+ applicationSpecifiedCompletions[i]);
      }
    }
  }
  if (!mSettings.getCurrent().isApplicationSpecifiedCompletionsOn()) {
    return;
  }
  mHandler.cancelUpdateSuggestionStrip();
  if (applicationSpecifiedCompletions == null) {
    setNeutralSuggestionStrip();
    return;
  }
  final ArrayList<SuggestedWords.SuggestedWordInfo> applicationSuggestedWords=SuggestedWords.getFromApplicationSpecifiedCompletions(applicationSpecifiedCompletions);
  final SuggestedWords suggestedWords=new SuggestedWords(applicationSuggestedWords,null,false,false,false,SuggestedWords.INPUT_STYLE_APPLICATION_SPECIFIED);
  setSuggestedWords(suggestedWords);
}
Program: 87368
Project: 87368
Buggy source:
private PunctuationSuggestions(final ArrayList<SuggestedWordInfo> punctuationsList){
  super(punctuationsList,null,false,false,false,false,INPUT_STYLE_NONE);
}

Fixed version (ground truth):
private PunctuationSuggestions(final ArrayList<SuggestedWordInfo> punctuationsList){
  super(punctuationsList,null,false,false,false,INPUT_STYLE_NONE);
}
Program: 87371
Project: 87371
Buggy source:
public SuggestedWords(final ArrayList<SuggestedWordInfo> suggestedWordInfoList,final ArrayList<SuggestedWordInfo> rawSuggestions,final String typedWord,final boolean typedWordValid,final boolean willAutoCorrect,final boolean isObsoleteSuggestions,final boolean isPrediction,final int inputStyle,final int sequenceNumber){
  mSuggestedWordInfoList=suggestedWordInfoList;
  mRawSuggestions=rawSuggestions;
  mTypedWordValid=typedWordValid;
  mWillAutoCorrect=willAutoCorrect;
  mIsObsoleteSuggestions=isObsoleteSuggestions;
  mIsPrediction=isPrediction;
  mInputStyle=inputStyle;
  mSequenceNumber=sequenceNumber;
  mTypedWord=typedWord;
}

Fixed version (ground truth):
public SuggestedWords(final ArrayList<SuggestedWordInfo> suggestedWordInfoList,final ArrayList<SuggestedWordInfo> rawSuggestions,final String typedWord,final boolean typedWordValid,final boolean willAutoCorrect,final boolean isObsoleteSuggestions,final int inputStyle,final int sequenceNumber){
  mSuggestedWordInfoList=suggestedWordInfoList;
  mRawSuggestions=rawSuggestions;
  mTypedWordValid=typedWordValid;
  mWillAutoCorrect=willAutoCorrect;
  mIsObsoleteSuggestions=isObsoleteSuggestions;
  mInputStyle=inputStyle;
  mSequenceNumber=sequenceNumber;
  mTypedWord=typedWord;
}
Program: 87372
Project: 87372
Buggy source:
public SuggestedWords getSuggestedWordsForLastWordOfPhraseGesture(){
  final ArrayList<SuggestedWordInfo> newSuggestions=new ArrayList<>();
  for (int i=0; i < mSuggestedWordInfoList.size(); ++i) {
    final SuggestedWordInfo info=mSuggestedWordInfoList.get(i);
    final int indexOfLastSpace=info.mWord.lastIndexOf(Constants.CODE_SPACE) + 1;
    final String lastWord=info.mWord.substring(indexOfLastSpace);
    newSuggestions.add(new SuggestedWordInfo(lastWord,info.mScore,info.mKindAndFlags,info.mSourceDict,SuggestedWordInfo.NOT_AN_INDEX,SuggestedWordInfo.NOT_A_CONFIDENCE));
  }
  return new SuggestedWords(newSuggestions,null,mTypedWordValid,mWillAutoCorrect,mIsObsoleteSuggestions,mIsPrediction,INPUT_STYLE_TAIL_BATCH);
}

Fixed version (ground truth):
public SuggestedWords getSuggestedWordsForLastWordOfPhraseGesture(){
  final ArrayList<SuggestedWordInfo> newSuggestions=new ArrayList<>();
  for (int i=0; i < mSuggestedWordInfoList.size(); ++i) {
    final SuggestedWordInfo info=mSuggestedWordInfoList.get(i);
    final int indexOfLastSpace=info.mWord.lastIndexOf(Constants.CODE_SPACE) + 1;
    final String lastWord=info.mWord.substring(indexOfLastSpace);
    newSuggestions.add(new SuggestedWordInfo(lastWord,info.mScore,info.mKindAndFlags,info.mSourceDict,SuggestedWordInfo.NOT_AN_INDEX,SuggestedWordInfo.NOT_A_CONFIDENCE));
  }
  return new SuggestedWords(newSuggestions,null,mTypedWordValid,mWillAutoCorrect,mIsObsoleteSuggestions,INPUT_STYLE_TAIL_BATCH);
}