nus-yam/ex-repair huggingface dataset:
Program: 4569
Project: 4569
Buggy source:
private void putProfile(NamespaceId namespace,String profileName,Profile profile,int expectedCode) throws Exception {
  HttpResponse response=doPut(String.format("String_Node_Str",namespace.getNamespace(),profileName),GSON.toJson(profile));
  Assert.assertEquals(expectedCode,response.getStatusLine().getStatusCode());
}

Fixed version (ground truth):
private void putProfile(NamespaceId namespace,String profileName,Object profile,int expectedCode) throws Exception {
  HttpResponse response=doPut(String.format("String_Node_Str",namespace.getNamespace(),profileName),GSON.toJson(profile));
  Assert.assertEquals(expectedCode,response.getStatusLine().getStatusCode());
}
Program: 4570
Project: 4570
Buggy source:
@VisibleForTesting static String getClusterName(ProgramRun programRun){
  String cleanedAppName=programRun.getApplication().replaceAll("String_Node_Str","String_Node_Str").toLowerCase();
  int maxAppLength=53 - programRun.getRun().length();
  if (cleanedAppName.length() > maxAppLength) {
    cleanedAppName=cleanedAppName.substring(0,maxAppLength);
  }
  return cleanedAppName + "String_Node_Str" + programRun.getRun();
}

Fixed version (ground truth):
@VisibleForTesting static String getClusterName(ProgramRun programRun){
  String cleanedAppName=programRun.getApplication().replaceAll("String_Node_Str","String_Node_Str").toLowerCase();
  int maxAppLength=51 - 5 - 1- programRun.getRun().length();
  if (cleanedAppName.length() > maxAppLength) {
    cleanedAppName=cleanedAppName.substring(0,maxAppLength);
  }
  return "String_Node_Str" + cleanedAppName + "String_Node_Str"+ programRun.getRun();
}
Program: 4572
Project: 4572
Buggy source:
@Override public TwillPreparer prepare(TwillApplication application){
  if (application instanceof AbstractProgramTwillApplication) {
    ProgramId programId=((AbstractProgramTwillApplication)application).getProgramId();
    return new ImpersonatedTwillPreparer(delegate.prepare(application),impersonator,programId);
  }
  return delegate.prepare(application);
}

Fixed version (ground truth):
@Override public TwillPreparer prepare(TwillApplication application){
  if (application instanceof ProgramTwillApplication) {
    ProgramId programId=((ProgramTwillApplication)application).getProgramId();
    return new ImpersonatedTwillPreparer(delegate.prepare(application),impersonator,programId);
  }
  return delegate.prepare(application);
}
Program: 4573
Project: 4573
Buggy source:
/** 
 * Fix all the possible inconsistent states for RunRecords that shows it is in RUNNING state but actually not via check to   {@link ProgramRuntimeService} for a type of CDAP program.
 * @return the set of fixed {@link ProgramRunId}.
 */
private Set<ProgramRunId> doFixRunRecords(){
  LOG.trace("String_Node_Str");
  Set<ProgramRunId> fixedPrograms=new HashSet<>();
  Predicate<RunRecordMeta> filter=createFilter(fixedPrograms);
  for (  ProgramRunStatus status : NOT_STOPPED_STATUSES) {
    long startTime=0L;
    while (true) {
      Map<ProgramRunId,RunRecordMeta> runs=store.getRuns(status,startTime,Long.MAX_VALUE,txBatchSize,filter);
      LOG.trace("String_Node_Str",runs.size());
      if (runs.isEmpty()) {
        break;
      }
      for (      RunRecordMeta record : runs.values()) {
        startTime=Math.max(startTime,RunIds.getTime(record.getPid(),TimeUnit.SECONDS));
        ProgramRunId programRunId=record.getProgramRunId();
        if (!fixedPrograms.contains(programRunId)) {
          String msg=String.format("String_Node_Str",programRunId,record.getStatus());
          programStateWriter.error(programRunId,new ProgramRunAbortedException(msg));
          fixedPrograms.add(programRunId);
          LOG.warn(msg);
        }
      }
    }
  }
  if (fixedPrograms.isEmpty()) {
    LOG.trace("String_Node_Str",NOT_STOPPED_STATUSES);
  }
 else {
    LOG.warn("String_Node_Str",fixedPrograms.size(),NOT_STOPPED_STATUSES);
  }
  return fixedPrograms;
}

Fixed version (ground truth):
/** 
 * Fix all the possible inconsistent states for RunRecords that shows it is in RUNNING state but actually not via check to   {@link ProgramRuntimeService} for a type of CDAP program.
 * @return the set of fixed {@link ProgramRunId}.
 */
private Set<ProgramRunId> doFixRunRecords(){
  LOG.trace("String_Node_Str");
  Set<ProgramRunId> fixedPrograms=new HashSet<>();
  Predicate<RunRecordMeta> filter=createFilter(fixedPrograms);
  for (  ProgramRunStatus status : NOT_STOPPED_STATUSES) {
    while (true) {
      Map<ProgramRunId,RunRecordMeta> runs=store.getRuns(status,0L,Long.MAX_VALUE,txBatchSize,filter);
      LOG.trace("String_Node_Str",runs.size(),status);
      if (runs.isEmpty()) {
        break;
      }
      for (      RunRecordMeta record : runs.values()) {
        ProgramRunId programRunId=record.getProgramRunId();
        String msg=String.format("String_Node_Str",programRunId,record.getStatus());
        programStateWriter.error(programRunId,new ProgramRunAbortedException(msg));
        fixedPrograms.add(programRunId);
        LOG.warn(msg);
      }
    }
  }
  if (fixedPrograms.isEmpty()) {
    LOG.trace("String_Node_Str",NOT_STOPPED_STATUSES);
  }
 else {
    LOG.warn("String_Node_Str",fixedPrograms.size(),NOT_STOPPED_STATUSES);
  }
  return fixedPrograms;
}
Program: 4574
Project: 4574
Buggy source:
private void verifyRunningProgramCount(final Id.Program program,final String runId,final int expected) throws Exception {
  Tasks.waitFor(expected,new Callable<Integer>(){
    @Override public Integer call() throws Exception {
      return runningProgramCount(program,runId);
    }
  }
,10,TimeUnit.SECONDS);
}

Fixed version (ground truth):
private void verifyRunningProgramCount(final Id.Program program,final String runId,final int expected) throws Exception {
  Tasks.waitFor(expected,() -> runningProgramCount(program,runId),10,TimeUnit.SECONDS);
}
Program: 4575
Project: 4575
Buggy source:
private void waitForStatusCode(final String path,final Id.Program program,final int expectedStatusCode) throws Exception {
  Tasks.waitFor(true,new Callable<Boolean>(){
    @Override public Boolean call() throws Exception {
      HttpResponse response=doPost(getVersionedAPIPath(path,Constants.Gateway.API_VERSION_3_TOKEN,program.getNamespaceId()));
      return expectedStatusCode == response.getStatusLine().getStatusCode();
    }
  }
,60,TimeUnit.SECONDS);
}

Fixed version (ground truth):
private void waitForStatusCode(final String path,final Id.Program program,final int expectedStatusCode) throws Exception {
  Tasks.waitFor(true,() -> {
    HttpResponse response=doPost(getVersionedAPIPath(path,Constants.Gateway.API_VERSION_3_TOKEN,program.getNamespaceId()));
    return expectedStatusCode == response.getStatusLine().getStatusCode();
  }
,60,TimeUnit.SECONDS);
}
Program: 4578
Project: 4578
Buggy source:
private String getRunIdOfRunningProgram(final Id.Program programId) throws Exception {
  Tasks.waitFor(1,new Callable<Integer>(){
    @Override public Integer call() throws Exception {
      return getProgramRuns(programId,ProgramRunStatus.RUNNING).size();
    }
  }
,5,TimeUnit.SECONDS);
  List<RunRecord> historyRuns=getProgramRuns(programId,ProgramRunStatus.RUNNING);
  Assert.assertEquals(1,historyRuns.size());
  RunRecord record=historyRuns.get(0);
  return record.getPid();
}

Fixed version (ground truth):
private String getRunIdOfRunningProgram(final Id.Program programId) throws Exception {
  Tasks.waitFor(1,() -> getProgramRuns(programId,ProgramRunStatus.RUNNING).size(),5,TimeUnit.SECONDS);
  List<RunRecord> historyRuns=getProgramRuns(programId,ProgramRunStatus.RUNNING);
  Assert.assertEquals(1,historyRuns.size());
  RunRecord record=historyRuns.get(0);
  return record.getPid();
}
Program: 4579
Project: 4579
Buggy source:
private void verifyFileExists(final List<File> fileList) throws Exception {
  Tasks.waitFor(true,new Callable<Boolean>(){
    @Override public Boolean call() throws Exception {
      for (      File file : fileList) {
        if (!file.exists()) {
          return false;
        }
      }
      return true;
    }
  }
,180,TimeUnit.SECONDS);
}

Fixed version (ground truth):
private void verifyFileExists(final List<File> fileList) throws Exception {
  Tasks.waitFor(true,() -> {
    for (    File file : fileList) {
      if (!file.exists()) {
        return false;
      }
    }
    return true;
  }
,180,TimeUnit.SECONDS);
}
Program: 4581
Project: 4581
Buggy source:
@Override public void start(ProgramRunId programRunId,ProgramOptions programOptions,@Nullable String twillRunId,ArtifactId artifactId){
}

Fixed version (ground truth):
@Override public void start(ProgramRunId programRunId,ProgramOptions programOptions,@Nullable String twillRunId,ProgramDescriptor programDescriptor){
}
Program: 4582
Project: 4582
Buggy source:
/** 
 * Updates the program run's status to be   {@link ProgramRunStatus#STARTING} at the start time given by the{@link ProgramRunId}
 * @param programRunId the id of the program run
 * @param twillRunId the run id of the twill application
 */
void start(ProgramRunId programRunId,ProgramOptions programOptions,@Nullable String twillRunId,ArtifactId artifactId);

Fixed version (ground truth):
/** 
 * Updates the program run's status to be   {@link ProgramRunStatus#STARTING} at the start time given by the{@link ProgramRunId}
 * @param programRunId the id of the program run
 * @param programOptions the program options
 * @param twillRunId the run id of the twill application
 * @param programDescriptor the program descriptor
 */
void start(ProgramRunId programRunId,ProgramOptions programOptions,@Nullable String twillRunId,ProgramDescriptor programDescriptor);
Program: 4583
Project: 4583
Buggy source:
@Override public void start(ProgramRunId programRunId,ProgramOptions programOptions,@Nullable String twillRunId,ArtifactId artifactId){
  ImmutableMap.Builder<String,String> properties=ImmutableMap.<String,String>builder().put(ProgramOptionConstants.PROGRAM_RUN_ID,GSON.toJson(programRunId)).put(ProgramOptionConstants.PROGRAM_STATUS,ProgramRunStatus.STARTING.name()).put(ProgramOptionConstants.USER_OVERRIDES,GSON.toJson(programOptions.getUserArguments().asMap())).put(ProgramOptionConstants.SYSTEM_OVERRIDES,GSON.toJson(programOptions.getArguments().asMap())).put(ProgramOptionConstants.ARTIFACT_ID,GSON.toJson(artifactId));
  if (twillRunId != null) {
    properties.put(ProgramOptionConstants.TWILL_RUN_ID,twillRunId);
  }
  publish(properties);
}

Fixed version (ground truth):
@Override public void start(ProgramRunId programRunId,ProgramOptions programOptions,@Nullable String twillRunId,ProgramDescriptor programDescriptor){
  ImmutableMap.Builder<String,String> properties=ImmutableMap.<String,String>builder().put(ProgramOptionConstants.PROGRAM_RUN_ID,GSON.toJson(programRunId)).put(ProgramOptionConstants.PROGRAM_STATUS,ProgramRunStatus.STARTING.name()).put(ProgramOptionConstants.USER_OVERRIDES,GSON.toJson(programOptions.getUserArguments().asMap())).put(ProgramOptionConstants.SYSTEM_OVERRIDES,GSON.toJson(programOptions.getArguments().asMap())).put(ProgramOptionConstants.PROGRAM_DESCRIPTOR,GSON.toJson(programDescriptor));
  if (twillRunId != null) {
    properties.put(ProgramOptionConstants.TWILL_RUN_ID,twillRunId);
  }
  publish(properties);
}
Program: 4584
Project: 4584
Buggy source:
/** 
 * Get the name of the provisioner for the profile
 * @param args arguments
 * @return name of the provisioner for the profile
 */
public static Map<String,String> getProfileProperties(Map<String,String> args){
  Map<String,String> properties=new HashMap<>();
  for (  Map.Entry<String,String> arg : args.entrySet()) {
    if (arg.getKey().startsWith(PROFILE_PROPERTIES_PREFIX)) {
      String key=arg.getKey().substring(PROFILE_PROPERTIES_PREFIX.length());
      properties.put(key,arg.getValue());
    }
  }
  return properties;
}

Fixed version (ground truth):
/** 
 * Get the properties for the profile
 * @param args arguments
 * @return properties for the profile
 */
public static Map<String,String> getProfileProperties(Map<String,String> args){
  Map<String,String> properties=new HashMap<>();
  for (  Map.Entry<String,String> arg : args.entrySet()) {
    if (arg.getKey().startsWith(PROFILE_PROPERTIES_PREFIX)) {
      String key=arg.getKey().substring(PROFILE_PROPERTIES_PREFIX.length());
      properties.put(key,arg.getValue());
    }
  }
  return properties;
}
Program: 4585
Project: 4585
Buggy source:
private void runAndWait(ProgramRunner programRunner,Program program,ProgramOptions options) throws Exception {
  Closeable closeable=createCloseable(programRunner,program);
  RunId runId=ProgramRunners.getRunId(options);
  String twillRunId=options.getArguments().getOption(ProgramOptionConstants.TWILL_RUN_ID);
  programStateWriter.start(program.getId().run(runId),options,twillRunId,program.getApplicationSpecification().getArtifactId());
  ProgramController controller;
  try {
    controller=programRunner.run(program,options);
  }
 catch (  Throwable t) {
    programStateWriter.error(program.getId().run(runId),t);
    Closeables.closeQuietly(closeable);
    throw t;
  }
  blockForCompletion(closeable,controller);
  if (controller instanceof WorkflowTokenProvider) {
    updateWorkflowToken(((WorkflowTokenProvider)controller).getWorkflowToken());
  }
 else {
    throw new IllegalStateException("String_Node_Str" + program.getId());
  }
}

Fixed version (ground truth):
private void runAndWait(ProgramRunner programRunner,Program program,ProgramOptions options) throws Exception {
  Closeable closeable=createCloseable(programRunner,program);
  RunId runId=ProgramRunners.getRunId(options);
  String twillRunId=options.getArguments().getOption(ProgramOptionConstants.TWILL_RUN_ID);
  ProgramDescriptor programDescriptor=new ProgramDescriptor(program.getId(),program.getApplicationSpecification());
  programStateWriter.start(program.getId().run(runId),options,twillRunId,programDescriptor);
  ProgramController controller;
  try {
    controller=programRunner.run(program,options);
  }
 catch (  Throwable t) {
    programStateWriter.error(program.getId().run(runId),t);
    Closeables.closeQuietly(closeable);
    throw t;
  }
  blockForCompletion(closeable,controller);
  if (controller instanceof WorkflowTokenProvider) {
    updateWorkflowToken(((WorkflowTokenProvider)controller).getWorkflowToken());
  }
 else {
    throw new IllegalStateException("String_Node_Str" + program.getId());
  }
}
Program: 4588
Project: 4588
Buggy source:
@Override protected void shutDown() throws Exception {
  coreSchedulerService.stopAndWait();
  routeStore.close();
  defaultEntityEnsurer.stopAndWait();
  cancelHttpService.cancel();
  programRuntimeService.stopAndWait();
  applicationLifecycleService.stopAndWait();
  systemArtifactLoader.stopAndWait();
  notificationService.stopAndWait();
  programNotificationSubscriberService.stopAndWait();
  runRecordCorrectorService.stopAndWait();
  pluginService.stopAndWait();
  if (appVersionUpgradeService != null) {
    appVersionUpgradeService.stopAndWait();
  }
}

Fixed version (ground truth):
@Override protected void shutDown() throws Exception {
  coreSchedulerService.stopAndWait();
  routeStore.close();
  defaultEntityEnsurer.stopAndWait();
  cancelHttpService.cancel();
  programRuntimeService.stopAndWait();
  applicationLifecycleService.stopAndWait();
  systemArtifactLoader.stopAndWait();
  notificationService.stopAndWait();
  programNotificationSubscriberService.stopAndWait();
  runRecordCorrectorService.stopAndWait();
  pluginService.stopAndWait();
  if (appVersionUpgradeService != null) {
    appVersionUpgradeService.stopAndWait();
  }
  provisioningService.stopAndWait();
}
Program: 4589
Project: 4589
Buggy source:
@Override public TwillPreparer prepare(TwillApplication application){
  if (application instanceof AbstractProgramTwillApplication) {
    ProgramId programId=((AbstractProgramTwillApplication)application).getProgramId();
    return new ImpersonatedTwillPreparer(delegate.prepare(application),impersonator,programId);
  }
  return delegate.prepare(application);
}

Fixed version (ground truth):
@Override public TwillPreparer prepare(TwillApplication application){
  if (application instanceof ProgramTwillApplication) {
    ProgramId programId=((ProgramTwillApplication)application).getProgramId();
    return new ImpersonatedTwillPreparer(delegate.prepare(application),impersonator,programId);
  }
  return delegate.prepare(application);
}
Program: 4590
Project: 4590
Buggy source:
public ProvisionerExtensionLoader(String extDirs){
  super(extDirs);
}

Fixed version (ground truth):
@Inject ProvisionerExtensionLoader(CConfiguration cConf){
  super(cConf.get(Constants.Provisioner.EXTENSIONS_DIR));
}
Program: 4591
Project: 4591
Buggy source:
/** 
 * Checks whether the existing run record meta of a given program run are in a state for the program run to transition into the given run status. This is required because program states are not guaranteed to be written in order. For example, starting can be written from a twill AM, while running may be written from a twill runnable. If the running state is written before the starting state, we don't want to record the state as starting once it is already running.
 * @param existing the existing run record meta of the given program run
 * @param sourceId unique id representing the source of program run status, such as the message id of the programrun status notification in TMS. The source id must increase as the recording time of the program run status increases, so that the attempt to persist program run status older than the existing program run status will be ignored
 * @param recordType the type of record corresponding to the current status
 * @return {@code true} if the program run is allowed to persist the given status, {@code false} otherwise
 */
private boolean isValid(RunRecordMeta existing,byte[] sourceId,String recordType){
  byte[] existingSourceId=existing.getSourceId();
  if (existingSourceId != null && Bytes.compareTo(sourceId,existingSourceId) <= 0) {
    LOG.debug("String_Node_Str" + "String_Node_Str",Bytes.toHexString(sourceId),Bytes.toHexString(existingSourceId),existing,recordType);
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Checks whether the existing run record meta of a given program run are in a state for the program run to transition into the given run status. This is required because program states are not guaranteed to be written in order. For example, starting can be written from a twill AM, while running may be written from a twill runnable. If the running state is written before the starting state, we don't want to record the state as starting once it is already running.
 * @param existing the existing run record meta of the given program run
 * @param sourceId unique id representing the source of program run status, such as the message id of the programrun status notification in TMS. The source id must increase as the recording time of the program run status increases, so that the attempt to persist program run status older than the existing program run status will be ignored
 * @param recordType the type of record corresponding to the current status
 * @return {@code true} if the program run is allowed to persist the given status, {@code false} otherwise
 */
private boolean isValid(RunRecordMeta existing,byte[] sourceId,String recordType){
  byte[] existingSourceId=existing.getSourceId();
  if (existingSourceId != null && Bytes.compareTo(sourceId,existingSourceId) <= 0) {
    LOG.debug("String_Node_Str" + "String_Node_Str",Bytes.toHexString(sourceId),Bytes.toHexString(existingSourceId),existing,recordType);
    return false;
  }
  return true;
}
Program: 4592
Project: 4592
Buggy source:
private TriggerStatusV2 readTrigger(TriggerKey key){
  byte[][] col=new byte[1][];
  col[0]=Bytes.toBytes(key.getName());
  Row result=table.get(TRIGGER_KEY,col);
  byte[] bytes=null;
  if (!result.isEmpty()) {
    bytes=result.get(col[0]);
  }
  if (bytes != null) {
    return (TriggerStatusV2)SerializationUtils.deserialize(bytes);
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@VisibleForTesting TriggerStatusV2 readTrigger(Table table,TriggerKey key){
  byte[][] col=new byte[1][];
  col[0]=Bytes.toBytes(key.getName());
  Row result=table.get(TRIGGER_KEY,col);
  byte[] bytes=null;
  if (!result.isEmpty()) {
    bytes=result.get(col[0]);
  }
  if (bytes != null) {
    return (TriggerStatusV2)SerializationUtils.deserialize(bytes);
  }
 else {
    return null;
  }
}
Program: 4593
Project: 4593
Buggy source:
private void upgradeTriggers(Table table){
  Row result=table.get(TRIGGER_KEY);
  if (result.isEmpty()) {
    return;
  }
  for (  byte[] column : result.getColumns().values()) {
    TriggerStatusV2 triggerStatus=(TriggerStatusV2)SerializationUtils.deserialize(column);
    TriggerKey oldTriggerKey=triggerStatus.trigger.getKey();
    boolean modified=addDefaultAppVersionIfNeeded(triggerStatus);
    if (modified) {
      if (readTrigger(triggerStatus.trigger.getKey()) == null) {
        persistTrigger(table,triggerStatus.trigger,triggerStatus.state);
      }
      removeTrigger(table,oldTriggerKey);
    }
  }
}

Fixed version (ground truth):
private void upgradeTriggers(Table table){
  Row result=table.get(TRIGGER_KEY);
  if (result.isEmpty()) {
    return;
  }
  for (  byte[] column : result.getColumns().values()) {
    TriggerStatusV2 triggerStatus=(TriggerStatusV2)SerializationUtils.deserialize(column);
    TriggerKey oldTriggerKey=triggerStatus.trigger.getKey();
    boolean modified=addDefaultAppVersionIfNeeded(triggerStatus);
    if (modified) {
      if (readTrigger(table,triggerStatus.trigger.getKey()) == null) {
        persistTrigger(table,triggerStatus.trigger,triggerStatus.state);
      }
      removeTrigger(table,oldTriggerKey);
    }
  }
}
Program: 4595
Project: 4595
Buggy source:
private void persistChangeOfState(final TriggerKey triggerKey,final Trigger.TriggerState newTriggerState){
  try {
    Preconditions.checkNotNull(triggerKey);
    factory.createExecutor(ImmutableList.of((TransactionAware)table)).execute(new TransactionExecutor.Subroutine(){
      @Override public void apply() throws Exception {
        TriggerStatusV2 storedTriggerStatus=readTrigger(triggerKey);
        if (storedTriggerStatus != null) {
          persistTrigger(table,storedTriggerStatus.trigger,newTriggerState);
        }
 else {
          LOG.warn("String_Node_Str",triggerKey,ScheduleStoreTableUtil.SCHEDULE_STORE_DATASET_NAME,newTriggerState);
        }
      }
    }
);
  }
 catch (  Throwable th) {
    throw Throwables.propagate(th);
  }
}

Fixed version (ground truth):
private void persistChangeOfState(final TriggerKey triggerKey,final Trigger.TriggerState newTriggerState){
  try {
    Preconditions.checkNotNull(triggerKey);
    factory.createExecutor(ImmutableList.of((TransactionAware)table)).execute(new TransactionExecutor.Subroutine(){
      @Override public void apply() throws Exception {
        TriggerStatusV2 storedTriggerStatus=readTrigger(table,triggerKey);
        if (storedTriggerStatus != null) {
          persistTrigger(table,storedTriggerStatus.trigger,newTriggerState);
        }
 else {
          LOG.warn("String_Node_Str",triggerKey,ScheduleStoreTableUtil.SCHEDULE_STORE_DATASET_NAME,newTriggerState);
        }
      }
    }
);
  }
 catch (  Throwable th) {
    throw Throwables.propagate(th);
  }
}
Program: 4596
Project: 4596
Buggy source:
private void removeJob(Table table,JobKey key){
  byte[][] col=new byte[1][];
  col[0]=Bytes.toBytes(key.toString());
  table.delete(JOB_KEY,col);
}

Fixed version (ground truth):
@VisibleForTesting void removeJob(Table table,JobKey key){
  byte[][] col=new byte[1][];
  col[0]=Bytes.toBytes(key.toString());
  table.delete(JOB_KEY,col);
}
Program: 4597
Project: 4597
Buggy source:
private static void schedulerSetup(boolean enablePersistence) throws SchedulerException {
  JobStore js;
  if (enablePersistence) {
    CConfiguration conf=injector.getInstance(CConfiguration.class);
    js=new DatasetBasedTimeScheduleStore(factory,new ScheduleStoreTableUtil(dsFramework,conf),conf);
  }
 else {
    js=new RAMJobStore();
  }
  SimpleThreadPool threadPool=new SimpleThreadPool(10,Thread.NORM_PRIORITY);
  threadPool.initialize();
  DirectSchedulerFactory.getInstance().createScheduler(DUMMY_SCHEDULER_NAME,"String_Node_Str",threadPool,js);
  scheduler=DirectSchedulerFactory.getInstance().getScheduler(DUMMY_SCHEDULER_NAME);
  scheduler.start();
}

Fixed version (ground truth):
private static void schedulerSetup(boolean enablePersistence) throws SchedulerException {
  JobStore js;
  if (enablePersistence) {
    CConfiguration conf=injector.getInstance(CConfiguration.class);
    tableUtil=new ScheduleStoreTableUtil(dsFramework,conf);
    datasetBasedTimeScheduleStore=new DatasetBasedTimeScheduleStore(factory,tableUtil,conf);
    js=datasetBasedTimeScheduleStore;
  }
 else {
    js=new RAMJobStore();
  }
  SimpleThreadPool threadPool=new SimpleThreadPool(10,Thread.NORM_PRIORITY);
  threadPool.initialize();
  DirectSchedulerFactory.getInstance().createScheduler(DUMMY_SCHEDULER_NAME,"String_Node_Str",threadPool,js);
  scheduler=DirectSchedulerFactory.getInstance().getScheduler(DUMMY_SCHEDULER_NAME);
  scheduler.start();
}
Program: 4599
Project: 4599
Buggy source:
private ProgramRunStatus recordProgramStop(ProgramId programId,String pid,long stopTs,ProgramRunStatus runStatus,@Nullable BasicThrowable failureCause,MDSKey.Builder builder,byte[] sourceId){
  List<RunRecordMeta> existingRecords=getRuns(programId,pid);
  boolean isValid=validateExistingRecords(existingRecords,programId,pid,sourceId,runStatus.name().toLowerCase(),runStatus);
  if (!isValid) {
    return null;
  }
  RunRecordMeta existing=existingRecords.get(0);
  MDSKey key=getProgramKeyBuilder(STATUS_TYPE_MAP.get(existing.getStatus()),programId).add(pid).build();
  deleteAll(key);
  Map<String,String> systemArgs=existing.getSystemArgs();
  if (systemArgs != null && systemArgs.containsKey(ProgramOptionConstants.WORKFLOW_NAME)) {
    addWorkflowNodeState(programId,pid,systemArgs,runStatus,failureCause,sourceId);
  }
  key=builder.add(getInvertedTsKeyPart(existing.getStartTs())).add(pid).build();
  write(key,new RunRecordMeta(existing,stopTs,runStatus,sourceId));
  return runStatus;
}

Fixed version (ground truth):
private ProgramRunStatus recordProgramStop(ProgramId programId,String pid,long stopTs,ProgramRunStatus runStatus,@Nullable BasicThrowable failureCause,MDSKey.Builder builder,byte[] sourceId){
  RunRecordMeta existing=getRun(programId,pid);
  boolean isValid=validateExistingRecord(existing,programId,pid,sourceId,runStatus.name().toLowerCase(),runStatus);
  if (!isValid) {
    return null;
  }
  MDSKey key=getProgramKeyBuilder(STATUS_TYPE_MAP.get(existing.getStatus()),programId).add(pid).build();
  deleteAll(key);
  Map<String,String> systemArgs=existing.getSystemArgs();
  if (systemArgs != null && systemArgs.containsKey(ProgramOptionConstants.WORKFLOW_NAME)) {
    addWorkflowNodeState(programId,pid,systemArgs,runStatus,failureCause,sourceId);
  }
  key=builder.add(getInvertedTsKeyPart(existing.getStartTs())).add(pid).build();
  write(key,new RunRecordMeta(existing,stopTs,runStatus,sourceId));
  return runStatus;
}
Program: 4600
Project: 4600
Buggy source:
private ProgramRunStatus recordProgramRunning(ProgramId programId,String pid,long runTs,String twillRunId,MDSKey.Builder keyBuilder,byte[] sourceId){
  List<RunRecordMeta> existingRecords=getRuns(programId,pid);
  boolean isValid=validateExistingRecords(existingRecords,programId,pid,sourceId,"String_Node_Str",ProgramRunStatus.RUNNING);
  if (!isValid) {
    return null;
  }
  RunRecordMeta existing=existingRecords.get(0);
  Map<String,String> systemArgs=existing.getSystemArgs();
  if (systemArgs != null && systemArgs.containsKey(ProgramOptionConstants.WORKFLOW_NAME)) {
    addWorkflowNodeState(programId,pid,systemArgs,ProgramRunStatus.RUNNING,null,sourceId);
  }
  MDSKey key=getProgramKeyBuilder(STATUS_TYPE_MAP.get(existing.getStatus()),programId).add(pid).build();
  deleteAll(key);
  key=keyBuilder.add(pid).build();
  RunRecordMeta meta=new RunRecordMeta(programId.run(pid),existing.getStartTs(),runTs,null,ProgramRunStatus.RUNNING,existing.getProperties(),systemArgs,twillRunId,sourceId);
  write(key,meta);
  return ProgramRunStatus.RUNNING;
}

Fixed version (ground truth):
private ProgramRunStatus recordProgramRunning(ProgramId programId,String pid,long runTs,String twillRunId,MDSKey.Builder keyBuilder,byte[] sourceId){
  RunRecordMeta existing=getRun(programId,pid);
  boolean isValid=validateExistingRecord(existing,programId,pid,sourceId,"String_Node_Str",ProgramRunStatus.RUNNING);
  if (!isValid) {
    return null;
  }
  Map<String,String> systemArgs=existing.getSystemArgs();
  if (systemArgs != null && systemArgs.containsKey(ProgramOptionConstants.WORKFLOW_NAME)) {
    addWorkflowNodeState(programId,pid,systemArgs,ProgramRunStatus.RUNNING,null,sourceId);
  }
  MDSKey key=getProgramKeyBuilder(STATUS_TYPE_MAP.get(existing.getStatus()),programId).add(pid).build();
  deleteAll(key);
  key=keyBuilder.add(pid).build();
  RunRecordMeta meta=new RunRecordMeta(programId.run(pid),existing.getStartTs(),runTs,null,ProgramRunStatus.RUNNING,existing.getProperties(),systemArgs,twillRunId,sourceId);
  write(key,meta);
  return ProgramRunStatus.RUNNING;
}
Program: 4601
Project: 4601
Buggy source:
/** 
 * Logs resume of a program run and sets the run status to   {@link ProgramRunStatus#RUNNING}.
 * @param programId id of the program
 * @param pid run id
 * @param sourceId id of the source of program run status, which is proportional to the timestamp ofwhen the current program run status is reached, e.g. a message id from TMS
 * @return {@link ProgramRunStatus#RUNNING} if it is successfully persisted, {@code null} otherwise.
 */
@Nullable public ProgramRunStatus recordProgramResumed(ProgramId programId,String pid,byte[] sourceId){
  List<RunRecordMeta> existingRecords=getRuns(programId,pid);
  boolean isValid=validateExistingRecords(existingRecords,programId,pid,sourceId,"String_Node_Str",ProgramRunStatus.RESUMING);
  if (!isValid && !existingRecords.isEmpty()) {
    return null;
  }
  RunRecordMeta existing=null;
  if (existingRecords.isEmpty()) {
    if (!upgradeComplete.get() && programId.getVersion().equals(ApplicationId.DEFAULT_VERSION)) {
      MDSKey key=getVersionLessProgramKeyBuilder(TYPE_RUN_RECORD_SUSPENDED,programId).add(pid).build();
      existing=get(key,RunRecordMeta.class);
    }
    if (existing == null) {
      LOG.error("String_Node_Str",programId,pid);
      return null;
    }
  }
 else {
    existing=existingRecords.get(0);
  }
  recordProgramSuspendResume(programId,pid,sourceId,existing,"String_Node_Str");
  return ProgramRunStatus.RUNNING;
}

Fixed version (ground truth):
/** 
 * Logs resume of a program run and sets the run status to   {@link ProgramRunStatus#RUNNING}.
 * @param programId id of the program
 * @param pid run id
 * @param sourceId id of the source of program run status, which is proportional to the timestamp ofwhen the current program run status is reached, e.g. a message id from TMS
 * @return {@link ProgramRunStatus#RUNNING} if it is successfully persisted, {@code null} otherwise.
 */
@Nullable public ProgramRunStatus recordProgramResumed(ProgramId programId,String pid,byte[] sourceId){
  RunRecordMeta existing=getRun(programId,pid);
  boolean isValid=validateExistingRecord(existing,programId,pid,sourceId,"String_Node_Str",ProgramRunStatus.RESUMING);
  if (!isValid && existing != null) {
    return null;
  }
  if (existing == null) {
    LOG.error("String_Node_Str",programId,pid);
    return null;
  }
  recordProgramSuspendResume(programId,pid,sourceId,existing,"String_Node_Str");
  return ProgramRunStatus.RUNNING;
}
Program: 4603
Project: 4603
Buggy source:
/** 
 * Logs suspend of a program run and sets the run status to   {@link ProgramRunStatus#SUSPENDED}.
 * @param programId id of the program
 * @param pid run id
 * @param sourceId id of the source of program run status, which is proportional to the timestamp ofwhen the current program run status is reached, e.g. a message id from TMS
 * @return {@link ProgramRunStatus#SUSPENDED} if it is successfully persisted, {@code null} otherwise.
 */
@Nullable public ProgramRunStatus recordProgramSuspend(ProgramId programId,String pid,byte[] sourceId){
  List<RunRecordMeta> existingRecords=getRuns(programId,pid);
  boolean isValid=validateExistingRecords(existingRecords,programId,pid,sourceId,"String_Node_Str",ProgramRunStatus.SUSPENDED);
  if (!isValid) {
    return null;
  }
  RunRecordMeta existing=existingRecords.get(0);
  recordProgramSuspendResume(programId,pid,sourceId,existing,"String_Node_Str");
  return ProgramRunStatus.SUSPENDED;
}

Fixed version (ground truth):
/** 
 * Logs suspend of a program run and sets the run status to   {@link ProgramRunStatus#SUSPENDED}.
 * @param programId id of the program
 * @param pid run id
 * @param sourceId id of the source of program run status, which is proportional to the timestamp ofwhen the current program run status is reached, e.g. a message id from TMS
 * @return {@link ProgramRunStatus#SUSPENDED} if it is successfully persisted, {@code null} otherwise.
 */
@Nullable public ProgramRunStatus recordProgramSuspend(ProgramId programId,String pid,byte[] sourceId){
  RunRecordMeta existing=getRun(programId,pid);
  boolean isValid=validateExistingRecord(existing,programId,pid,sourceId,"String_Node_Str",ProgramRunStatus.SUSPENDED);
  if (!isValid) {
    return null;
  }
  recordProgramSuspendResume(programId,pid,sourceId,existing,"String_Node_Str");
  return ProgramRunStatus.SUSPENDED;
}
Program: 4605
Project: 4605
Buggy source:
@Test public void testRunsLimit() throws Exception {
  ApplicationSpecification spec=Specifications.from(new AllProgramsApp());
  ApplicationId appId=new ApplicationId("String_Node_Str",spec.getName());
  store.addApplication(appId,spec);
  ProgramId flowProgramId=new ProgramId("String_Node_Str",spec.getName(),ProgramType.FLOW,"String_Node_Str");
  Assert.assertNotNull(store.getApplication(appId));
  long now=System.currentTimeMillis();
  setStartAndRunning(flowProgramId,"String_Node_Str",now - 3000);
  store.setStop(flowProgramId,"String_Node_Str",now - 100,ProgramController.State.COMPLETED.getRunStatus(),AppFabricTestHelper.createSourceId(++sourceId));
  setStartAndRunning(flowProgramId,"String_Node_Str",now - 2000);
  Map<ProgramRunId,RunRecordMeta> historymap=store.getRuns(flowProgramId,ProgramRunStatus.ALL,0,Long.MAX_VALUE,1);
  Assert.assertEquals(1,historymap.size());
}

Fixed version (ground truth):
@Test public void testRunsLimit() throws Exception {
  ApplicationSpecification spec=Specifications.from(new AllProgramsApp());
  ApplicationId appId=new ApplicationId("String_Node_Str",spec.getName());
  store.addApplication(appId,spec);
  ProgramId flowProgramId=new ProgramId("String_Node_Str",spec.getName(),ProgramType.FLOW,"String_Node_Str");
  Assert.assertNotNull(store.getApplication(appId));
  long now=System.currentTimeMillis();
  String runId=RunIds.generate().getId();
  setStartAndRunning(flowProgramId,runId,now - 3000);
  store.setStop(flowProgramId,runId,now - 100,ProgramController.State.COMPLETED.getRunStatus(),AppFabricTestHelper.createSourceId(++sourceId));
  runId=RunIds.generate().getId();
  setStartAndRunning(flowProgramId,runId,now - 2000);
  Map<ProgramRunId,RunRecordMeta> historymap=store.getRuns(flowProgramId,ProgramRunStatus.ALL,0,Long.MAX_VALUE,1);
  Assert.assertEquals(1,historymap.size());
}
Program: 4606
Project: 4606
Buggy source:
private ProgramRunStatus recordProgramStop(ProgramId programId,String pid,long stopTs,ProgramRunStatus runStatus,@Nullable BasicThrowable failureCause,MDSKey.Builder builder,byte[] sourceId){
  List<RunRecordMeta> existingRecords=getRuns(programId,pid);
  boolean isValid=validateExistingRecords(existingRecords,programId,pid,sourceId,runStatus.name().toLowerCase(),runStatus);
  if (!isValid) {
    return null;
  }
  RunRecordMeta existing=existingRecords.get(0);
  MDSKey key=getProgramKeyBuilder(STATUS_TYPE_MAP.get(existing.getStatus()),programId).add(pid).build();
  deleteAll(key);
  Map<String,String> systemArgs=existing.getSystemArgs();
  if (systemArgs != null && systemArgs.containsKey(ProgramOptionConstants.WORKFLOW_NAME)) {
    addWorkflowNodeState(programId,pid,systemArgs,runStatus,failureCause,sourceId);
  }
  key=builder.add(getInvertedTsKeyPart(existing.getStartTs())).add(pid).build();
  write(key,new RunRecordMeta(existing,stopTs,runStatus,sourceId));
  return runStatus;
}

Fixed version (ground truth):
private ProgramRunStatus recordProgramStop(ProgramId programId,String pid,long stopTs,ProgramRunStatus runStatus,@Nullable BasicThrowable failureCause,MDSKey.Builder builder,byte[] sourceId){
  RunRecordMeta existing=getRun(programId,pid);
  boolean isValid=validateExistingRecords(existing,programId,pid,sourceId,runStatus.name().toLowerCase(),runStatus);
  if (!isValid) {
    return null;
  }
  MDSKey key=getProgramKeyBuilder(STATUS_TYPE_MAP.get(existing.getStatus()),programId).add(pid).build();
  deleteAll(key);
  Map<String,String> systemArgs=existing.getSystemArgs();
  if (systemArgs != null && systemArgs.containsKey(ProgramOptionConstants.WORKFLOW_NAME)) {
    addWorkflowNodeState(programId,pid,systemArgs,runStatus,failureCause,sourceId);
  }
  key=builder.add(getInvertedTsKeyPart(existing.getStartTs())).add(pid).build();
  write(key,new RunRecordMeta(existing,stopTs,runStatus,sourceId));
  return runStatus;
}
Program: 4607
Project: 4607
Buggy source:
private ProgramRunStatus recordProgramRunning(ProgramId programId,String pid,long runTs,String twillRunId,MDSKey.Builder keyBuilder,byte[] sourceId){
  List<RunRecordMeta> existingRecords=getRuns(programId,pid);
  boolean isValid=validateExistingRecords(existingRecords,programId,pid,sourceId,"String_Node_Str",ProgramRunStatus.RUNNING);
  if (!isValid) {
    return null;
  }
  RunRecordMeta existing=existingRecords.get(0);
  Map<String,String> systemArgs=existing.getSystemArgs();
  if (systemArgs != null && systemArgs.containsKey(ProgramOptionConstants.WORKFLOW_NAME)) {
    addWorkflowNodeState(programId,pid,systemArgs,ProgramRunStatus.RUNNING,null,sourceId);
  }
  MDSKey key=getProgramKeyBuilder(STATUS_TYPE_MAP.get(existing.getStatus()),programId).add(pid).build();
  deleteAll(key);
  key=keyBuilder.add(pid).build();
  RunRecordMeta meta=new RunRecordMeta(programId.run(pid),existing.getStartTs(),runTs,null,ProgramRunStatus.RUNNING,existing.getProperties(),systemArgs,twillRunId,sourceId);
  write(key,meta);
  return ProgramRunStatus.RUNNING;
}

Fixed version (ground truth):
private ProgramRunStatus recordProgramRunning(ProgramId programId,String pid,long runTs,String twillRunId,MDSKey.Builder keyBuilder,byte[] sourceId){
  RunRecordMeta existing=getRun(programId,pid);
  boolean isValid=validateExistingRecords(existing,programId,pid,sourceId,"String_Node_Str",ProgramRunStatus.RUNNING);
  if (!isValid) {
    return null;
  }
  Map<String,String> systemArgs=existing.getSystemArgs();
  if (systemArgs != null && systemArgs.containsKey(ProgramOptionConstants.WORKFLOW_NAME)) {
    addWorkflowNodeState(programId,pid,systemArgs,ProgramRunStatus.RUNNING,null,sourceId);
  }
  MDSKey key=getProgramKeyBuilder(STATUS_TYPE_MAP.get(existing.getStatus()),programId).add(pid).build();
  deleteAll(key);
  key=keyBuilder.add(pid).build();
  RunRecordMeta meta=new RunRecordMeta(programId.run(pid),existing.getStartTs(),runTs,null,ProgramRunStatus.RUNNING,existing.getProperties(),systemArgs,twillRunId,sourceId);
  write(key,meta);
  return ProgramRunStatus.RUNNING;
}
Program: 4609
Project: 4609
Buggy source:
/** 
 * Logs resume of a program run and sets the run status to   {@link ProgramRunStatus#RUNNING}.
 * @param programId id of the program
 * @param pid run id
 * @param sourceId id of the source of program run status, which is proportional to the timestamp ofwhen the current program run status is reached, e.g. a message id from TMS
 * @return {@link ProgramRunStatus#RUNNING} if it is successfully persisted, {@code null} otherwise.
 */
@Nullable public ProgramRunStatus recordProgramResumed(ProgramId programId,String pid,byte[] sourceId){
  List<RunRecordMeta> existingRecords=getRuns(programId,pid);
  boolean isValid=validateExistingRecords(existingRecords,programId,pid,sourceId,"String_Node_Str",ProgramRunStatus.RESUMING);
  if (!isValid && !existingRecords.isEmpty()) {
    return null;
  }
  RunRecordMeta existing=null;
  if (existingRecords.isEmpty()) {
    if (!upgradeComplete.get() && programId.getVersion().equals(ApplicationId.DEFAULT_VERSION)) {
      MDSKey key=getVersionLessProgramKeyBuilder(TYPE_RUN_RECORD_SUSPENDED,programId).add(pid).build();
      existing=get(key,RunRecordMeta.class);
    }
    if (existing == null) {
      LOG.error("String_Node_Str",programId,pid);
      return null;
    }
  }
 else {
    existing=existingRecords.get(0);
  }
  recordProgramSuspendResume(programId,pid,sourceId,existing,"String_Node_Str");
  return ProgramRunStatus.RUNNING;
}

Fixed version (ground truth):
/** 
 * Logs resume of a program run and sets the run status to   {@link ProgramRunStatus#RUNNING}.
 * @param programId id of the program
 * @param pid run id
 * @param sourceId id of the source of program run status, which is proportional to the timestamp ofwhen the current program run status is reached, e.g. a message id from TMS
 * @return {@link ProgramRunStatus#RUNNING} if it is successfully persisted, {@code null} otherwise.
 */
@Nullable public ProgramRunStatus recordProgramResumed(ProgramId programId,String pid,byte[] sourceId){
  RunRecordMeta existing=getRun(programId,pid);
  boolean isValid=validateExistingRecords(existing,programId,pid,sourceId,"String_Node_Str",ProgramRunStatus.RESUMING);
  if (!isValid && existing != null) {
    return null;
  }
  if (existing == null) {
    LOG.error("String_Node_Str",programId,pid);
    return null;
  }
  recordProgramSuspendResume(programId,pid,sourceId,existing,"String_Node_Str");
  return ProgramRunStatus.RUNNING;
}
Program: 4611
Project: 4611
Buggy source:
/** 
 * Logs suspend of a program run and sets the run status to   {@link ProgramRunStatus#SUSPENDED}.
 * @param programId id of the program
 * @param pid run id
 * @param sourceId id of the source of program run status, which is proportional to the timestamp ofwhen the current program run status is reached, e.g. a message id from TMS
 * @return {@link ProgramRunStatus#SUSPENDED} if it is successfully persisted, {@code null} otherwise.
 */
@Nullable public ProgramRunStatus recordProgramSuspend(ProgramId programId,String pid,byte[] sourceId){
  List<RunRecordMeta> existingRecords=getRuns(programId,pid);
  boolean isValid=validateExistingRecords(existingRecords,programId,pid,sourceId,"String_Node_Str",ProgramRunStatus.SUSPENDED);
  if (!isValid) {
    return null;
  }
  RunRecordMeta existing=existingRecords.get(0);
  recordProgramSuspendResume(programId,pid,sourceId,existing,"String_Node_Str");
  return ProgramRunStatus.SUSPENDED;
}

Fixed version (ground truth):
/** 
 * Logs suspend of a program run and sets the run status to   {@link ProgramRunStatus#SUSPENDED}.
 * @param programId id of the program
 * @param pid run id
 * @param sourceId id of the source of program run status, which is proportional to the timestamp ofwhen the current program run status is reached, e.g. a message id from TMS
 * @return {@link ProgramRunStatus#SUSPENDED} if it is successfully persisted, {@code null} otherwise.
 */
@Nullable public ProgramRunStatus recordProgramSuspend(ProgramId programId,String pid,byte[] sourceId){
  RunRecordMeta existing=getRun(programId,pid);
  boolean isValid=validateExistingRecords(existing,programId,pid,sourceId,"String_Node_Str",ProgramRunStatus.SUSPENDED);
  if (!isValid) {
    return null;
  }
  recordProgramSuspendResume(programId,pid,sourceId,existing,"String_Node_Str");
  return ProgramRunStatus.SUSPENDED;
}
Program: 4612
Project: 4612
Buggy source:
@Override public DatasetSpecification configure(String instanceName,DatasetProperties properties){
  Partitioning partitioning=PartitionedFileSetProperties.getPartitioning(properties.getProperties());
  Preconditions.checkNotNull(partitioning,"String_Node_Str");
  DatasetProperties indexedTableProperties=DatasetProperties.builder().addAll(properties.getProperties()).add(IndexedTable.INDEX_COLUMNS_CONF_KEY,INDEXED_COLS).build();
  return DatasetSpecification.builder(instanceName,getName()).properties(properties.getProperties()).datasets(filesetDef.configure(FILESET_NAME,properties),indexedTableDef.configure(PARTITION_TABLE_NAME,indexedTableProperties)).build();
}

Fixed version (ground truth):
@Override public DatasetSpecification configure(String instanceName,DatasetProperties properties){
  Partitioning partitioning=PartitionedFileSetProperties.getPartitioning(properties.getProperties());
  Preconditions.checkNotNull(partitioning,"String_Node_Str");
  DatasetProperties indexedTableProperties=DatasetProperties.builder().addAll(properties.getProperties()).add(IndexedTable.INDEX_COLUMNS_CONF_KEY,INDEXED_COLS).build();
  Map<String,String> pfsProperties=new HashMap<>(properties.getProperties());
  String defaultBasePathStr=properties.getProperties().get(NAME_AS_BASE_PATH_DEFAULT);
  boolean useNameAsBasePathDefault=defaultBasePathStr == null || Boolean.parseBoolean(defaultBasePathStr);
  DatasetProperties.Builder fileProperties=DatasetProperties.builder().addAll(properties.getProperties());
  if (useNameAsBasePathDefault && !properties.getProperties().containsKey(FileSetProperties.BASE_PATH)) {
    fileProperties.add(FileSetProperties.BASE_PATH,instanceName);
    pfsProperties.put(NAME_AS_BASE_PATH_DEFAULT,Boolean.TRUE.toString());
  }
  return DatasetSpecification.builder(instanceName,getName()).properties(pfsProperties).datasets(filesetDef.configure(FILESET_NAME,fileProperties.build()),indexedTableDef.configure(PARTITION_TABLE_NAME,indexedTableProperties)).build();
}
Program: 4615
Project: 4615
Buggy source:
private void checkMutualExclusive(Map<String,String> props,String key1,String key2){
  Preconditions.checkArgument(!(Boolean.valueOf(props.get(key1)) && Boolean.valueOf(props.get(key2))),"String_Node_Str",FileSetProperties.DATA_EXTERNAL,FileSetProperties.DATA_USE_EXISTING);
}

Fixed version (ground truth):
private void checkMutualExclusive(Map<String,String> props,String key1,String key2){
  Preconditions.checkArgument(!(Boolean.valueOf(props.get(key1)) && Boolean.valueOf(props.get(key2))),"String_Node_Str",key1,key2);
}
Program: 4618
Project: 4618
Buggy source:
@Override public void exceptionCaught(ChannelHandlerContext ctx,Throwable cause) throws Exception {
  LOG.error("String_Node_Str",cause.getMessage(),cause);
  HttpResponse response=new DefaultFullHttpResponse(HttpVersion.HTTP_1_1,HttpResponseStatus.UNAUTHORIZED);
  ctx.channel().writeAndFlush(response).addListener(ChannelFutureListener.CLOSE);
}

Fixed version (ground truth):
@Override public void exceptionCaught(ChannelHandlerContext ctx,Throwable cause) throws Exception {
  LOG.error("String_Node_Str",cause.getMessage(),cause);
  HttpResponse response=new DefaultFullHttpResponse(HttpVersion.HTTP_1_1,HttpResponseStatus.UNAUTHORIZED);
  HttpUtil.setContentLength(response,0);
  HttpUtil.setKeepAlive(response,false);
  ctx.channel().writeAndFlush(response).addListener(ChannelFutureListener.CLOSE);
}
Program: 4620
Project: 4620
Buggy source:
private ChannelFutureListener getFailureResponseListener(final Channel inboundChannel){
  if (failureResponseListener == null) {
    failureResponseListener=new ChannelFutureListener(){
      @Override public void operationComplete(      ChannelFuture future) throws Exception {
        if (!future.isSuccess()) {
          inboundChannel.writeAndFlush(createErrorResponse(future.cause())).addListener(ChannelFutureListener.CLOSE);
        }
      }
    }
;
  }
  return failureResponseListener;
}

Fixed version (ground truth):
private ChannelFutureListener getFailureResponseListener(final Channel inboundChannel){
  if (failureResponseListener == null) {
    failureResponseListener=new ChannelFutureListener(){
      @Override public void operationComplete(      ChannelFuture future) throws Exception {
        if (!future.isSuccess()) {
          HttpResponse response=createErrorResponse(future.cause());
          HttpUtil.setKeepAlive(response,false);
          inboundChannel.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE);
        }
      }
    }
;
  }
  return failureResponseListener;
}