nus-yam/ex-repair huggingface dataset:
Program: 6512
Project: 6512
Buggy source:
@Override public void removeTags(Id.NamespacedId entityId,String... tags) throws NotFoundException {
  ensureEntityExists(entityId);
  businessMds.removeTags(entityId,tags);
}

Fixed version (ground truth):
@Override public void removeTags(Id.NamespacedId entityId,String... tags) throws NotFoundException {
  entityValidator.ensureEntityExists(entityId);
  businessMds.removeTags(entityId,tags);
}
Program: 6513
Project: 6513
Buggy source:
@Override public Set<String> getTags(Id.NamespacedId entityId) throws NotFoundException {
  ensureEntityExists(entityId);
  return businessMds.getTags(entityId);
}

Fixed version (ground truth):
@Override public Set<String> getTags(Id.NamespacedId entityId) throws NotFoundException {
  entityValidator.ensureEntityExists(entityId);
  return businessMds.getTags(entityId);
}
Program: 6514
Project: 6514
Buggy source:
@Override public void addProperties(Id.NamespacedId entityId,Map<String,String> properties) throws NotFoundException, InvalidMetadataException {
  ensureEntityExists(entityId);
  validateProperties(entityId,properties);
  businessMds.setProperties(entityId,properties);
}

Fixed version (ground truth):
@Override public void addProperties(Id.NamespacedId entityId,Map<String,String> properties) throws NotFoundException, InvalidMetadataException {
  entityValidator.ensureEntityExists(entityId);
  validateProperties(entityId,properties);
  businessMds.setProperties(entityId,properties);
}
Program: 6515
Project: 6515
Buggy source:
@Override public void addTags(Id.NamespacedId entityId,String... tags) throws NotFoundException, InvalidMetadataException {
  ensureEntityExists(entityId);
  validateTags(entityId,tags);
  businessMds.addTags(entityId,tags);
}

Fixed version (ground truth):
@Override public void addTags(Id.NamespacedId entityId,String... tags) throws NotFoundException, InvalidMetadataException {
  entityValidator.ensureEntityExists(entityId);
  validateTags(entityId,tags);
  businessMds.addTags(entityId,tags);
}
Program: 6516
Project: 6516
Buggy source:
@Inject DefaultMetadataAdmin(AbstractNamespaceClient namespaceClient,BusinessMetadataStore businessMds,CConfiguration cConf,Store store,DatasetFramework datasetFramework,StreamAdmin streamAdmin){
  this.namespaceClient=namespaceClient;
  this.businessMds=businessMds;
  this.cConf=cConf;
  this.store=store;
  this.datasetFramework=datasetFramework;
  this.streamAdmin=streamAdmin;
}

Fixed version (ground truth):
@Inject DefaultMetadataAdmin(AbstractNamespaceClient namespaceClient,BusinessMetadataStore businessMds,CConfiguration cConf,Store store,DatasetFramework datasetFramework,StreamAdmin streamAdmin){
  this.businessMds=businessMds;
  this.cConf=cConf;
  this.entityValidator=new EntityValidator(namespaceClient,store,datasetFramework,streamAdmin);
}
Program: 6517
Project: 6517
Buggy source:
@Override public void removeMetadata(Id.NamespacedId entityId) throws NotFoundException {
  ensureEntityExists(entityId);
  businessMds.removeMetadata(entityId);
}

Fixed version (ground truth):
@Override public void removeMetadata(Id.NamespacedId entityId) throws NotFoundException {
  entityValidator.ensureEntityExists(entityId);
  businessMds.removeMetadata(entityId);
}
Program: 6518
Project: 6518
Buggy source:
@Override public void removeProperties(Id.NamespacedId entityId,String... keys) throws NotFoundException {
  ensureEntityExists(entityId);
  businessMds.removeProperties(entityId,keys);
}

Fixed version (ground truth):
@Override public void removeProperties(Id.NamespacedId entityId,String... keys) throws NotFoundException {
  entityValidator.ensureEntityExists(entityId);
  businessMds.removeProperties(entityId,keys);
}
Program: 6520
Project: 6520
Buggy source:
public MasterServiceMain(){
  this.cConf=CConfiguration.create();
  this.cConf.set(Constants.Dataset.Manager.ADDRESS,getLocalHost().getCanonicalHostName());
  this.hConf=HBaseConfiguration.create();
  Injector injector=createBaseInjector(cConf,hConf);
  this.baseInjector=injector;
  this.zkClient=injector.getInstance(ZKClientService.class);
  this.twillRunner=injector.getInstance(TwillRunnerService.class);
  this.kafkaClient=injector.getInstance(KafkaClientService.class);
  this.metricsCollectionService=injector.getInstance(MetricsCollectionService.class);
  this.serviceStore=injector.getInstance(ServiceStore.class);
  this.secureStoreUpdater=baseInjector.getInstance(TokenSecureStoreUpdater.class);
  this.leaderElection=createLeaderElection();
}

Fixed version (ground truth):
public MasterServiceMain(){
  this.cConf=CConfiguration.create();
  this.cConf.set(Constants.Dataset.Manager.ADDRESS,getLocalHost().getCanonicalHostName());
  login();
  this.hConf=HBaseConfiguration.create();
  Injector injector=createBaseInjector(cConf,hConf);
  this.baseInjector=injector;
  this.zkClient=injector.getInstance(ZKClientService.class);
  this.twillRunner=injector.getInstance(TwillRunnerService.class);
  this.kafkaClient=injector.getInstance(KafkaClientService.class);
  this.metricsCollectionService=injector.getInstance(MetricsCollectionService.class);
  this.serviceStore=injector.getInstance(ServiceStore.class);
  this.secureStoreUpdater=baseInjector.getInstance(TokenSecureStoreUpdater.class);
  this.leaderElection=createLeaderElection();
}
Program: 6521
Project: 6521
Buggy source:
@Override public void init(String[] args){
  cleanupTempDir();
  checkExploreRequirements();
  login();
}

Fixed version (ground truth):
@Override public void init(String[] args){
  cleanupTempDir();
  checkExploreRequirements();
}
Program: 6522
Project: 6522
Buggy source:
@Override public void destroy(){
  Destroyables.destroyQuietly(transformExecutor);
}

Fixed version (ground truth):
@Override public void destroy(){
  Destroyables.destroyQuietly(transformExecutor);
  LOG.debug("String_Node_Str",sinks.size());
  for (  WrappedSink<Object,Object,Object> sink : sinks) {
    LOG.trace("String_Node_Str",sink.sink);
    Destroyables.destroyQuietly(sink.sink);
  }
}
Program: 6524
Project: 6524
Buggy source:
@Inject public LocalApplicationManager(CConfiguration configuration,PipelineFactory pipelineFactory,NamespacedLocationFactory namespacedLocationFactory,Store store,StreamConsumerFactory streamConsumerFactory,QueueAdmin queueAdmin,DatasetFramework datasetFramework,@Named("String_Node_Str") DatasetFramework inMemoryDatasetFramework,StreamAdmin streamAdmin,Scheduler scheduler,AdapterService adapterService,@Assisted ProgramTerminator programTerminator,MetricStore metricStore,UsageRegistry usageRegistry,ArtifactRepository artifactRepository){
  this.configuration=configuration;
  this.namespacedLocationFactory=namespacedLocationFactory;
  this.pipelineFactory=pipelineFactory;
  this.store=store;
  this.streamConsumerFactory=streamConsumerFactory;
  this.queueAdmin=queueAdmin;
  this.programTerminator=programTerminator;
  this.datasetFramework=datasetFramework;
  this.inMemoryDatasetFramework=inMemoryDatasetFramework;
  this.streamAdmin=streamAdmin;
  this.scheduler=scheduler;
  this.metricStore=metricStore;
  this.adapterService=adapterService;
  this.usageRegistry=usageRegistry;
  this.artifactRepository=artifactRepository;
}

Fixed version (ground truth):
@Inject public LocalApplicationManager(CConfiguration configuration,PipelineFactory pipelineFactory,NamespacedLocationFactory namespacedLocationFactory,Store store,StreamConsumerFactory streamConsumerFactory,QueueAdmin queueAdmin,DatasetFramework datasetFramework,@Named("String_Node_Str") DatasetFramework inMemoryDatasetFramework,StreamAdmin streamAdmin,Scheduler scheduler,AdapterService adapterService,@Assisted ProgramTerminator programTerminator,MetricStore metricStore,UsageRegistry usageRegistry,ArtifactRepository artifactRepository,BusinessMetadataStore businessMetadataStore){
  this.configuration=configuration;
  this.namespacedLocationFactory=namespacedLocationFactory;
  this.pipelineFactory=pipelineFactory;
  this.store=store;
  this.streamConsumerFactory=streamConsumerFactory;
  this.queueAdmin=queueAdmin;
  this.programTerminator=programTerminator;
  this.datasetFramework=datasetFramework;
  this.inMemoryDatasetFramework=inMemoryDatasetFramework;
  this.streamAdmin=streamAdmin;
  this.scheduler=scheduler;
  this.metricStore=metricStore;
  this.adapterService=adapterService;
  this.usageRegistry=usageRegistry;
  this.artifactRepository=artifactRepository;
  this.businessMetadataStore=businessMetadataStore;
}
Program: 6525
Project: 6525
Buggy source:
@Override public ListenableFuture<O> deploy(Id.Namespace namespace,@Nullable String appId,I input) throws Exception {
  Pipeline<O> pipeline=pipelineFactory.getPipeline();
  pipeline.addLast(new LocalArtifactLoaderStage(configuration,store,namespace,appId,artifactRepository));
  pipeline.addLast(new ApplicationVerificationStage(store,datasetFramework,adapterService));
  pipeline.addLast(new DeployDatasetModulesStage(configuration,namespace,datasetFramework,inMemoryDatasetFramework));
  pipeline.addLast(new CreateDatasetInstancesStage(configuration,datasetFramework,namespace));
  pipeline.addLast(new CreateStreamsStage(namespace,streamAdmin));
  pipeline.addLast(new DeletedProgramHandlerStage(store,programTerminator,streamConsumerFactory,queueAdmin,metricStore));
  pipeline.addLast(new ProgramGenerationStage(configuration,namespacedLocationFactory));
  pipeline.addLast(new ApplicationRegistrationStage(store,usageRegistry));
  pipeline.addLast(new CreateSchedulesStage(scheduler));
  return pipeline.execute(input);
}

Fixed version (ground truth):
@Override public ListenableFuture<O> deploy(Id.Namespace namespace,@Nullable String appId,I input) throws Exception {
  Pipeline<O> pipeline=pipelineFactory.getPipeline();
  pipeline.addLast(new LocalArtifactLoaderStage(configuration,store,namespace,appId,artifactRepository));
  pipeline.addLast(new ApplicationVerificationStage(store,datasetFramework,adapterService));
  pipeline.addLast(new DeployDatasetModulesStage(configuration,namespace,datasetFramework,inMemoryDatasetFramework));
  pipeline.addLast(new CreateDatasetInstancesStage(configuration,datasetFramework,namespace));
  pipeline.addLast(new CreateStreamsStage(namespace,streamAdmin));
  pipeline.addLast(new DeletedProgramHandlerStage(store,programTerminator,streamConsumerFactory,queueAdmin,metricStore,businessMetadataStore));
  pipeline.addLast(new ProgramGenerationStage(configuration,namespacedLocationFactory));
  pipeline.addLast(new ApplicationRegistrationStage(store,usageRegistry));
  pipeline.addLast(new CreateSchedulesStage(scheduler));
  return pipeline.execute(input);
}
Program: 6526
Project: 6526
Buggy source:
public DeletedProgramHandlerStage(Store store,ProgramTerminator programTerminator,StreamConsumerFactory streamConsumerFactory,QueueAdmin queueAdmin,MetricStore metricStore){
  super(TypeToken.of(ApplicationDeployable.class));
  this.store=store;
  this.programTerminator=programTerminator;
  this.streamConsumerFactory=streamConsumerFactory;
  this.queueAdmin=queueAdmin;
  this.metricStore=metricStore;
}

Fixed version (ground truth):
public DeletedProgramHandlerStage(Store store,ProgramTerminator programTerminator,StreamConsumerFactory streamConsumerFactory,QueueAdmin queueAdmin,MetricStore metricStore,BusinessMetadataStore businessMetadataStore){
  super(TypeToken.of(ApplicationDeployable.class));
  this.store=store;
  this.programTerminator=programTerminator;
  this.streamConsumerFactory=streamConsumerFactory;
  this.queueAdmin=queueAdmin;
  this.metricStore=metricStore;
  this.businessMetadataStore=businessMetadataStore;
}
Program: 6529
Project: 6529
Buggy source:
public void init(Set<Integer> partitions,CheckpointManager checkpointManager){
  partitonCheckpoints.clear();
  try {
    for (    Integer partition : partitions) {
      partitonCheckpoints.put(partition,checkpointManager.getCheckpoint(partition));
    }
  }
 catch (  Exception e) {
    throw Throwables.propagate(e);
  }
}

Fixed version (ground truth):
public void init(Set<Integer> partitions,CheckpointManager checkpointManager){
  partitonCheckpoints.clear();
  try {
    Map<Integer,Checkpoint> partitionMap=checkpointManager.getCheckpoint(partitions);
    for (    Map.Entry<Integer,Checkpoint> partition : partitionMap.entrySet()) {
      partitonCheckpoints.put(partition.getKey(),partition.getValue());
    }
  }
 catch (  Exception e) {
    throw Throwables.propagate(e);
  }
}
Program: 6530
Project: 6530
Buggy source:
private void checkpoint(){
  try {
    for (    Map.Entry<Integer,Checkpoint> entry : partitionCheckpoints.entrySet()) {
      checkpointManager.saveCheckpoint(entry.getKey(),entry.getValue());
    }
  }
 catch (  Exception e) {
    throw Throwables.propagate(e);
  }
}

Fixed version (ground truth):
private void checkpoint(){
  try {
    checkpointManager.saveCheckpoint(partitionCheckpoints);
  }
 catch (  Exception e) {
    throw Throwables.propagate(e);
  }
}
Program: 6531
Project: 6531
Buggy source:
@Override public Checkpoint apply(DatasetContext<Table> ctx) throws Exception {
  Row result=ctx.get().get(Bytes.add(rowKeyPrefix,Bytes.toBytes(partition)));
  return new Checkpoint(result.getLong(OFFSET_COLNAME,-1),result.getLong(MAX_TIME_COLNAME,-1));
}

Fixed version (ground truth):
@Override public Checkpoint apply(Table table) throws Exception {
  Row result=table.get(Bytes.add(rowKeyPrefix,Bytes.toBytes(partition)));
  return new Checkpoint(result.getLong(OFFSET_COLNAME,-1),result.getLong(MAX_TIME_COLNAME,-1));
}
Program: 6532
Project: 6532
Buggy source:
public CheckpointManager(final LogSaverTableUtil tableUtil,TransactionExecutorFactory txExecutorFactory,String topic,int prefix){
  this.rowKeyPrefix=Bytes.add(Bytes.toBytes(prefix),Bytes.toBytes(topic));
  this.mds=Transactional.of(txExecutorFactory,new Supplier<DatasetContext<Table>>(){
    @Override public DatasetContext<Table> get(){
      try {
        return DatasetContext.of(tableUtil.getMetaTable());
      }
 catch (      Exception e) {
        throw Throwables.propagate(e);
      }
    }
  }
);
}

Fixed version (ground truth):
public CheckpointManager(final LogSaverTableUtil tableUtil,TransactionExecutorFactory txExecutorFactory,String topic,int prefix){
  this.rowKeyPrefix=Bytes.add(Bytes.toBytes(prefix),Bytes.toBytes(topic));
  this.tableUtil=tableUtil;
  this.transactionExecutorFactory=txExecutorFactory;
  this.lastCheckpoint=new HashMap<>();
}
Program: 6533
Project: 6533
Buggy source:
public Checkpoint getCheckpoint(final int partition) throws Exception {
  Checkpoint checkpoint=mds.execute(new TransactionExecutor.Function<DatasetContext<Table>,Checkpoint>(){
    @Override public Checkpoint apply(    DatasetContext<Table> ctx) throws Exception {
      Row result=ctx.get().get(Bytes.add(rowKeyPrefix,Bytes.toBytes(partition)));
      return new Checkpoint(result.getLong(OFFSET_COLNAME,-1),result.getLong(MAX_TIME_COLNAME,-1));
    }
  }
);
  LOG.trace("String_Node_Str",checkpoint,partition);
  return checkpoint;
}

Fixed version (ground truth):
public Checkpoint getCheckpoint(final int partition) throws Exception {
  Checkpoint checkpoint=execute(new TransactionExecutor.Function<Table,Checkpoint>(){
    @Override public Checkpoint apply(    Table table) throws Exception {
      Row result=table.get(Bytes.add(rowKeyPrefix,Bytes.toBytes(partition)));
      return new Checkpoint(result.getLong(OFFSET_COLNAME,-1),result.getLong(MAX_TIME_COLNAME,-1));
    }
  }
);
  LOG.trace("String_Node_Str",checkpoint,partition);
  return checkpoint;
}
Program: 6534
Project: 6534
Buggy source:
public void saveCheckpoint(final int partition,final Checkpoint checkpoint) throws Exception {
  LOG.trace("String_Node_Str",checkpoint,partition);
  mds.execute(new TransactionExecutor.Function<DatasetContext<Table>,Void>(){
    @Override public Void apply(    DatasetContext<Table> ctx) throws Exception {
      Table table=ctx.get();
      byte[] key=Bytes.add(rowKeyPrefix,Bytes.toBytes(partition));
      table.put(key,OFFSET_COLNAME,Bytes.toBytes(checkpoint.getNextOffset()));
      table.put(key,MAX_TIME_COLNAME,Bytes.toBytes(checkpoint.getMaxEventTime()));
      return null;
    }
  }
);
}

Fixed version (ground truth):
public void saveCheckpoint(final Map<Integer,Checkpoint> checkpoints) throws Exception {
  if (lastCheckpoint.equals(checkpoints)) {
    return;
  }
  execute(new TransactionExecutor.Procedure<Table>(){
    @Override public void apply(    Table table) throws Exception {
      for (      Map.Entry<Integer,Checkpoint> entry : checkpoints.entrySet()) {
        byte[] key=Bytes.add(rowKeyPrefix,Bytes.toBytes(entry.getKey()));
        Checkpoint checkpoint=entry.getValue();
        table.put(key,OFFSET_COLNAME,Bytes.toBytes(checkpoint.getNextOffset()));
        table.put(key,MAX_TIME_COLNAME,Bytes.toBytes(checkpoint.getMaxEventTime()));
      }
      lastCheckpoint=ImmutableMap.copyOf(checkpoints);
    }
  }
);
  LOG.trace("String_Node_Str",checkpoints);
}
Program: 6535
Project: 6535
Buggy source:
private void flush(boolean force) throws Exception {
  long currentTs=System.currentTimeMillis();
  if (!force && currentTs - lastCheckpointTime < flushIntervalMs) {
    return;
  }
  avroFileWriter.flush();
  for (  Map.Entry<Integer,Checkpoint> entry : partitionCheckpointMap.entrySet()) {
    LOG.trace("String_Node_Str",entry.getValue(),entry.getKey());
    checkpointManager.saveCheckpoint(entry.getKey(),entry.getValue());
  }
  lastCheckpointTime=currentTs;
}

Fixed version (ground truth):
private void flush(boolean force) throws Exception {
  long currentTs=System.currentTimeMillis();
  if (!force && currentTs - lastCheckpointTime < flushIntervalMs) {
    return;
  }
  avroFileWriter.flush();
  checkpointManager.saveCheckpoint(partitionCheckpointMap);
  lastCheckpointTime=currentTs;
}
Program: 6536
Project: 6536
Buggy source:
@Override public void init(Set<Integer> partitions){
  super.init(partitions,checkpointManager);
  scheduledExecutor=MoreExecutors.listeningDecorator(Executors.newSingleThreadScheduledExecutor(Threads.createDaemonThreadFactory("String_Node_Str")));
  partitionCheckpoints.clear();
  try {
    for (    Integer partition : partitions) {
      partitionCheckpoints.put(partition,checkpointManager.getCheckpoint(partition));
    }
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    throw Throwables.propagate(e);
  }
  checkPointWriter=new CheckPointWriter(checkpointManager,partitionCheckpoints);
  scheduledExecutor.scheduleWithFixedDelay(checkPointWriter,100,10000,TimeUnit.MILLISECONDS);
}

Fixed version (ground truth):
@Override public void init(Set<Integer> partitions){
  super.init(partitions,checkpointManager);
  scheduledExecutor=MoreExecutors.listeningDecorator(Executors.newSingleThreadScheduledExecutor(Threads.createDaemonThreadFactory("String_Node_Str")));
  partitionCheckpoints.clear();
  try {
    Map<Integer,Checkpoint> partitionMap=checkpointManager.getCheckpoint(partitions);
    for (    Map.Entry<Integer,Checkpoint> partition : partitionMap.entrySet()) {
      partitionCheckpoints.put(partition.getKey(),partition.getValue());
    }
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    throw Throwables.propagate(e);
  }
  checkPointWriter=new CheckPointWriter(checkpointManager,partitionCheckpoints);
  scheduledExecutor.scheduleWithFixedDelay(checkPointWriter,100,500,TimeUnit.MILLISECONDS);
}
Program: 6538
Project: 6538
Buggy source:
@Override public Integer apply(DatasetContext<Table> ctx) throws Exception {
  byte[] tillTimeBytes=Bytes.toBytes(tillTime);
  int deletedColumns=0;
  Scanner scanner=ctx.get().scan(ROW_KEY_PREFIX,ROW_KEY_PREFIX_END);
  try {
    Row row;
    while ((row=scanner.next()) != null) {
      byte[] rowKey=row.getRow();
      String namespacedLogDir=LoggingContextHelper.getNamespacedBaseDir(logBaseDir,getLogPartition(rowKey));
      byte[] maxCol=getMaxKey(row.getColumns());
      for (      Map.Entry<byte[],byte[]> entry : row.getColumns().entrySet()) {
        byte[] colName=entry.getKey();
        if (LOG.isDebugEnabled()) {
          LOG.debug("String_Node_Str",Bytes.toString(entry.getValue()),Bytes.toLong(colName));
        }
        if (Bytes.compareTo(colName,tillTimeBytes) < 0 && Bytes.compareTo(colName,maxCol) != 0) {
          callback.handle(locationFactory.create(new URI(Bytes.toString(entry.getValue()))),namespacedLogDir);
          ctx.get().delete(rowKey,colName);
          deletedColumns++;
        }
      }
    }
  }
  finally {
    scanner.close();
  }
  return deletedColumns;
}

Fixed version (ground truth):
@Override public Integer apply(Table table) throws Exception {
  byte[] tillTimeBytes=Bytes.toBytes(tillTime);
  int deletedColumns=0;
  Scanner scanner=table.scan(ROW_KEY_PREFIX,ROW_KEY_PREFIX_END);
  try {
    Row row;
    while ((row=scanner.next()) != null) {
      byte[] rowKey=row.getRow();
      String namespacedLogDir=LoggingContextHelper.getNamespacedBaseDir(logBaseDir,getLogPartition(rowKey));
      byte[] maxCol=getMaxKey(row.getColumns());
      for (      Map.Entry<byte[],byte[]> entry : row.getColumns().entrySet()) {
        byte[] colName=entry.getKey();
        if (LOG.isDebugEnabled()) {
          LOG.debug("String_Node_Str",Bytes.toString(entry.getValue()),Bytes.toLong(colName));
        }
        if (Bytes.compareTo(colName,tillTimeBytes) < 0 && Bytes.compareTo(colName,maxCol) != 0) {
          callback.handle(locationFactory.create(new URI(Bytes.toString(entry.getValue()))),namespacedLogDir);
          table.delete(rowKey,colName);
          deletedColumns++;
        }
      }
    }
  }
  finally {
    scanner.close();
  }
  return deletedColumns;
}
Program: 6539
Project: 6539
Buggy source:
@Inject public FileMetaDataManager(final LogSaverTableUtil tableUtil,TransactionExecutorFactory txExecutorFactory,LocationFactory locationFactory,CConfiguration cConf){
  this.mds=Transactional.of(txExecutorFactory,new Supplier<DatasetContext<Table>>(){
    @Override public DatasetContext<Table> get(){
      try {
        return DatasetContext.of(tableUtil.getMetaTable());
      }
 catch (      Exception e) {
        throw Throwables.propagate(e);
      }
    }
  }
);
  this.locationFactory=locationFactory;
  this.logBaseDir=cConf.get(LoggingConfiguration.LOG_BASE_DIR);
}

Fixed version (ground truth):
@Inject public FileMetaDataManager(final LogSaverTableUtil tableUtil,TransactionExecutorFactory txExecutorFactory,LocationFactory locationFactory,CConfiguration cConf){
  this.tableUtil=tableUtil;
  this.transactionExecutorFactory=txExecutorFactory;
  this.locationFactory=locationFactory;
  this.logBaseDir=cConf.get(LoggingConfiguration.LOG_BASE_DIR);
}
Program: 6540
Project: 6540
Buggy source:
/** 
 * Returns a list of log files for a logging context.
 * @param loggingContext logging context.
 * @return Sorted map containing key as start time, and value as log file.
 */
public NavigableMap<Long,Location> listFiles(final LoggingContext loggingContext) throws Exception {
  return mds.execute(new TransactionExecutor.Function<DatasetContext<Table>,NavigableMap<Long,Location>>(){
    @Override public NavigableMap<Long,Location> apply(    DatasetContext<Table> ctx) throws Exception {
      Row cols=ctx.get().get(getRowKey(loggingContext));
      if (cols.isEmpty()) {
        return (NavigableMap<Long,Location>)EMPTY_MAP;
      }
      NavigableMap<Long,Location> files=new TreeMap<>();
      for (      Map.Entry<byte[],byte[]> entry : cols.getColumns().entrySet()) {
        files.put(Bytes.toLong(entry.getKey()),locationFactory.create(new URI(Bytes.toString(entry.getValue()))));
      }
      return files;
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Returns a list of log files for a logging context.
 * @param loggingContext logging context.
 * @return Sorted map containing key as start time, and value as log file.
 */
public NavigableMap<Long,Location> listFiles(final LoggingContext loggingContext) throws Exception {
  return execute(new TransactionExecutor.Function<Table,NavigableMap<Long,Location>>(){
    @Override public NavigableMap<Long,Location> apply(    Table table) throws Exception {
      Row cols=table.get(getRowKey(loggingContext));
      if (cols.isEmpty()) {
        return (NavigableMap<Long,Location>)EMPTY_MAP;
      }
      NavigableMap<Long,Location> files=new TreeMap<>();
      for (      Map.Entry<byte[],byte[]> entry : cols.getColumns().entrySet()) {
        files.put(Bytes.toLong(entry.getKey()),locationFactory.create(new URI(Bytes.toString(entry.getValue()))));
      }
      return files;
    }
  }
);
}
Program: 6541
Project: 6541
Buggy source:
/** 
 * Persists meta data associated with a log file.
 * @param logPartition partition name that is used to group log messages
 * @param startTimeMs start log time associated with the file.
 * @param location log file.
 */
private void writeMetaData(final String logPartition,final long startTimeMs,final Location location) throws Exception {
  LOG.debug("String_Node_Str",logPartition,startTimeMs,location.toURI());
  mds.execute(new TransactionExecutor.Function<DatasetContext<Table>,Void>(){
    @Override public Void apply(    DatasetContext<Table> ctx) throws Exception {
      ctx.get().put(getRowKey(logPartition),Bytes.toBytes(startTimeMs),Bytes.toBytes(location.toURI().toString()));
      return null;
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Persists meta data associated with a log file.
 * @param logPartition partition name that is used to group log messages
 * @param startTimeMs start log time associated with the file.
 * @param location log file.
 */
private void writeMetaData(final String logPartition,final long startTimeMs,final Location location) throws Exception {
  LOG.debug("String_Node_Str",logPartition,startTimeMs,location.toURI());
  execute(new TransactionExecutor.Procedure<Table>(){
    @Override public void apply(    Table table) throws Exception {
      table.put(getRowKey(logPartition),Bytes.toBytes(startTimeMs),Bytes.toBytes(location.toURI().toString()));
    }
  }
);
}
Program: 6542
Project: 6542
Buggy source:
private static void generateCheckpointTime(LoggingContext loggingContext,int numExpectedEvents) throws Exception {
  FileLogReader logReader=injector.getInstance(FileLogReader.class);
  LoggingTester.LogCallback logCallback=new LoggingTester.LogCallback();
  logReader.getLog(loggingContext,0,Long.MAX_VALUE,Filter.EMPTY_FILTER,logCallback);
  Assert.assertEquals(numExpectedEvents,logCallback.getEvents().size());
  CheckpointManagerFactory checkpointManagerFactory=injector.getInstance(CheckpointManagerFactory.class);
  CheckpointManager checkpointManager=checkpointManagerFactory.create(KafkaTopic.getTopic(),KafkaLogWriterPlugin.CHECKPOINT_ROW_KEY_PREFIX);
  long checkpointTime=logCallback.getEvents().get(numExpectedEvents - 1).getLoggingEvent().getTimeStamp();
  checkpointManager.saveCheckpoint(stringPartitioner.partition(loggingContext.getLogPartition(),-1),new Checkpoint(numExpectedEvents,checkpointTime));
}

Fixed version (ground truth):
private static void generateCheckpointTime(LoggingContext loggingContext,int numExpectedEvents) throws Exception {
  FileLogReader logReader=injector.getInstance(FileLogReader.class);
  LoggingTester.LogCallback logCallback=new LoggingTester.LogCallback();
  logReader.getLog(loggingContext,0,Long.MAX_VALUE,Filter.EMPTY_FILTER,logCallback);
  Assert.assertEquals(numExpectedEvents,logCallback.getEvents().size());
  CheckpointManagerFactory checkpointManagerFactory=injector.getInstance(CheckpointManagerFactory.class);
  CheckpointManager checkpointManager=checkpointManagerFactory.create(KafkaTopic.getTopic(),KafkaLogWriterPlugin.CHECKPOINT_ROW_KEY_PREFIX);
  long checkpointTime=logCallback.getEvents().get(numExpectedEvents - 1).getLoggingEvent().getTimeStamp();
  checkpointManager.saveCheckpoint(ImmutableMap.of(stringPartitioner.partition(loggingContext.getLogPartition(),-1),new Checkpoint(numExpectedEvents,checkpointTime)));
}
Program: 6543
Project: 6543
Buggy source:
private void resetLogSaverPluginCheckpoint() throws Exception {
  TypeLiteral<Set<KafkaLogProcessor>> type=new TypeLiteral<Set<KafkaLogProcessor>>(){
  }
;
  Set<KafkaLogProcessor> processors=injector.getInstance(Key.get(type,Names.named(Constants.LogSaver.MESSAGE_PROCESSORS)));
  for (  KafkaLogProcessor processor : processors) {
    if (processor instanceof KafkaLogWriterPlugin) {
      KafkaLogWriterPlugin plugin=(KafkaLogWriterPlugin)processor;
      CheckpointManager manager=plugin.getCheckPointManager();
      manager.saveCheckpoint(0,new Checkpoint(10,-1));
      Set<Integer> partitions=Sets.newHashSet(0,1);
      plugin.init(partitions);
    }
  }
}

Fixed version (ground truth):
private void resetLogSaverPluginCheckpoint() throws Exception {
  TypeLiteral<Set<KafkaLogProcessor>> type=new TypeLiteral<Set<KafkaLogProcessor>>(){
  }
;
  Set<KafkaLogProcessor> processors=injector.getInstance(Key.get(type,Names.named(Constants.LogSaver.MESSAGE_PROCESSORS)));
  for (  KafkaLogProcessor processor : processors) {
    if (processor instanceof KafkaLogWriterPlugin) {
      KafkaLogWriterPlugin plugin=(KafkaLogWriterPlugin)processor;
      CheckpointManager manager=plugin.getCheckPointManager();
      manager.saveCheckpoint(ImmutableMap.of(0,new Checkpoint(10,-1)));
      Set<Integer> partitions=Sets.newHashSet(0,1);
      plugin.init(partitions);
    }
  }
}
Program: 6544
Project: 6544
Buggy source:
private Schema.Type getNonNullableType(Schema.Field field){
  Schema.Type type;
  if (field.getSchema().isNullable()) {
    type=field.getSchema().getNonNullable().getType();
  }
 else {
    type=field.getSchema().getType();
  }
  Preconditions.checkArgument(type.isSimpleType(),"String_Node_Str");
  return type;
}

Fixed version (ground truth):
private Schema.Type getNonNullableType(Schema.Field field){
  Schema.Type type;
  if (field.getSchema().isNullable()) {
    type=field.getSchema().getNonNullable().getType();
  }
 else {
    type=field.getSchema().getType();
  }
  Preconditions.checkArgument(type.isSimpleType(),"String_Node_Str" + "String_Node_Str" + "String_Node_Str",type);
  return type;
}
Program: 6547
Project: 6547
Buggy source:
@Inject LineageHandler(LineageGenerator lineageGenerator,LineageStore lineageStore){
  this.lineageGenerator=lineageGenerator;
  this.lineageStore=lineageStore;
}

Fixed version (ground truth):
@Inject LineageHandler(LineageAdmin lineageAdmin){
  this.lineageAdmin=lineageAdmin;
}
Program: 6548
Project: 6548
Buggy source:
@GET @Path("String_Node_Str") public void streamLineage(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") String namespaceId,@PathParam("String_Node_Str") String stream,@QueryParam("String_Node_Str") String startStr,@QueryParam("String_Node_Str") String endStr,@QueryParam("String_Node_Str") @DefaultValue("String_Node_Str") int levels) throws Exception {
  checkLevels(levels);
  TimeRange range=parseRange(startStr,endStr);
  Id.Stream streamId=Id.Stream.from(namespaceId,stream);
  Lineage lineage=lineageGenerator.computeLineage(streamId,range.getStart(),range.getEnd(),levels);
  responder.sendJson(HttpResponseStatus.OK,new LineageRecord(range.getStart(),range.getEnd(),lineage.getRelations()),LineageRecord.class,GSON);
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") public void streamLineage(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") String namespaceId,@PathParam("String_Node_Str") String stream,@QueryParam("String_Node_Str") String startStr,@QueryParam("String_Node_Str") String endStr,@QueryParam("String_Node_Str") @DefaultValue("String_Node_Str") int levels) throws Exception {
  checkLevels(levels);
  TimeRange range=parseRange(startStr,endStr);
  Id.Stream streamId=Id.Stream.from(namespaceId,stream);
  Lineage lineage=lineageAdmin.computeLineage(streamId,range.getStart(),range.getEnd(),levels);
  responder.sendJson(HttpResponseStatus.OK,new LineageRecord(TimeUnit.MILLISECONDS.toSeconds(range.getStart()),TimeUnit.MILLISECONDS.toSeconds(range.getEnd()),lineage.getRelations()),LineageRecord.class,GSON);
}
Program: 6549
Project: 6549
Buggy source:
@GET @Path("String_Node_Str") public void getAccessesForRun(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") String namespaceId,@PathParam("String_Node_Str") String appId,@PathParam("String_Node_Str") String programType,@PathParam("String_Node_Str") String programId,@PathParam("String_Node_Str") String runId) throws Exception {
  Id.Run run=new Id.Run(Id.Program.from(namespaceId,appId,ProgramType.valueOfCategoryName(programType),programId),runId);
  responder.sendJson(HttpResponseStatus.OK,lineageStore.getRunMetadata(run),SET_METADATA_RECORD_TYPE,GSON);
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") public void getAccessesForRun(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") String namespaceId,@PathParam("String_Node_Str") String appId,@PathParam("String_Node_Str") String programType,@PathParam("String_Node_Str") String programId,@PathParam("String_Node_Str") String runId) throws Exception {
  Id.Run run=new Id.Run(Id.Program.from(namespaceId,appId,ProgramType.valueOfCategoryName(programType),programId),runId);
  responder.sendJson(HttpResponseStatus.OK,lineageAdmin.getMetadataForRun(run),SET_METADATA_RECORD_TYPE,GSON);
}
Program: 6550
Project: 6550
Buggy source:
@GET @Path("String_Node_Str") public void datasetLineage(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") String namespaceId,@PathParam("String_Node_Str") String datasetId,@QueryParam("String_Node_Str") String startStr,@QueryParam("String_Node_Str") String endStr,@QueryParam("String_Node_Str") @DefaultValue("String_Node_Str") int levels) throws Exception {
  checkLevels(levels);
  TimeRange range=parseRange(startStr,endStr);
  Id.DatasetInstance datasetInstance=Id.DatasetInstance.from(namespaceId,datasetId);
  Lineage lineage=lineageGenerator.computeLineage(datasetInstance,range.getStart(),range.getEnd(),levels);
  responder.sendJson(HttpResponseStatus.OK,new LineageRecord(range.getStart(),range.getEnd(),lineage.getRelations()),LineageRecord.class,GSON);
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") public void datasetLineage(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") String namespaceId,@PathParam("String_Node_Str") String datasetId,@QueryParam("String_Node_Str") String startStr,@QueryParam("String_Node_Str") String endStr,@QueryParam("String_Node_Str") @DefaultValue("String_Node_Str") int levels) throws Exception {
  checkLevels(levels);
  TimeRange range=parseRange(startStr,endStr);
  Id.DatasetInstance datasetInstance=Id.DatasetInstance.from(namespaceId,datasetId);
  Lineage lineage=lineageAdmin.computeLineage(datasetInstance,range.getStart(),range.getEnd(),levels);
  responder.sendJson(HttpResponseStatus.OK,new LineageRecord(TimeUnit.MILLISECONDS.toSeconds(range.getStart()),TimeUnit.MILLISECONDS.toSeconds(range.getEnd()),lineage.getRelations()),LineageRecord.class,GSON);
}
Program: 6552
Project: 6552
Buggy source:
List<BusinessMetadataRecord> executeSearchOnColumns(String column,String searchValue,MetadataSearchTargetType type){
  List<BusinessMetadataRecord> results=new LinkedList<>();
  Scanner scanner;
  String lowerCaseSearchValue=searchValue.toLowerCase();
  if (lowerCaseSearchValue.endsWith("String_Node_Str")) {
    byte[] startKey=Bytes.toBytes(lowerCaseSearchValue.substring(0,lowerCaseSearchValue.lastIndexOf("String_Node_Str")));
    byte[] stopKey=Bytes.stopKeyForPrefix(startKey);
    scanner=indexedTable.scanByIndex(Bytes.toBytes(column),startKey,stopKey);
  }
 else {
    byte[] value=Bytes.toBytes(lowerCaseSearchValue);
    scanner=indexedTable.readByIndex(Bytes.toBytes(column),value);
  }
  try {
    Row next;
    while ((next=scanner.next()) != null) {
      String rowValue=next.getString(VALUE_COLUMN);
      if (rowValue == null) {
        continue;
      }
      final byte[] rowKey=next.getRow();
      String targetType=getTargetType(rowKey);
      if ((type != MetadataSearchTargetType.ALL) && (!targetType.equals(type.getInternalName()))) {
        continue;
      }
      Id.NamespacedId targetId=getNamespaceIdFromKey(targetType,new MDSKey(rowKey));
      String key=getMetadataKey(targetType,rowKey);
      String value=Bytes.toString(next.get(Bytes.toBytes(BusinessMetadataDataset.VALUE_COLUMN)));
      BusinessMetadataRecord record=new BusinessMetadataRecord(targetId,key,value);
      results.add(record);
    }
  }
  finally {
    scanner.close();
  }
  return results;
}

Fixed version (ground truth):
List<BusinessMetadataRecord> executeSearchOnColumns(String column,String searchValue,MetadataSearchTargetType type){
  List<BusinessMetadataRecord> results=new LinkedList<>();
  Scanner scanner;
  String lowerCaseSearchValue=searchValue.toLowerCase();
  if (lowerCaseSearchValue.endsWith("String_Node_Str")) {
    byte[] startKey=Bytes.toBytes(lowerCaseSearchValue.substring(0,lowerCaseSearchValue.lastIndexOf("String_Node_Str")));
    byte[] stopKey=Bytes.stopKeyForPrefix(startKey);
    scanner=indexedTable.scanByIndex(Bytes.toBytes(column),startKey,stopKey);
  }
 else {
    byte[] value=Bytes.toBytes(lowerCaseSearchValue);
    scanner=indexedTable.readByIndex(Bytes.toBytes(column),value);
  }
  try {
    Row next;
    while ((next=scanner.next()) != null) {
      String rowValue=next.getString(VALUE_COLUMN);
      if (rowValue == null) {
        continue;
      }
      final byte[] rowKey=next.getRow();
      String targetType=MdsValueKey.getTargetType(rowKey);
      if ((type != MetadataSearchTargetType.ALL) && (!targetType.equals(type.getInternalName()))) {
        continue;
      }
      Id.NamespacedId targetId=MdsValueKey.getNamespaceIdFromKey(targetType,new MDSKey(rowKey));
      String key=MdsValueKey.getMetadataKey(targetType,rowKey);
      String value=Bytes.toString(next.get(Bytes.toBytes(BusinessMetadataDataset.VALUE_COLUMN)));
      BusinessMetadataRecord record=new BusinessMetadataRecord(targetId,key,value);
      results.add(record);
    }
  }
  finally {
    scanner.close();
  }
  return results;
}
Program: 6553
Project: 6553
Buggy source:
private void MetadataType(String serializedForm){
  this.serializedForm=serializedForm;
}

Fixed version (ground truth):
void MetadataType(String serializedForm){
  this.serializedForm=serializedForm;
}
Program: 6554
Project: 6554
Buggy source:
/** 
 * Retrieves the business metadata for the specified   {@link Id.NamespacedId}.
 * @param targetId the specified {@link Id.NamespacedId}
 * @param metadataType {@link MetadataType} indicating the type of metadata to retrieve - property or tag
 * @return a Map representing the metadata for the specified {@link Id.NamespacedId}
 */
private Map<String,String> getBusinessMetadata(Id.NamespacedId targetId,MetadataType metadataType){
  String targetType=getTargetType(targetId);
  MDSKey mdsKey=getMDSKey(targetId,metadataType,null);
  byte[] startKey=mdsKey.getKey();
  byte[] stopKey=Bytes.stopKeyForPrefix(startKey);
  Map<String,String> metadata=new HashMap<>();
  Scanner scan=indexedTable.scan(startKey,stopKey);
  try {
    Row next;
    while ((next=scan.next()) != null) {
      String key=getMetadataKey(targetType,next.getRow());
      byte[] value=next.get(VALUE_COLUMN);
      if (key == null || value == null) {
        continue;
      }
      metadata.put(key,Bytes.toString(value));
    }
    return metadata;
  }
  finally {
    scan.close();
  }
}

Fixed version (ground truth):
/** 
 * Retrieves the business metadata for the specified   {@link Id.NamespacedId}.
 * @param targetId the specified {@link Id.NamespacedId}
 * @param metadataType {@link MetadataType} indicating the type of metadata to retrieve - property or tag
 * @return a Map representing the metadata for the specified {@link Id.NamespacedId}
 */
private Map<String,String> getBusinessMetadata(Id.NamespacedId targetId,MetadataType metadataType){
  String targetType=KeyHelper.getTargetType(targetId);
  MDSKey mdsKey=MdsValueKey.getMDSKey(targetId,metadataType,null);
  byte[] startKey=mdsKey.getKey();
  byte[] stopKey=Bytes.stopKeyForPrefix(startKey);
  Map<String,String> metadata=new HashMap<>();
  Scanner scan=indexedTable.scan(startKey,stopKey);
  try {
    Row next;
    while ((next=scan.next()) != null) {
      String key=MdsValueKey.getMetadataKey(targetType,next.getRow());
      byte[] value=next.get(VALUE_COLUMN);
      if (key == null || value == null) {
        continue;
      }
      metadata.put(key,Bytes.toString(value));
    }
    return metadata;
  }
  finally {
    scan.close();
  }
}
Program: 6555
Project: 6555
Buggy source:
/** 
 * Add new business metadata.
 * @param metadataRecord The value of the metadata to be saved.
 * @param metadataType {@link MetadataType} indicating the type of metadata - property or tag
 */
private void setBusinessMetadata(BusinessMetadataRecord metadataRecord,MetadataType metadataType){
  Id.NamespacedId targetId=metadataRecord.getTargetId();
  String key=metadataRecord.getKey();
  MDSKey mdsKey=getMDSKey(targetId,metadataType,key);
  write(mdsKey,metadataRecord);
}

Fixed version (ground truth):
/** 
 * Add new business metadata.
 * @param metadataRecord The value of the metadata to be saved.
 * @param metadataType {@link MetadataType} indicating the type of metadata - property or tag
 */
private void setBusinessMetadata(BusinessMetadataRecord metadataRecord,MetadataType metadataType){
  Id.NamespacedId targetId=metadataRecord.getTargetId();
  write(targetId,metadataType,metadataRecord);
}
Program: 6556
Project: 6556
Buggy source:
/** 
 * Removes all keys that satisfy a given predicate from the metadata of the specified   {@link Id.NamespacedId}.
 * @param targetId the {@link Id.NamespacedId} for which keys are to be removed
 * @param metadataType {@link MetadataType} indicating the type of metadata to remove - property or tag
 * @param filter the {@link Predicate} that should be satisfied to remove a key
 */
private void removeMetadata(Id.NamespacedId targetId,MetadataType metadataType,Predicate<String> filter){
  String targetType=getTargetType(targetId);
  MDSKey mdsKey=getMDSKey(targetId,metadataType,null);
  byte[] prefix=mdsKey.getKey();
  byte[] stopKey=Bytes.stopKeyForPrefix(prefix);
  Scanner scan=indexedTable.scan(prefix,stopKey);
  try {
    Row next;
    while ((next=scan.next()) != null) {
      String keyValue=next.getString(KEYVALUE_COLUMN);
      String value=next.getString(VALUE_COLUMN);
      if (keyValue == null && value == null) {
        continue;
      }
      if (filter.apply(getMetadataKey(targetType,next.getRow()))) {
        indexedTable.delete(new Delete(next.getRow()));
      }
    }
  }
  finally {
    scan.close();
  }
}

Fixed version (ground truth):
/** 
 * Removes all keys that satisfy a given predicate from the metadata of the specified   {@link Id.NamespacedId}.
 * @param targetId the {@link Id.NamespacedId} for which keys are to be removed
 * @param metadataType {@link MetadataType} indicating the type of metadata to remove - property or tag
 * @param filter the {@link Predicate} that should be satisfied to remove a key
 */
private void removeMetadata(Id.NamespacedId targetId,MetadataType metadataType,Predicate<String> filter){
  String targetType=KeyHelper.getTargetType(targetId);
  MDSKey mdsKey=MdsValueKey.getMDSKey(targetId,metadataType,null);
  byte[] prefix=mdsKey.getKey();
  byte[] stopKey=Bytes.stopKeyForPrefix(prefix);
  Scanner scan=indexedTable.scan(prefix,stopKey);
  try {
    Row next;
    while ((next=scan.next()) != null) {
      String keyValue=next.getString(KEYVALUE_COLUMN);
      String value=next.getString(VALUE_COLUMN);
      if (keyValue == null && value == null) {
        continue;
      }
      if (filter.apply(MdsValueKey.getMetadataKey(targetType,next.getRow()))) {
        indexedTable.delete(new Delete(next.getRow()));
      }
    }
  }
  finally {
    scan.close();
  }
  writeHistory(targetId);
}
Program: 6557
Project: 6557
Buggy source:
private void write(MDSKey id,BusinessMetadataRecord record){
  Put put=new Put(id.getKey());
  put.add(Bytes.toBytes(KEYVALUE_COLUMN),Bytes.toBytes(record.getKey().toLowerCase() + KEYVALUE_SEPARATOR + record.getValue().toLowerCase()));
  put.add(Bytes.toBytes(CASE_INSENSITIVE_VALUE_COLUMN),Bytes.toBytes(record.getValue().toLowerCase()));
  put.add(Bytes.toBytes(VALUE_COLUMN),Bytes.toBytes(record.getValue()));
  indexedTable.put(put);
}

Fixed version (ground truth):
private void write(Id.NamespacedId targetId,MetadataType metadataType,BusinessMetadataRecord record){
  String key=record.getKey();
  MDSKey mdsKey=MdsValueKey.getMDSKey(targetId,metadataType,key);
  Put put=new Put(mdsKey.getKey());
  put.add(Bytes.toBytes(KEYVALUE_COLUMN),Bytes.toBytes(record.getKey().toLowerCase() + KEYVALUE_SEPARATOR + record.getValue().toLowerCase()));
  put.add(Bytes.toBytes(CASE_INSENSITIVE_VALUE_COLUMN),Bytes.toBytes(record.getValue().toLowerCase()));
  put.add(Bytes.toBytes(VALUE_COLUMN),Bytes.toBytes(record.getValue()));
  indexedTable.put(put);
  writeHistory(targetId);
}
Program: 6560
Project: 6560
Buggy source:
@Override public Set<MetadataSearchResultRecord> searchMetadata(String searchQuery,@Nullable final MetadataSearchTargetType type) throws NotFoundException {
  Iterable<BusinessMetadataRecord> results;
  if (type == null) {
    results=businessMds.searchMetadata(searchQuery);
  }
 else {
    results=businessMds.searchMetadataOnType(searchQuery,type);
  }
  Set<MetadataSearchResultRecord> searchResultRecords=new LinkedHashSet<>();
  for (  BusinessMetadataRecord bmr : results) {
    MetadataSearchTargetType finalType=type;
    if (finalType == null || finalType == MetadataSearchTargetType.ALL) {
      Id.NamespacedId namespacedId=bmr.getTargetId();
      String targetType=getTargetType(namespacedId);
      finalType=getMetadataSearchTarget(targetType);
    }
    MetadataSearchResultRecord msr=new MetadataSearchResultRecord(bmr.getTargetId(),finalType);
    searchResultRecords.add(msr);
  }
  return searchResultRecords;
}

Fixed version (ground truth):
@Override public Set<MetadataSearchResultRecord> searchMetadata(String namespaceId,String searchQuery,@Nullable final MetadataSearchTargetType type) throws NotFoundException {
  Iterable<BusinessMetadataRecord> results;
  if (type == null) {
    results=businessMds.searchMetadata(namespaceId,searchQuery);
  }
 else {
    results=businessMds.searchMetadataOnType(namespaceId,searchQuery,type);
  }
  Set<MetadataSearchResultRecord> searchResultRecords=new LinkedHashSet<>();
  for (  BusinessMetadataRecord bmr : results) {
    MetadataSearchTargetType finalType=type;
    if (finalType == null || finalType == MetadataSearchTargetType.ALL) {
      Id.NamespacedId namespacedId=bmr.getTargetId();
      String targetType=getTargetType(namespacedId);
      finalType=getMetadataSearchTarget(targetType);
    }
    MetadataSearchResultRecord msr=new MetadataSearchResultRecord(bmr.getTargetId(),finalType);
    searchResultRecords.add(msr);
  }
  return searchResultRecords;
}
Program: 6561
Project: 6561
Buggy source:
/** 
 * Execute search for metadata for particular type of CDAP object.
 * @param searchQuery The query need to be executed for the search.
 * @param type The particular type of CDAP object that the metadata need to be searched. If null all possible typeswill be searched.
 * @return a {@link Set} records for metadata search.
 * @throws NotFoundException if there is not record found for particular query text.
 */
Set<MetadataSearchResultRecord> searchMetadata(String searchQuery,@Nullable MetadataSearchTargetType type) throws NotFoundException ;

Fixed version (ground truth):
/** 
 * Execute search for metadata for particular type of CDAP object.
 * @param namespaceId The namespace id to be filter the search by.
 * @param searchQuery The query need to be executed for the search.
 * @param type The particular type of CDAP object that the metadata need to be searched. If null all possible typeswill be searched.
 * @return a {@link Set} records for metadata search.
 * @throws NotFoundException if there is not record found for particular query text.
 */
Set<MetadataSearchResultRecord> searchMetadata(String namespaceId,String searchQuery,@Nullable MetadataSearchTargetType type) throws NotFoundException ;