nus-yam/ex-repair huggingface dataset:
Program: 13160
Project: 13160
Buggy source:
@Override public void finish(RepeatHandle repeatable){
  this.repeatHandles.add(repeatable);
  countdown();
  listener.onSuccess(null);
}

Fixed version (ground truth):
@Override public void finish(RepeatHandle repeatable){
  int calls=numFinishCalls.incrementAndGet();
  if (calls == 0) {
    numFinishCalls.set(-1);
    return;
  }
  repeatHandles[(calls - 1) % repeatHandles.length]=repeatable;
  if (calls < repeatHandles.length) {
    collectors.get(calls).doCollect();
  }
 else   if (calls % repeatHandles.length == 0) {
    downstream.finish(this);
  }
 else {
    repeatHandles[calls % repeatHandles.length].repeat();
  }
}
Program: 13161
Project: 13161
Buggy source:
@Override public void pauseProcessed(ResumeHandle resumeable){
  delegate.pauseProcessed(resumeable);
}

Fixed version (ground truth):
@Override public void pauseProcessed(ResumeHandle resumeable){
  downstream.pauseProcessed(resumeable);
}
Program: 13162
Project: 13162
Buggy source:
@Test public void testRepeatEmitsRowsInTheSameOrder() throws Exception {
  CollectingRowReceiver rr=new CollectingRowReceiver();
  Iterable<Row> leftRows=RowGenerator.range(0,15);
  Iterable<Row> rightRows=RowGenerator.range(10,30);
  CrateCollector.Builder c1=RowsCollector.builder(leftRows);
  CrateCollector.Builder c2=RowsCollector.builder(rightRows);
  CompositeCollector collector=new CompositeCollector(Arrays.asList(c1,c2),rr);
  collector.doCollect();
  Bucket result=rr.result();
  assertThat(TestingHelpers.printedTable(result),is("String_Node_Str"));
  rr.repeatUpstream();
  assertThat(TestingHelpers.printedTable(new CollectionBucket(rr.rows)),is("String_Node_Str" + "String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testRepeatEmitsRowsInTheSameOrder() throws Exception {
  CollectingRowReceiver rr=new CollectingRowReceiver();
  Iterable<Row> leftRows=RowGenerator.range(0,15);
  Iterable<Row> rightRows=RowGenerator.range(10,30);
  CrateCollector.Builder c1=RowsCollector.builder(leftRows);
  CrateCollector.Builder c2=RowsCollector.builder(rightRows);
  CompositeCollector collector=new CompositeCollector(Arrays.asList(c1,c2),rr);
  collector.doCollect();
  Bucket result=rr.result();
  String resultString=TestingHelpers.printedTable(result);
  assertThat(resultString,is("String_Node_Str"));
  rr.repeatUpstream();
  assertThat(TestingHelpers.printedTable(new CollectionBucket(rr.rows)),is(resultString + resultString));
  rr.repeatUpstream();
  assertThat(TestingHelpers.printedTable(new CollectionBucket(rr.rows)),is(resultString + resultString + resultString));
}
Program: 13163
Project: 13163
Buggy source:
@Override public void kill(Throwable throwable){
  resultFuture.setException(throwable);
}

Fixed version (ground truth):
@Override public void kill(Throwable throwable){
  if (throwable == null) {
    resultFuture().cancel(false);
  }
 else {
    resultFuture.setException(throwable);
  }
}
Program: 13164
Project: 13164
Buggy source:
private Result emitRow(Row row){
  combinedRow.outerRow=left.lastRow;
  combinedRow.innerRow=row;
  if (!rowFilterPredicate.apply(combinedRow)) {
    return Result.CONTINUE;
  }
  Result result=downstream.setNextRow(combinedRow);
  if (LOGGER.isTraceEnabled() && result != Result.CONTINUE) {
    LOGGER.trace("String_Node_Str",phaseId,result);
  }
  return result;
}

Fixed version (ground truth):
private Result emitRow(Row row){
  combinedRow.outerRow=left.lastRow;
  combinedRow.innerRow=row;
  if (!rowFilterPredicate.apply(combinedRow)) {
    return Result.CONTINUE;
  }
  Result result=downstream.setNextRow(combinedRow);
  if (LOGGER.isTraceEnabled() && result != Result.CONTINUE) {
    LOGGER.trace("String_Node_Str",phaseId,result);
  }
  if (result == Result.STOP) {
    stop=true;
  }
  return result;
}
Program: 13165
Project: 13165
Buggy source:
@Override public void onResponse(ShardResponse updateResponse){
  if (future.closed()) {
    return;
  }
  if (updateResponse.failure() != null) {
    onFailure(updateResponse.failure());
  }
  int location=updateResponse.itemIndices().get(0);
  ShardResponse.Failure failure=updateResponse.failures().get(location);
  if (failure == null) {
    resultFuture.set(1L);
  }
 else {
    if (logger.isDebugEnabled()) {
      if (failure.versionConflict()) {
        logger.debug("String_Node_Str",failure.id());
      }
 else {
        logger.debug("String_Node_Str",failure.id(),failure.message());
      }
    }
    resultFuture.set(0L);
  }
  close(null);
}

Fixed version (ground truth):
@Override public void onResponse(ShardResponse updateResponse){
  if (future.closed()) {
    return;
  }
  if (updateResponse.failure() != null) {
    onFailure(updateResponse.failure());
    return;
  }
  resultFuture.set(1L);
  close(null);
}
Program: 13166
Project: 13166
Buggy source:
@Override protected void innerStart(){
  transportShardUpsertActionDelegate.execute(request,new ActionListener<ShardResponse>(){
    @Override public void onResponse(    ShardResponse updateResponse){
      if (future.closed()) {
        return;
      }
      if (updateResponse.failure() != null) {
        onFailure(updateResponse.failure());
      }
      int location=updateResponse.itemIndices().get(0);
      ShardResponse.Failure failure=updateResponse.failures().get(location);
      if (failure == null) {
        resultFuture.set(1L);
      }
 else {
        if (logger.isDebugEnabled()) {
          if (failure.versionConflict()) {
            logger.debug("String_Node_Str",failure.id());
          }
 else {
            logger.debug("String_Node_Str",failure.id(),failure.message());
          }
        }
        resultFuture.set(0L);
      }
      close(null);
    }
    @Override public void onFailure(    Throwable e){
      if (future.closed()) {
        return;
      }
      e=ExceptionsHelper.unwrapCause(e);
      if (item.insertValues() == null && (e instanceof DocumentMissingException || e instanceof VersionConflictEngineException)) {
        resultFuture.set(0L);
        close(null);
      }
 else       if (PartitionName.isPartition(request.index()) && e instanceof IndexNotFoundException) {
        resultFuture.set(0L);
        close(null);
      }
 else {
        resultFuture.setException(e);
        close(e);
      }
    }
  }
);
}

Fixed version (ground truth):
@Override protected void innerStart(){
  transportShardUpsertActionDelegate.execute(request,new ActionListener<ShardResponse>(){
    @Override public void onResponse(    ShardResponse updateResponse){
      if (future.closed()) {
        return;
      }
      if (updateResponse.failure() != null) {
        onFailure(updateResponse.failure());
        return;
      }
      resultFuture.set(1L);
      close(null);
    }
    @Override public void onFailure(    Throwable e){
      if (future.closed()) {
        return;
      }
      e=ExceptionsHelper.unwrapCause(e);
      if (item.insertValues() == null && (e instanceof DocumentMissingException || e instanceof VersionConflictEngineException)) {
        resultFuture.set(0L);
        close(null);
      }
 else       if (PartitionName.isPartition(request.index()) && e instanceof IndexNotFoundException) {
        resultFuture.set(0L);
        close(null);
      }
 else {
        resultFuture.setException(e);
        close(e);
      }
    }
  }
);
}
Program: 13167
Project: 13167
Buggy source:
public UpsertByIdContext(int id,ShardUpsertRequest request,UpsertById.Item item,BulkRequestExecutor transportShardUpsertActionDelegate){
  super(id,LOGGER);
  this.request=request;
  this.item=item;
  this.transportShardUpsertActionDelegate=transportShardUpsertActionDelegate;
}

Fixed version (ground truth):
public UpsertByIdContext(int id,ShardUpsertRequest request,UpsertById.Item item,BulkRequestExecutor transportShardUpsertActionDelegate){
}
Program: 13168
Project: 13168
Buggy source:
@Before public void prepare(){
  idRef=new Reference(new ReferenceIdent(SysNodesTableInfo.IDENT,SysNodesTableInfo.Columns.ID),RowGranularity.DOC,DataTypes.STRING);
  nameRef=new Reference(new ReferenceIdent(SysNodesTableInfo.IDENT,SysNodesTableInfo.Columns.ID),RowGranularity.DOC,DataTypes.STRING);
  hostnameRef=new Reference(new ReferenceIdent(systable,SysNodesTableInfo.Columns.HOSTNAME),RowGranularity.DOC,DataTypes.STRING);
  collectPhase=mock(RoutedCollectPhase.class);
  when(collectPhase.whereClause()).thenReturn(WhereClause.NO_MATCH);
  nodes.add(newNode("String_Node_Str"));
  nodes.add(newNode("String_Node_Str"));
}

Fixed version (ground truth):
@Before public void prepare(){
  idRef=new Reference(new ReferenceIdent(SysNodesTableInfo.IDENT,SysNodesTableInfo.Columns.ID),RowGranularity.DOC,DataTypes.STRING);
  nameRef=new Reference(new ReferenceIdent(SysNodesTableInfo.IDENT,SysNodesTableInfo.Columns.ID),RowGranularity.DOC,DataTypes.STRING);
  hostnameRef=new Reference(new ReferenceIdent(SysNodesTableInfo.IDENT,SysNodesTableInfo.Columns.HOSTNAME),RowGranularity.DOC,DataTypes.STRING);
  collectPhase=mock(RoutedCollectPhase.class);
  when(collectPhase.whereClause()).thenReturn(WhereClause.NO_MATCH);
  nodes.add(newNode("String_Node_Str"));
  nodes.add(newNode("String_Node_Str"));
}
Program: 13169
Project: 13169
Buggy source:
public void sync(CompletionListener listener){
  LOGGER.debug("String_Node_Str");
switch (pendingExecutions.size()) {
case 0:
    listener.onSuccess(null);
  return;
case 1:
Portal portal=pendingExecutions.iterator().next();
pendingExecutions.clear();
portal.sync(planner,statsTables,listener);
clearState();
return;
}
throw new IllegalStateException("String_Node_Str" + pendingExecutions);
}

Fixed version (ground truth):
public void sync(CompletionListener listener){
  LOGGER.debug("String_Node_Str");
switch (pendingExecutions.size()) {
case 0:
    listener.onSuccess(null);
  return;
case 1:
Portal portal=pendingExecutions.iterator().next();
pendingExecutions.clear();
clearState();
portal.sync(planner,statsTables,listener);
if (UNNAMED.equals(portal.name())) {
portal.close();
}
return;
}
throw new IllegalStateException("String_Node_Str" + pendingExecutions);
}
Program: 13170
Project: 13170
Buggy source:
public void clearState(){
  Portal portal=portals.remove(UNNAMED);
  if (portal != null) {
    portal.close();
  }
  preparedStatements.remove(UNNAMED);
}

Fixed version (ground truth):
public void clearState(){
  portals.remove(UNNAMED);
  preparedStatements.remove(UNNAMED);
}
Program: 13171
Project: 13171
Buggy source:
@Override public void setNextRow(Row row){
  rowCount=(long)row.get(0);
}

Fixed version (ground truth):
@Override public void setNextRow(Row row){
  rowCount=(long)row.get(0);
  if (rowCount < 0) {
    rowCount--;
  }
}
Program: 13172
Project: 13172
Buggy source:
@Override public int writeAsBinary(ChannelBuffer buffer,@Nonnull Object value){
  buffer.writeInt(8);
  buffer.writeDouble(((double)value));
  return 12;
}

Fixed version (ground truth):
@Override public int writeAsBinary(ChannelBuffer buffer,@Nonnull Object value){
  buffer.writeInt(TYPE_LEN);
  buffer.writeDouble(((double)value));
  return INT32_BYTE_SIZE + TYPE_LEN;
}
Program: 13173
Project: 13173
Buggy source:
@Override public int writeAsBinary(ChannelBuffer buffer,@Nonnull Object value){
  buffer.writeInt(INT32_BYTE_SIZE);
  buffer.writeInt(((int)value));
  return 8;
}

Fixed version (ground truth):
@Override public int writeAsBinary(ChannelBuffer buffer,@Nonnull Object value){
  buffer.writeInt(TYPE_LEN);
  buffer.writeInt(((int)value));
  return INT32_BYTE_SIZE + TYPE_LEN;
}
Program: 13174
Project: 13174
Buggy source:
@Override public int writeAsBinary(ChannelBuffer buffer,@Nonnull Object value){
  buffer.writeInt(4);
  buffer.writeFloat(((float)value));
  return 8;
}

Fixed version (ground truth):
@Override public int writeAsBinary(ChannelBuffer buffer,@Nonnull Object value){
  buffer.writeInt(TYPE_LEN);
  buffer.writeFloat(((float)value));
  return INT32_BYTE_SIZE + TYPE_LEN;
}
Program: 13175
Project: 13175
Buggy source:
@Override public int writeAsBinary(ChannelBuffer buffer,@Nonnull Object value){
  buffer.writeInt(2);
  buffer.writeShort((short)value);
  return INT32_BYTE_SIZE + TYPE_LEN;
}

Fixed version (ground truth):
@Override public int writeAsBinary(ChannelBuffer buffer,@Nonnull Object value){
  buffer.writeInt(TYPE_LEN);
  buffer.writeShort((short)value);
  return INT32_BYTE_SIZE + TYPE_LEN;
}
Program: 13176
Project: 13176
Buggy source:
@Override protected Object decode(ChannelHandlerContext ctx,Channel channel,ChannelBuffer buffer) throws Exception {
switch (state) {
case STARTUP_HEADER:
    if (buffer.readableBytes() < 8) {
      return null;
    }
  msgLength=buffer.readInt() - 8;
if (msgLength == 0) {
  LOGGER.trace("String_Node_Str");
  state=State.SSL_NEG;
  return buffer;
}
LOGGER.trace("String_Node_Str",msgLength);
int protocol=buffer.readInt();
traceLogProtocol(protocol);
state=State.STARTUP_BODY;
return nullOrBuffer(buffer);
case MSG_HEADER:
if (buffer.readableBytes() < 5) {
return null;
}
msgType=buffer.readByte();
msgLength=buffer.readInt() - 4;
state=State.MSG_BODY;
return nullOrBuffer(buffer);
case MSG_BODY:
case STARTUP_BODY:
return nullOrBuffer(buffer);
}
throw new IllegalStateException("String_Node_Str" + state);
}

Fixed version (ground truth):
@Override protected Object decode(ChannelHandlerContext ctx,Channel channel,ChannelBuffer buffer) throws Exception {
switch (state) {
case STARTUP_HEADER:
    if (buffer.readableBytes() < 8) {
      return null;
    }
  buffer.markReaderIndex();
msgLength=buffer.readInt() - 8;
if (msgLength == 0) {
LOGGER.trace("String_Node_Str");
state=State.SSL_NEG;
return buffer;
}
LOGGER.trace("String_Node_Str",msgLength);
int protocol=buffer.readInt();
traceLogProtocol(protocol);
return nullOrBuffer(buffer,State.STARTUP_BODY);
case MSG_HEADER:
if (buffer.readableBytes() < 5) {
return null;
}
buffer.markReaderIndex();
msgType=buffer.readByte();
msgLength=buffer.readInt() - 4;
return nullOrBuffer(buffer,State.MSG_BODY);
case MSG_BODY:
case STARTUP_BODY:
return nullOrBuffer(buffer,state);
}
throw new IllegalStateException("String_Node_Str" + state);
}
Program: 13177
Project: 13177
Buggy source:
/** 
 * return null if there aren't enough bytes to read the whole message. Otherwise returns the buffer. If null is returned the decoder will be called again, otherwise the MessageHandler will be called next.
 */
private ChannelBuffer nullOrBuffer(ChannelBuffer buffer){
  if (buffer.readableBytes() < msgLength) {
    return null;
  }
  return buffer;
}

Fixed version (ground truth):
/** 
 * return null if there aren't enough bytes to read the whole message. Otherwise returns the buffer. If null is returned the decoder will be called again, otherwise the MessageHandler will be called next.
 */
private ChannelBuffer nullOrBuffer(ChannelBuffer buffer,State nextState){
  if (buffer.readableBytes() < msgLength) {
    buffer.resetReaderIndex();
    return null;
  }
  state=nextState;
  return buffer;
}
Program: 13178
Project: 13178
Buggy source:
public void parse(String statementName,String query,List<DataType> paramTypes){
  LOGGER.debug("String_Node_Str",statementName,query,paramTypes);
  try {
    this.jobId=UUID.randomUUID();
    this.query=query;
    this.statement=SqlParser.createStatement(query);
    this.paramTypes=paramTypes;
  }
 catch (  Throwable t) {
    throwable=t;
    throw t;
  }
}

Fixed version (ground truth):
public void parse(String statementName,String query,List<DataType> paramTypes){
  LOGGER.debug("String_Node_Str",statementName,query,paramTypes);
  checkError();
  try {
    this.jobId=UUID.randomUUID();
    this.query=query;
    this.statement=SqlParser.createStatement(query);
    this.paramTypes=paramTypes;
  }
 catch (  Throwable t) {
    throwable=t;
    throw t;
  }
}
Program: 13179
Project: 13179
Buggy source:
public void sync(CompletionListener listener){
  LOGGER.debug("String_Node_Str");
  if (throwable == null) {
    if (resultReceivers.isEmpty()) {
      throw new IllegalStateException("String_Node_Str");
    }
    if (resultReceivers.size() == 1) {
      execute(listener);
    }
 else {
      executeBulk(listener);
    }
  }
 else {
    Throwable t=this.throwable;
    this.throwable=null;
    throw Throwables.propagate(t);
  }
}

Fixed version (ground truth):
public void sync(CompletionListener listener){
  LOGGER.debug("String_Node_Str");
  if (throwable == null) {
    if (resultReceivers.size() == 1) {
      execute(listener);
    }
 else {
      executeBulk(listener);
    }
  }
 else {
    cleanup();
    Throwable t=this.throwable;
    this.throwable=null;
    throw Throwables.propagate(t);
  }
}
Program: 13180
Project: 13180
Buggy source:
public void bind(String portalName,String statementName,List<Object> params){
  LOGGER.debug("String_Node_Str",portalName,statementName,params);
  if (throwable != null) {
    return;
  }
  bulkParams.add(params);
}

Fixed version (ground truth):
public void bind(String portalName,String statementName,List<Object> params){
  LOGGER.debug("String_Node_Str",portalName,statementName,params);
  checkError();
  bulkParams.add(params);
}
Program: 13181
Project: 13181
Buggy source:
private void cleanup(){
  analysis=null;
  bulkParams.clear();
  resultReceivers.clear();
  statement=null;
}

Fixed version (ground truth):
private void cleanup(){
  analysis=null;
  bulkParams.clear();
  maxRows=0;
  resultReceivers.clear();
  statement=null;
}
Program: 13182
Project: 13182
Buggy source:
public List<Field> describe(char type,String portalOrStatement){
  LOGGER.debug("String_Node_Str",type,portalOrStatement);
  if (throwable != null) {
    return null;
  }
  if (analysis == null) {
    if (statement == null) {
      throwable=new IllegalStateException("String_Node_Str");
      throw (RuntimeException)throwable;
    }
    analysis=analyzer.analyze(statement,new ParameterContext(getArgs(),EMPTY_BULK_ARGS,defaultSchema));
  }
  if (analysis.rootRelation() == null) {
    return null;
  }
  List<Field> fields=analysis.rootRelation().fields();
  outputTypes=Symbols.extractTypes(fields);
  return fields;
}

Fixed version (ground truth):
public List<Field> describe(char type,String portalOrStatement){
  LOGGER.debug("String_Node_Str",type,portalOrStatement);
  checkError();
  try {
    if (analysis == null) {
      analysis=analyzer.analyze(statement,new ParameterContext(getArgs(),EMPTY_BULK_ARGS,defaultSchema));
    }
    if (analysis.rootRelation() == null) {
      return null;
    }
    List<Field> fields=analysis.rootRelation().fields();
    outputTypes=Symbols.extractTypes(fields);
    return fields;
  }
 catch (  Throwable t) {
    throwable=t;
    throw t;
  }
}
Program: 13183
Project: 13183
Buggy source:
@Test public void testCustomSchemaAndAnalyzerFailure() throws Exception {
  try (Connection conn=DriverManager.getConnection(JDBC_POSTGRESQL_URL + "String_Node_Str")){
    conn.setAutoCommit(true);
    PreparedStatement stmt=conn.prepareStatement("String_Node_Str");
    expectedException.expect(PSQLException.class);
    expectedException.expectMessage("String_Node_Str");
    stmt.executeQuery();
    stmt=conn.prepareStatement("String_Node_Str");
    ResultSet resultSet=stmt.executeQuery();
    assertThat(resultSet.next(),is(true));
    assertThat(resultSet.getString(1),Matchers.startsWith("String_Node_Str"));
  }
 }

Fixed version (ground truth):
@Test public void testCustomSchemaAndAnalyzerFailure() throws Exception {
  try (Connection conn=DriverManager.getConnection(JDBC_POSTGRESQL_URL + "String_Node_Str")){
    conn.setAutoCommit(true);
    PreparedStatement stmt=conn.prepareStatement("String_Node_Str");
    try {
      stmt.executeQuery();
      assertFalse(true);
    }
 catch (    PSQLException e) {
      assertThat(e.getMessage(),Matchers.containsString("String_Node_Str"));
    }
    assertSelectNameFromSysClusterWorks(conn);
  }
 }
Program: 13184
Project: 13184
Buggy source:
private void addChildImplementations(){
  childImplementations.put(DEV,new ChildExpression<BytesRef>(){
    @Override public BytesRef value(){
      return fsInfo.dev();
    }
  }
);
  childImplementations.put(SIZE,new ChildExpression<Long>(){
    @Override public Long value(){
      return fsInfo.total() * 1024;
    }
  }
);
  childImplementations.put(USED,new ChildExpression<Long>(){
    @Override public Long value(){
      return fsInfo.used() * 1024;
    }
  }
);
  childImplementations.put(AVAILABLE,new ChildExpression<Long>(){
    @Override public Long value(){
      return fsInfo.available() * 1024;
    }
  }
);
  childImplementations.put(READS,new ChildExpression<Long>(){
    @Override public Long value(){
      return fsInfo.diskReads();
    }
  }
);
  childImplementations.put(BYTES_READ,new ChildExpression<Long>(){
    @Override public Long value(){
      return fsInfo.diskReadSizeInBytes();
    }
  }
);
  childImplementations.put(WRITES,new ChildExpression<Long>(){
    @Override public Long value(){
      return fsInfo.diskWrites();
    }
  }
);
  childImplementations.put(BYTES_WRITTEN,new ChildExpression<Long>(){
    @Override public Long value(){
      return fsInfo.diskWriteSizeInBytes();
    }
  }
);
}

Fixed version (ground truth):
private void addChildImplementations(){
  childImplementations.put(DEV,new ChildExpression<BytesRef>(){
    @Override public BytesRef value(){
      return fsInfo.dev();
    }
  }
);
  childImplementations.put(SIZE,new ChildExpression<Long>(){
    @Override public Long value(){
      return fsInfo.total();
    }
  }
);
  childImplementations.put(USED,new ChildExpression<Long>(){
    @Override public Long value(){
      return fsInfo.used();
    }
  }
);
  childImplementations.put(AVAILABLE,new ChildExpression<Long>(){
    @Override public Long value(){
      return fsInfo.available();
    }
  }
);
  childImplementations.put(READS,new ChildExpression<Long>(){
    @Override public Long value(){
      return fsInfo.diskReads();
    }
  }
);
  childImplementations.put(BYTES_READ,new ChildExpression<Long>(){
    @Override public Long value(){
      return fsInfo.diskReadSizeInBytes();
    }
  }
);
  childImplementations.put(WRITES,new ChildExpression<Long>(){
    @Override public Long value(){
      return fsInfo.diskWrites();
    }
  }
);
  childImplementations.put(BYTES_WRITTEN,new ChildExpression<Long>(){
    @Override public Long value(){
      return fsInfo.diskWriteSizeInBytes();
    }
  }
);
}
Program: 13187
Project: 13187
Buggy source:
private void assertGotCancelled(final String statement,@Nullable final Object[] params,boolean killAll) throws Exception {
  final ExecutorService executor=Executors.newSingleThreadExecutor();
  final AtomicReference<Throwable> thrown=new AtomicReference<>();
  try {
    executor.submit(new Runnable(){
      @Override public void run(){
        try {
          execute(statement,params);
        }
 catch (        Throwable e) {
          Throwable unwrapped=Exceptions.unwrap(e);
          thrown.compareAndSet(null,unwrapped);
        }
      }
    }
);
    Thread.sleep(100L);
    if (killAll) {
      execute("String_Node_Str");
    }
 else {
      SQLResponse logResponse=execute("String_Node_Str",new Object[]{statement});
      String jobId=logResponse.rows()[0][0].toString();
      execute("String_Node_Str",new Object[]{jobId});
    }
    executor.shutdown();
    executor.awaitTermination(5L,TimeUnit.SECONDS);
    Throwable exception=thrown.get();
    if (exception != null) {
      assertThat(exception,instanceOf(SQLActionException.class));
      assertThat(((SQLActionException)exception).stackTrace(),anyOf(containsString("String_Node_Str"),containsString("String_Node_Str"),containsString("String_Node_Str")));
    }
  }
  finally {
    executor.shutdownNow();
  }
}

Fixed version (ground truth):
private void assertGotCancelled(final String statement,@Nullable final Object[] params,boolean killAll) throws Exception {
  final ExecutorService executor=Executors.newSingleThreadExecutor();
  final AtomicReference<Throwable> thrown=new AtomicReference<>();
  try {
    executor.submit(new Runnable(){
      @Override public void run(){
        try {
          execute(statement,params);
        }
 catch (        Throwable e) {
          Throwable unwrapped=Exceptions.unwrap(e);
          thrown.compareAndSet(null,unwrapped);
        }
      }
    }
);
    Thread.sleep(100L);
    if (killAll) {
      execute("String_Node_Str");
    }
 else {
      SQLResponse logResponse=execute("String_Node_Str",new Object[]{statement});
      String jobId=logResponse.rows()[0][0].toString();
      execute("String_Node_Str",new Object[]{jobId});
    }
    executor.shutdown();
    executor.awaitTermination(5L,TimeUnit.SECONDS);
    Throwable exception=thrown.get();
    if (exception != null) {
      assertThat(exception,instanceOf(SQLActionException.class));
      assertThat(((SQLActionException)exception).stackTrace(),anyOf(containsString("String_Node_Str"),containsString("String_Node_Str"),containsString("String_Node_Str")));
    }
  }
  finally {
    executor.shutdownNow();
    waitUntilThreadPoolTasksFinished(ThreadPool.Names.SEARCH);
  }
}
Program: 13188
Project: 13188
Buggy source:
@Override public void collect(int doc) throws IOException {
  topRowUpstream.throwIfKilled();
  checkCircuitBreaker();
  rowCount++;
  if (rowCount % KEEP_ALIVE_AFTER_ROWS == 0) {
    keepAliveListener.keepAlive();
  }
  for (  LuceneCollectorExpression<?> expression : expressions) {
    expression.setNextDocId(doc);
  }
  boolean wantMore=rowReceiver.setNextRow(inputRow);
  if (!wantMore) {
    throw CollectionFinishedEarlyException.INSTANCE;
  }
  if (topRowUpstream.shouldPause()) {
    throw CollectionPauseException.INSTANCE;
  }
}

Fixed version (ground truth):
@Override public void collect(int doc) throws IOException {
  topRowUpstream.throwIfKilled();
  checkCircuitBreaker();
  rowCount++;
  if (rowCount % KEEP_ALIVE_AFTER_ROWS == 0) {
    keepAliveListener.keepAlive();
  }
  for (  LuceneCollectorExpression<?> expression : expressions) {
    expression.setNextDocId(doc);
  }
  boolean wantMore=rowReceiver.setNextRow(inputRow);
  if (topRowUpstream.shouldPause()) {
    throw CollectionPauseException.INSTANCE;
  }
  if (!wantMore) {
    throw CollectionFinishedEarlyException.INSTANCE;
  }
}
Program: 13189
Project: 13189
Buggy source:
boolean resume(State rightState){
  if (lastRow != null) {
    boolean wantMore=emitRow(lastRow);
    if (!wantMore) {
      LOGGER.trace("String_Node_Str");
      return false;
    }
    lastRow=null;
  }
  if (rightState == State.FINISHED) {
    if (receivedRows) {
      LOGGER.trace("String_Node_Str");
      upstream.repeat();
    }
 else {
      LOGGER.trace("String_Node_Str");
      return false;
    }
  }
 else {
    LOGGER.trace("String_Node_Str",upstream);
    upstream.resume(false);
  }
  return true;
}

Fixed version (ground truth):
boolean resume(State rightState){
  if (lastRow != null) {
    boolean wantMore=emitRow(lastRow);
    if (!wantMore) {
      LOGGER.trace("String_Node_Str");
      upstream.resume(false);
      return false;
    }
    lastRow=null;
  }
  if (rightState == State.FINISHED) {
    if (receivedRows) {
      LOGGER.trace("String_Node_Str");
      upstream.repeat();
    }
 else {
      LOGGER.trace("String_Node_Str");
      return false;
    }
  }
 else {
    LOGGER.trace("String_Node_Str",upstream);
    upstream.resume(false);
  }
  return true;
}
Program: 13190
Project: 13190
Buggy source:
public BlockingSortingQueuedRowDownstreamHandle(BlockingSortingQueuedRowDownstream projector,int rowSize){
  this.projector=projector;
  this.row=new RowN(rowSize);
  this.hashCode=hashCode();
}

Fixed version (ground truth):
public BlockingSortingQueuedRowDownstreamHandle(int index,BlockingSortingQueuedRowDownstream projector,int rowSize){
  this.index=index;
  this.projector=projector;
  this.row=new RowN(rowSize);
}
Program: 13191
Project: 13191
Buggy source:
public void upstreamFinished(){
  int stillRunning=runningHandles.decrementAndGet();
  int remaining=remainingUpstreams.decrementAndGet();
  emit();
  LOGGER.trace("String_Node_Str",hashCode,remaining,stillRunning);
  if (remaining == 0) {
    LOGGER.trace("String_Node_Str",hashCode);
    downstreamRowReceiver.finish();
  }
}

Fixed version (ground truth):
public void upstreamFinished(){
  runningHandles.decrementAndGet();
  int remaining=remainingUpstreams.decrementAndGet();
  if (!emit()) {
    for (    BlockingSortingQueuedRowDownstreamHandle handle : downstreamHandles) {
      if (!handle.isFinished()) {
        handle.resume();
      }
    }
  }
  if (remaining == 0) {
    LOGGER.trace("String_Node_Str",pauseCount,pauseCount / (double)downstreamHandles.size());
    downstreamRowReceiver.finish();
  }
}
Program: 13192
Project: 13192
Buggy source:
@Override public RowReceiver newRowReceiver(){
  int upstreams=remainingUpstreams.incrementAndGet();
  LOGGER.trace("String_Node_Str",hashCode,upstreams);
  runningHandles.incrementAndGet();
  BlockingSortingQueuedRowDownstreamHandle handle=new BlockingSortingQueuedRowDownstreamHandle(this,rowSize);
  downstreamHandles.add(handle);
  return handle;
}

Fixed version (ground truth):
@Override public RowReceiver newRowReceiver(){
  remainingUpstreams.incrementAndGet();
  int handleIdx=runningHandles.getAndIncrement();
  BlockingSortingQueuedRowDownstreamHandle handle=new BlockingSortingQueuedRowDownstreamHandle(handleIdx,this,rowSize);
  downstreamHandles.add(handle);
  return handle;
}
Program: 13193
Project: 13193
Buggy source:
public Object[] poll(){
synchronized (lock) {
    Object[] cells=cellsQueue.poll();
    firstCells=cellsQueue.peekFirst();
    return cells;
  }
}

Fixed version (ground truth):
public Object[] poll(){
  Object[] cells=cellsQueue.poll();
  firstCells=cellsQueue.peekFirst();
  return cells;
}
Program: 13194
Project: 13194
Buggy source:
@Override public void setUpstream(RowUpstream rowUpstream){
  upstreams.add(rowUpstream);
}

Fixed version (ground truth):
@Override public void setUpstream(RowUpstream rowUpstream){
  this.myUpstream=rowUpstream;
  upstreams.add(rowUpstream);
}
Program: 13195
Project: 13195
Buggy source:
@Nullable public Object[] firstCells(){
  return firstCells;
}

Fixed version (ground truth):
@Nullable public Object[] firstCells(){
synchronized (lock) {
    return firstCells;
  }
}
Program: 13196
Project: 13196
Buggy source:
@Override public void finish(){
  if (finished.compareAndSet(false,true)) {
    projector.upstreamFinished();
    LOGGER.trace("String_Node_Str",projector.hashCode,hashCode,pauseCount);
  }
}

Fixed version (ground truth):
@Override public void finish(){
  if (finished.compareAndSet(false,true)) {
    projector.upstreamFinished();
  }
}
Program: 13197
Project: 13197
Buggy source:
public void upstreamFailed(Throwable throwable){
  runningHandles.decrementAndGet();
  downstreamAborted.compareAndSet(false,true);
  int remaining=remainingUpstreams.decrementAndGet();
  LOGGER.trace("String_Node_Str",throwable,hashCode,remaining);
  if (remaining == 0) {
    downstreamRowReceiver.fail(throwable);
  }
}

Fixed version (ground truth):
public void upstreamFailed(Throwable throwable){
  runningHandles.decrementAndGet();
  downstreamAborted.compareAndSet(false,true);
  int remaining=remainingUpstreams.decrementAndGet();
  if (remaining == 0) {
    downstreamRowReceiver.fail(throwable);
  }
}
Program: 13198
Project: 13198
Buggy source:
private void resume(){
synchronized (pauseLock) {
    runningHandles.incrementAndGet();
    if (!pendingPause.getAndSet(false)) {
      paused=false;
      pauseLock.notify();
    }
  }
}

Fixed version (ground truth):
private void resume(){
synchronized (pauseLock) {
    if (!pendingPause.getAndSet(false)) {
      paused=false;
      if (collectorPaused.compareAndSet(true,false)) {
        resumeCollector();
      }
 else {
        resumeThread();
      }
    }
  }
}
Program: 13199
Project: 13199
Buggy source:
public boolean emitUntil(Object[] until){
  boolean res=true;
synchronized (lock) {
    while (firstCells != null && ordering.compare(firstCells,until) >= 0) {
      Object[] cells=poll();
      row.cells(cells);
      boolean wantMore=downstreamRowReceiver.setNextRow(row);
      pool.checkin(cells);
      if (!wantMore) {
        res=false;
        break;
      }
    }
    int size=cellsQueue.size();
    int running=runningHandles.get();
    if (paused && (size <= RESUME_AFTER || (size < MAX_QUEUE_SIZE && running <= 1))) {
      resume();
    }
  }
  return res;
}

Fixed version (ground truth):
public boolean emitUntil(Object[] until){
  boolean res=true;
synchronized (lock) {
    while (firstCells != null && ordering.compare(firstCells,until) >= 0) {
      Object[] cells=poll();
      row.cells(cells);
      boolean wantMore=downstreamRowReceiver.setNextRow(row);
      pool.checkin(cells);
      if (!wantMore) {
        res=false;
        break;
      }
    }
    int size=cellsQueue.size();
    int running=runningHandles.get();
    if (paused && (size <= RESUME_AFTER || (size < MAX_QUEUE_SIZE && running == 1))) {
      resume();
    }
  }
  return res;
}
Program: 13200
Project: 13200
Buggy source:
private void pause(){
synchronized (pauseLock) {
    if (pendingPause.compareAndSet(true,false)) {
      pauseCount++;
      try {
        pauseLock.wait();
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
    }
  }
}

Fixed version (ground truth):
@Override public void pause(){
  for (  RowUpstream upstream : upstreams) {
    upstream.pause();
  }
}
Program: 13201
Project: 13201
Buggy source:
@Override public boolean setNextRow(Row row){
  if (projector.downstreamAborted.get()) {
    return false;
  }
  int size;
synchronized (lock) {
    Object[] cells=addCellsToQueue(row);
    size=cellsQueue.size();
    if (firstCells == null) {
      firstCells=cells;
    }
    if (!paused && size == MAX_QUEUE_SIZE) {
      paused=true;
      pendingPause.set(true);
      runningHandles.decrementAndGet();
    }
  }
  if (paused) {
    pause();
  }
  return size != 1 || projector.emit();
}

Fixed version (ground truth):
@Override public boolean setNextRow(Row row){
  started=true;
  if (projector.downstreamAborted.get()) {
    return false;
  }
  int size;
synchronized (lock) {
    Object[] cells=addCellsToQueue(row);
    size=cellsQueue.size();
    if (firstCells == null) {
      firstCells=cells;
    }
    if (!paused && size == MAX_QUEUE_SIZE) {
      paused=true;
      pendingPause.set(true);
    }
  }
  if (paused) {
    if (projector.anyOtherNotStartedYet(index)) {
      pauseCollector();
      return !projector.downstreamAborted.get();
    }
 else {
      pauseThread();
    }
  }
  return size != 1 || projector.emit();
}
Program: 13202
Project: 13202
Buggy source:
public synchronized boolean emit(){
  do {
    Object[] currentLowest=lowestToEmit.get();
    Object[] nextLowest=null;
    boolean emptyHandle=false;
    for (    BlockingSortingQueuedRowDownstreamHandle handle : downstreamHandles) {
      if (currentLowest != null && !handle.emitUntil(currentLowest)) {
        downstreamAborted.set(true);
        return false;
      }
      Object[] cells=handle.firstCells();
      if (cells == null) {
        if (!handle.isFinished()) {
          emptyHandle=true;
        }
        continue;
      }
      if (nextLowest == null || ordering.compare(cells,nextLowest) > 0) {
        nextLowest=cells;
      }
    }
    if (emptyHandle) {
      break;
    }
 else {
      lowestToEmit.set(nextLowest);
    }
  }
 while (lowestToEmit.isValid());
  return true;
}

Fixed version (ground truth):
public boolean emit(){
  do {
    Object[] currentLowest=lowestToEmit.get();
    Object[] nextLowest=null;
    boolean emptyHandle=false;
    for (    BlockingSortingQueuedRowDownstreamHandle handle : downstreamHandles) {
      if (currentLowest != null && !handle.emitUntil(currentLowest)) {
        downstreamAborted.set(true);
        return false;
      }
      Object[] cells=handle.firstCells();
      if (cells == null) {
        if (!handle.isFinished()) {
          emptyHandle=true;
          break;
        }
        continue;
      }
      if (nextLowest == null || ordering.compare(cells,nextLowest) > 0) {
        nextLowest=cells;
      }
    }
    if (emptyHandle) {
      break;
    }
 else {
      lowestToEmit.set(nextLowest);
    }
  }
 while (lowestToEmit.isValid());
  return true;
}
Program: 13203
Project: 13203
Buggy source:
@Override public boolean offer(E e){
  return false;
}

Fixed version (ground truth):
@Override public boolean offer(E e,long timeout,TimeUnit unit) throws InterruptedException {
  return false;
}
Program: 13204
Project: 13204
Buggy source:
private void setOperationsLog(int size){
  if (size == 0) {
    operationsLog.set(NOOP_OPERATIONS_LOG);
  }
 else {
    Queue<OperationContextLog> oldQ=operationsLog.get();
    EvictingQueue<OperationContextLog> newQ=EvictingQueue.create(size);
    newQ.addAll(oldQ);
    operationsLog.set(newQ);
  }
}

Fixed version (ground truth):
private void setOperationsLog(int size){
  if (size == 0) {
    operationsLog.set(NOOP_OPERATIONS_LOG);
  }
 else {
    Queue<OperationContextLog> oldQ=operationsLog.get();
    BlockingEvictingQueue<OperationContextLog> newQ=new BlockingEvictingQueue<>(size);
    newQ.addAll(oldQ);
    operationsLog.set(newQ);
  }
}
Program: 13205
Project: 13205
Buggy source:
private void setJobsLog(int size){
  if (size == 0) {
    jobsLog.set(NOOP_JOBS_LOG);
  }
 else {
    Queue<JobContextLog> oldQ=jobsLog.get();
    EvictingQueue<JobContextLog> newQ=EvictingQueue.create(size);
    newQ.addAll(oldQ);
    jobsLog.set(newQ);
  }
}

Fixed version (ground truth):
private void setJobsLog(int size){
  if (size == 0) {
    jobsLog.set(NOOP_JOBS_LOG);
  }
 else {
    Queue<JobContextLog> oldQ=jobsLog.get();
    BlockingEvictingQueue<JobContextLog> newQ=new BlockingEvictingQueue<>(size);
    newQ.addAll(oldQ);
    jobsLog.set(newQ);
  }
}
Program: 13206
Project: 13206
Buggy source:
@Test public void testSettingsChanges(){
  NodeSettingsService nodeSettingsService=new NodeSettingsService(ImmutableSettings.EMPTY);
  StatsTables stats=new StatsTables(ImmutableSettings.EMPTY,nodeSettingsService);
  assertThat(stats.isEnabled(),is(false));
  assertThat(stats.lastJobsLogSize,is(CrateSettings.STATS_JOBS_LOG_SIZE.defaultValue()));
  assertThat(stats.lastOperationsLogSize,is(CrateSettings.STATS_OPERATIONS_LOG_SIZE.defaultValue()));
  assertThat(stats.jobsLog.get(),Matchers.instanceOf(NoopQueue.class));
  stats.listener.onRefreshSettings(ImmutableSettings.builder().put(CrateSettings.STATS_ENABLED.settingName(),true).put(CrateSettings.STATS_OPERATIONS_LOG_SIZE.settingName(),200).build());
  assertThat(stats.isEnabled(),is(true));
  assertThat(stats.lastJobsLogSize,is(CrateSettings.STATS_JOBS_LOG_SIZE.defaultValue()));
  assertThat(stats.lastOperationsLogSize,is(200));
  assertThat(stats.jobsLog.get(),Matchers.instanceOf(EvictingQueue.class));
  stats.listener.onRefreshSettings(ImmutableSettings.builder().put(CrateSettings.STATS_ENABLED.settingName(),false).build());
  assertThat(stats.jobsLog.get(),Matchers.instanceOf(NoopQueue.class));
  assertThat(stats.isEnabled(),is(false));
}

Fixed version (ground truth):
@Test public void testSettingsChanges(){
  NodeSettingsService nodeSettingsService=new NodeSettingsService(ImmutableSettings.EMPTY);
  StatsTables stats=new StatsTables(ImmutableSettings.EMPTY,nodeSettingsService);
  assertThat(stats.isEnabled(),is(false));
  assertThat(stats.lastJobsLogSize,is(CrateSettings.STATS_JOBS_LOG_SIZE.defaultValue()));
  assertThat(stats.lastOperationsLogSize,is(CrateSettings.STATS_OPERATIONS_LOG_SIZE.defaultValue()));
  assertThat(stats.jobsLog.get(),Matchers.instanceOf(NoopQueue.class));
  stats.listener.onRefreshSettings(ImmutableSettings.builder().put(CrateSettings.STATS_ENABLED.settingName(),true).put(CrateSettings.STATS_OPERATIONS_LOG_SIZE.settingName(),200).build());
  assertThat(stats.isEnabled(),is(true));
  assertThat(stats.lastJobsLogSize,is(CrateSettings.STATS_JOBS_LOG_SIZE.defaultValue()));
  assertThat(stats.lastOperationsLogSize,is(200));
  assertThat(stats.jobsLog.get(),Matchers.instanceOf(BlockingEvictingQueue.class));
  stats.listener.onRefreshSettings(ImmutableSettings.builder().put(CrateSettings.STATS_ENABLED.settingName(),false).build());
  assertThat(stats.jobsLog.get(),Matchers.instanceOf(NoopQueue.class));
  assertThat(stats.isEnabled(),is(false));
}
Program: 13207
Project: 13207
Buggy source:
static public boolean isValid(BytesRef ip){
  if (ip.length < 7) {
    return false;
  }
  boolean firstSymbolInOctet=true;
  boolean firstSymbolInOctetHigherThenTwo=false;
  boolean precededByZero=false;
  short symbolsInOctet=0;
  short numberOfDots=0;
  for (int i=0; i < ip.length; i++) {
    int sym=ip.bytes[i] & 0xff;
    if (sym < 46 || sym > 57 || sym == 47) {
      return false;
    }
    if (firstSymbolInOctet && (sym >= 48 && sym < 58)) {
      firstSymbolInOctet=false;
      symbolsInOctet++;
      if (sym == 48) {
        precededByZero=true;
      }
      if (sym > 50) {
        firstSymbolInOctetHigherThenTwo=true;
      }
    }
 else     if ((sym == 48 && precededByZero) || symbolsInOctet > 3) {
      return false;
    }
 else     if (sym == 46) {
      if (symbolsInOctet > 2 && firstSymbolInOctetHigherThenTwo) {
        return false;
      }
      firstSymbolInOctet=true;
      numberOfDots++;
      symbolsInOctet=0;
      firstSymbolInOctetHigherThenTwo=false;
      precededByZero=false;
      if (numberOfDots > 3) {
        return false;
      }
    }
 else     if (sym >= 48 && sym < 58 && symbolsInOctet < 3 && !precededByZero) {
      symbolsInOctet++;
    }
 else {
      return false;
    }
    if (symbolsInOctet > 2 && firstSymbolInOctetHigherThenTwo) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
static public boolean isValid(BytesRef ip){
  if (ip.length < 7 && ip.length > 15) {
    return false;
  }
  boolean precededByZero=false;
  short symbolsInOctet=0;
  short numberOfDots=0;
  int segmentValue=0;
  for (int i=0; i < ip.length; i++) {
    int sym=ip.bytes[i] & 0xff;
    if (sym < 46 || sym > 57 || sym == 47) {
      return false;
    }
    if (isDigit(sym) && symbolsInOctet < 3 && !precededByZero) {
      precededByZero=(sym == 48 && symbolsInOctet == 0);
      segmentValue=segmentValue * 10 + (sym - '0');
      symbolsInOctet++;
    }
 else     if (sym == 46 && i < ip.length - 1) {
      numberOfDots++;
      if (numberOfDots > 3) {
        return false;
      }
      segmentValue=0;
      symbolsInOctet=0;
      precededByZero=false;
    }
 else {
      return false;
    }
    if (segmentValue > 255) {
      return false;
    }
  }
  return numberOfDots == 3;
}
Program: 13208
Project: 13208
Buggy source:
@Test public void testValidation() throws Exception {
  BytesRef[] validIps={new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str")};
  for (  BytesRef ip : validIps) {
    assertEquals(true,IpType.isValid(ip));
  }
  BytesRef[] invalidIps={new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str")};
  for (  BytesRef ip : invalidIps) {
    assertEquals(false,IpType.isValid(ip));
  }
}

Fixed version (ground truth):
@Test public void testValidation() throws Exception {
  BytesRef[] validIps={new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str")};
  for (  BytesRef ip : validIps) {
    assertEquals(true,IpType.isValid(ip));
  }
  BytesRef[] invalidIps={new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str"),new BytesRef("String_Node_Str")};
  for (  BytesRef ip : invalidIps) {
    assertEquals(false,IpType.isValid(ip));
  }
}
Program: 13209
Project: 13209
Buggy source:
public static <K,V>int compareMaps(Map<K,V> m1,Map<K,V> m2){
  Preconditions.checkNotNull(m1,"String_Node_Str");
  Preconditions.checkNotNull(m2,"String_Node_Str");
  int sizeCompare=Integer.valueOf(m1.size()).compareTo(m2.size());
  if (sizeCompare != 0)   return sizeCompare;
  for (  K key : m1.keySet()) {
    if (!m1.get(key).equals(m2.get(key)))     return 1;
  }
  return 0;
}

Fixed version (ground truth):
public static <K,V>int compareMaps(Map<K,V> m1,Map<K,V> m2){
  Preconditions.checkNotNull(m1,"String_Node_Str");
  Preconditions.checkNotNull(m2,"String_Node_Str");
  int sizeCompare=Integer.valueOf(m1.size()).compareTo(m2.size());
  if (sizeCompare != 0)   return sizeCompare;
  for (  Map.Entry<K,V> entry : m1.entrySet()) {
    if (!entry.getValue().equals(m2.get(entry.getKey()))) {
      return 1;
    }
  }
  return 0;
}
Program: 13210
Project: 13210
Buggy source:
public static Literal fromObject(Object value){
  Literal literal=null;
  if (value == null) {
    literal=new NullLiteral();
  }
 else   if (value instanceof String) {
    literal=new StringLiteral((String)value);
  }
 else   if (value instanceof Number) {
    if (value instanceof Float || value instanceof Double) {
      literal=new DoubleLiteral(value.toString());
    }
 else     if (value instanceof Short || value instanceof Integer || value instanceof Long) {
      literal=new LongLiteral(value.toString());
    }
  }
 else   if (value instanceof Boolean) {
    literal=new BooleanLiteral(value.toString());
  }
 else   if (value instanceof Object[]) {
    List<Expression> expressions=new ArrayList<>();
    for (    Object o : (Object[])value) {
      expressions.add(fromObject(o));
    }
    literal=new ArrayLiteral(expressions);
  }
 else   if (value instanceof Map) {
    Multimap<String,Expression> map=HashMultimap.create();
    @SuppressWarnings("String_Node_Str") Map<String,Object> valueMap=(Map<String,Object>)value;
    for (    String key : valueMap.keySet()) {
      map.put(key,fromObject(valueMap.get(key)));
    }
    literal=new ObjectLiteral(map);
  }
  return literal;
}

Fixed version (ground truth):
public static Literal fromObject(Object value){
  Literal literal=null;
  if (value == null) {
    literal=new NullLiteral();
  }
 else   if (value instanceof String) {
    literal=new StringLiteral((String)value);
  }
 else   if (value instanceof Number) {
    if (value instanceof Float || value instanceof Double) {
      literal=new DoubleLiteral(value.toString());
    }
 else     if (value instanceof Short || value instanceof Integer || value instanceof Long) {
      literal=new LongLiteral(value.toString());
    }
  }
 else   if (value instanceof Boolean) {
    literal=new BooleanLiteral(value.toString());
  }
 else   if (value instanceof Object[]) {
    List<Expression> expressions=new ArrayList<>();
    for (    Object o : (Object[])value) {
      expressions.add(fromObject(o));
    }
    literal=new ArrayLiteral(expressions);
  }
 else   if (value instanceof Map) {
    Multimap<String,Expression> map=HashMultimap.create();
    @SuppressWarnings("String_Node_Str") Map<String,Object> valueMap=(Map<String,Object>)value;
    for (    Map.Entry<String,Object> entry : valueMap.entrySet()) {
      map.put(entry.getKey(),fromObject(entry.getValue()));
    }
    literal=new ObjectLiteral(map);
  }
  return literal;
}