nus-yam/ex-repair huggingface dataset:
Program: 4529
Project: 4529
Buggy source:
/** 
 * Sets up a mapping which describes the order of occurrence of comma separated fields - mapping their ordinal position to the   {@link Encoder}which services the encoding of the field occurring in that position. This sequence of types is contained by an instance of   {@link Header} whichmakes available an array of  {@link FieldMetaType}s.
 */
private void makeIndexEncoderMap(){
  indexToEncoderMap=new TIntObjectHashMap<Encoder<?>>();
  final FieldMetaType[] fieldTypes=header.getFieldTypes().toArray(new FieldMetaType[header.getFieldTypes().size()]);
  for (int i=0; i < fieldTypes.length; i++) {
switch (fieldTypes[i]) {
case DATETIME:
      Optional<DateEncoder> de=getDateEncoder(encoder);
    if (de.isPresent()) {
      indexToEncoderMap.put(i,de.get());
    }
 else {
      throw new IllegalArgumentException("String_Node_Str");
    }
  break;
case BOOLEAN:
case FLOAT:
case INTEGER:
Optional<Encoder<?>> opt=getNumberEncoder(encoder);
if (opt.isPresent()) {
indexToEncoderMap.put(i,opt.get());
}
 else {
throw new IllegalArgumentException("String_Node_Str");
}
break;
case LIST:
case STRING:
opt=getCategoryEncoder(encoder);
if (opt.isPresent()) {
indexToEncoderMap.put(i,opt.get());
}
 else {
throw new IllegalArgumentException("String_Node_Str");
}
break;
case COORD:
case GEO:
opt=getCoordinateEncoder(encoder);
if (opt.isPresent()) {
indexToEncoderMap.put(i,opt.get());
}
 else {
throw new IllegalArgumentException("String_Node_Str");
}
break;
default :
break;
}
}
}

Fixed version (ground truth):
/** 
 * Sets up a mapping which describes the order of occurrence of comma separated fields - mapping their ordinal position to the   {@link Encoder}which services the encoding of the field occurring in that position. This sequence of types is contained by an instance of   {@link Header} whichmakes available an array of  {@link FieldMetaType}s.
 */
private void makeIndexEncoderMap(){
  indexToEncoderMap=new TIntObjectHashMap<Encoder<?>>();
  for (int i=0, size=header.getFieldNames().size(); i < size; i++) {
switch (header.getFieldTypes().get(i)) {
case DATETIME:
      Optional<DateEncoder> de=getDateEncoder(encoder);
    if (de.isPresent()) {
      indexToEncoderMap.put(i,de.get());
    }
 else {
      throw new IllegalArgumentException("String_Node_Str" + header.getFieldNames().get(i));
    }
  break;
case BOOLEAN:
case FLOAT:
case INTEGER:
Optional<Encoder<?>> ne=getNumberEncoder(encoder);
if (ne.isPresent()) {
indexToEncoderMap.put(i,ne.get());
}
 else {
throw new IllegalArgumentException("String_Node_Str" + header.getFieldNames().get(i));
}
break;
case LIST:
case STRING:
Optional<Encoder<?>> ce=getCategoryEncoder(encoder);
if (ce.isPresent()) {
indexToEncoderMap.put(i,ce.get());
}
 else {
throw new IllegalArgumentException("String_Node_Str" + header.getFieldNames().get(i));
}
break;
case COORD:
case GEO:
Optional<Encoder<?>> ge=getCoordinateEncoder(encoder);
if (ge.isPresent()) {
indexToEncoderMap.put(i,ge.get());
}
 else {
throw new IllegalArgumentException("String_Node_Str" + header.getFieldNames().get(i));
}
break;
default :
break;
}
}
}
Program: 4530
Project: 4530
Buggy source:
public static String path(String s){
  URL url=ResourceLocator.class.getResource(s);
  if (url == null) {
    url=ResourceLocator.class.getClassLoader().getResource(s);
  }
  return url.getPath();
}

Fixed version (ground truth):
public static String path(String s){
  URL url=ResourceLocator.class.getResource(s);
  if (url == null) {
    url=ResourceLocator.class.getClassLoader().getResource(s);
  }
  return new File(url.getPath()).getPath();
}
Program: 4531
Project: 4531
Buggy source:
/** 
 * Called internally to create this csv stream's header
 */
private void makeHeader(){
  List<String[]> contents=new ArrayList<>();
  if (headerStateTracker < fence) {
    LOGGER.warn("String_Node_Str" + fence + "String_Node_Str");
  }
  int i=0;
  while (i++ < fence)   contents.add(it.next());
  this.header=new BatchedCsvHeader(contents,fence);
}

Fixed version (ground truth):
/** 
 * Called internally to create this csv stream's header
 */
private void makeHeader(){
  List<String[]> contents=new ArrayList<>();
  if (headerStateTracker < fence) {
    LOGGER.warn("String_Node_Str" + fence + "String_Node_Str");
  }
  int i=0;
  while (i++ < fence) {
    String[] h=it.next();
    System.out.println("String_Node_Str" + i + "String_Node_Str"+ Arrays.toString(h));
    contents.add(h);
  }
  this.header=new BatchedCsvHeader(contents,fence);
}
Program: 4532
Project: 4532
Buggy source:
@Ignore public void testProgrammaticStream(){
  PublishSubject<String> manual=PublishSubject.create();
  Object[] n={"String_Node_Str",manual};
  SensorParams parms=SensorParams.create(Keys::obs,n);
  Sensor<ObservableSensor<String[]>> sensor=Sensor.create(ObservableSensor::create,parms);
  long count=sensor.getInputStream().count();
  assertEquals(4391,count);
}

Fixed version (ground truth):
@Test public void testProgrammaticStream(){
  final ReplaySubject<String> manual=ReplaySubject.create();
  manual.onNext("String_Node_Str");
  manual.onNext("String_Node_Str");
  manual.onNext("String_Node_Str");
  System.out.println("String_Node_Str");
  Object[] n={"String_Node_Str",manual};
  SensorParams parms=SensorParams.create(Keys::obs,n);
  final Sensor<ObservableSensor<String>> sensor=Sensor.create(ObservableSensor::create,parms);
  (new Thread(){
    public void run(){
      sensor.getInputStream().forEach(l -> {
        System.out.println(l);
      }
);
    }
  }
).start();
  String[] entries={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  manual.onNext(entries[0]);
  manual.onNext(entries[1]);
  manual.onNext(entries[2]);
  manual.onNext(entries[3]);
}
Program: 4533
Project: 4533
Buggy source:
/** 
 * {@inheritDoc}
 */
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @Override public void encodeIntoArray(Date inputData,int[] output){
  TDoubleList scalars=getScalars(inputData);
  int fieldCounter=0;
  for (  EncoderTuple t : getEncoders(this)) {
    String name=t.getName();
    Encoder encoder=t.getEncoder();
    int offset=t.getOffset();
    int[] tempArray=new int[encoder.getWidth()];
    encoder.encodeIntoArray(scalars.get(fieldCounter),tempArray);
    for (int i=0; i < tempArray.length; i++) {
      output[i + offset]=tempArray[i];
    }
    ++fieldCounter;
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @Override public void encodeIntoArray(Date inputData,int[] output){
  TDoubleList scalars=getScalars(inputData);
  int fieldCounter=0;
  for (  EncoderTuple t : getEncoders(this)) {
    Encoder encoder=t.getEncoder();
    int offset=t.getOffset();
    int[] tempArray=new int[encoder.getWidth()];
    encoder.encodeIntoArray(scalars.get(fieldCounter),tempArray);
    System.arraycopy(tempArray,0,output,offset,tempArray.length);
    ++fieldCounter;
  }
}
Program: 4534
Project: 4534
Buggy source:
/** 
 * Set how many bits are used to encode customDays
 */
public DateEncoder.Builder customDays(int customDays){
  return this.customDays(customDays,(ArrayList<String>)this.customDays.get(1));
}

Fixed version (ground truth):
/** 
 * Set how many bits are used to encode customDays
 */
@SuppressWarnings("String_Node_Str") public DateEncoder.Builder customDays(int customDays){
  return this.customDays(customDays,(ArrayList<String>)this.customDays.get(1));
}
Program: 4537
Project: 4537
Buggy source:
/** 
 * look at holiday more carefully because of the smooth transition
 */
@Test public void testHoliday(){
  DateEncoder e=DateEncoder.builder().holiday(5).forced(true).build();
  int[] holiday=new int[]{0,0,0,0,0,1,1,1,1,1};
  int[] notholiday=new int[]{1,1,1,1,1,0,0,0,0,0};
  int[] holiday2=new int[]{0,0,0,1,1,1,1,1,0,0};
  Date d=new DateTime(2010,12,25,4,55).toDate();
  assertArrayEquals(holiday,e.encode(d));
  d=new DateTime(2008,12,27,4,55).toDate();
  assertArrayEquals(notholiday,e.encode(d));
  d=new DateTime(1999,12,26,8,00).toDate();
  assertArrayEquals(holiday2,e.encode(d));
  d=new DateTime(2011,12,24,16,00).toDate();
  assertArrayEquals(holiday2,e.encode(d));
}

Fixed version (ground truth):
/** 
 * look at holiday more carefully because of the smooth transition
 */
@Test public void testHoliday(){
  DateEncoder e=DateEncoder.builder().holiday(5).forced(true).build();
  int[] holiday=new int[]{0,0,0,0,0,1,1,1,1,1};
  int[] notholiday=new int[]{1,1,1,1,1,0,0,0,0,0};
  int[] holiday2=new int[]{0,0,0,1,1,1,1,1,0,0};
  Date d=new DateTime(2010,12,25,4,55).toDate();
  assertArrayEquals(holiday,e.encode(d));
  d=new DateTime(2008,12,27,4,55).toDate();
  assertArrayEquals(notholiday,e.encode(d));
  d=new DateTime(1999,12,26,8,0).toDate();
  assertArrayEquals(holiday2,e.encode(d));
  d=new DateTime(2011,12,24,16,0).toDate();
  assertArrayEquals(holiday2,e.encode(d));
}
Program: 4538
Project: 4538
Buggy source:
/** 
 * Test weekend encoder
 */
@Test public void testWeekend(){
  DateEncoder e=DateEncoder.builder().customDays(21,Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str")).forced(true).build();
  DateEncoder mon=DateEncoder.builder().customDays(21,Arrays.asList("String_Node_Str")).forced(true).build();
  DateEncoder e2=DateEncoder.builder().weekend(21,1).forced(true).build();
  DateTime d=new DateTime(1988,5,29,20,00);
  assertArrayEquals(e.encode(d.toDate()),e2.encode(d.toDate()));
  for (int i=0; i < 300; i++) {
    DateTime curDate=d.plusDays(i + 1);
    assertArrayEquals(e.encode(curDate.toDate()),e2.encode(curDate.toDate()));
    Tuple decoded=mon.decode(mon.encode(curDate.toDate()),null);
    Map<String,RangeList> fieldsMap=(Map<String,RangeList>)decoded.get(0);
    List<String> fieldsOrder=(List<String>)decoded.get(1);
    assertNotNull(fieldsMap);
    assertNotNull(fieldsOrder);
    assertEquals(1,fieldsMap.size());
    RangeList range=fieldsMap.get("String_Node_Str");
    assertEquals(1,range.size());
    assertEquals(1,((List<MinMax>)range.get(0)).size());
    MinMax minmax=range.getRange(0);
    if (minmax.min() == 1.0) {
      assertEquals(1,curDate.getDayOfWeek());
    }
 else {
      assertNotEquals(1,curDate.getDayOfWeek());
    }
  }
}

Fixed version (ground truth):
/** 
 * Test weekend encoder
 */
@Test public void testWeekend(){
  DateEncoder e=DateEncoder.builder().customDays(21,Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str")).forced(true).build();
  DateEncoder mon=DateEncoder.builder().customDays(21,Arrays.asList("String_Node_Str")).forced(true).build();
  DateEncoder e2=DateEncoder.builder().weekend(21,1).forced(true).build();
  DateTime d=new DateTime(1988,5,29,20,0);
  assertArrayEquals(e.encode(d.toDate()),e2.encode(d.toDate()));
  for (int i=0; i < 300; i++) {
    DateTime curDate=d.plusDays(i + 1);
    assertArrayEquals(e.encode(curDate.toDate()),e2.encode(curDate.toDate()));
    Tuple decoded=mon.decode(mon.encode(curDate.toDate()),null);
    Map<String,RangeList> fieldsMap=(Map<String,RangeList>)decoded.get(0);
    List<String> fieldsOrder=(List<String>)decoded.get(1);
    assertNotNull(fieldsMap);
    assertNotNull(fieldsOrder);
    assertEquals(1,fieldsMap.size());
    RangeList range=fieldsMap.get("String_Node_Str");
    assertEquals(1,range.size());
    assertEquals(1,((List<MinMax>)range.get(0)).size());
    MinMax minmax=range.getRange(0);
    if (minmax.min() == 1.0) {
      assertEquals(1,curDate.getDayOfWeek());
    }
 else {
      assertNotEquals(1,curDate.getDayOfWeek());
    }
  }
}
Program: 4539
Project: 4539
Buggy source:
@Override public String toString(){
  StringBuilder sb=new StringBuilder();
  for (int i=0; i < container.length; i++) {
    try {
      new Double((double)container[i]);
      sb.append(container[i]);
    }
 catch (    Exception e) {
      sb.append("String_Node_Str").append(container[i]).append("String_Node_Str");
    }
    sb.append("String_Node_Str");
  }
  sb.setLength(sb.length() - 1);
  return sb.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  StringBuilder sb=new StringBuilder();
  for (int i=0; i < container.length; i++) {
    try {
      new Double(Double.parseDouble(container[i] + "String_Node_Str"));
      sb.append(container[i]);
    }
 catch (    Exception e) {
      sb.append("String_Node_Str").append(container[i]).append("String_Node_Str");
    }
    sb.append("String_Node_Str");
  }
  sb.setLength(sb.length() - 1);
  return sb.toString();
}
Program: 4543
Project: 4543
Buggy source:
/** 
 * Get the metrics context for the program, the tags are constructed with the program run id and the profile id
 */
private MetricsContext getMetricsContextForProfile(MetricsCollectionService metricsCollectionService,ProgramRunId programRunId,ProfileId profileId){
  Map<String,String> tags=ImmutableMap.<String,String>builder().put(Constants.Metrics.Tag.PROFILE_SCOPE,profileId.getScope().name()).put(Constants.Metrics.Tag.PROFILE,profileId.getScopedName()).put(Constants.Metrics.Tag.NAMESPACE,programRunId.getNamespace()).put(Constants.Metrics.Tag.PROGRAM_TYPE,programRunId.getType().getPrettyName()).put(Constants.Metrics.Tag.APP,programRunId.getApplication()).put(Constants.Metrics.Tag.PROGRAM,programRunId.getProgram()).put(Constants.Metrics.Tag.RUN_ID,programRunId.getRun()).build();
  return metricsCollectionService.getContext(tags);
}

Fixed version (ground truth):
/** 
 * Get the metrics context for the program, the tags are constructed with the program run id and the profile id
 */
private MetricsContext getMetricsContextForProfile(MetricsCollectionService metricsCollectionService,ProgramRunId programRunId,ProfileId profileId){
  Map<String,String> tags=ImmutableMap.<String,String>builder().put(Constants.Metrics.Tag.PROFILE_SCOPE,profileId.getScope().name()).put(Constants.Metrics.Tag.PROFILE,profileId.getProfile()).put(Constants.Metrics.Tag.NAMESPACE,programRunId.getNamespace()).put(Constants.Metrics.Tag.PROGRAM_TYPE,programRunId.getType().getPrettyName()).put(Constants.Metrics.Tag.APP,programRunId.getApplication()).put(Constants.Metrics.Tag.PROGRAM,programRunId.getProgram()).put(Constants.Metrics.Tag.RUN_ID,programRunId.getRun()).build();
  return metricsCollectionService.getContext(tags);
}
Program: 4544
Project: 4544
Buggy source:
@Override public void initializeCluster(ProvisionerContext context,Cluster cluster) throws Exception {
  try (SSHSession session=context.getSSHContext().createSSHSession(getMasterExternalIp(cluster))){
    LOG.debug("String_Node_Str");
    String output=session.executeAndWait("String_Node_Str");
    LOG.debug("String_Node_Str",output);
  }
 }

Fixed version (ground truth):
@Override public void initializeCluster(ProvisionerContext context,Cluster cluster) throws Exception {
  try (SSHSession session=createSSHSession(context,getMasterExternalIp(cluster))){
    LOG.debug("String_Node_Str");
    String output=session.executeAndWait("String_Node_Str");
    LOG.debug("String_Node_Str",output);
  }
 }
Program: 4545
Project: 4545
Buggy source:
@GET @Path("String_Node_Str") public void getUpgradeStatus(HttpRequest request,HttpResponder responder) throws Exception {
  responder.sendJson(HttpResponseStatus.OK,GSON.toJson(appVersionUpgradeService.getUpgradeStatus()));
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") public void getUpgradeStatus(HttpRequest request,HttpResponder responder) throws Exception {
  upgradeStatus.put("String_Node_Str",metadataService.isMigrationInProcess());
  responder.sendJson(HttpResponseStatus.OK,GSON.toJson(upgradeStatus));
}
Program: 4546
Project: 4546
Buggy source:
@Inject UpgradeHttpHandler(AppVersionUpgradeService appVersionUpgradeService){
  this.appVersionUpgradeService=appVersionUpgradeService;
}

Fixed version (ground truth):
@Inject UpgradeHttpHandler(MetadataService metadataService){
  this.upgradeStatus=new HashMap<>();
  this.metadataService=metadataService;
}
Program: 4547
Project: 4547
Buggy source:
private List<ProgramFieldOperationInfo> processOperations(Set<ProgramRunOperations> programRunOperations){
  List<ProgramFieldOperationInfo> result=new ArrayList<>();
  for (  ProgramRunOperations entry : programRunOperations) {
    List<ProgramInfo> programInfo=computeProgramInfo(entry.getProgramRunIds());
    List<FieldOperationInfo> fieldOperationInfo=computeFieldOperationInfo(entry.getOperations());
    result.add(new ProgramFieldOperationInfo(programInfo,fieldOperationInfo));
  }
  return result;
}

Fixed version (ground truth):
private List<ProgramFieldOperationInfo> processOperations(List<ProgramRunOperations> programRunOperations){
  List<ProgramFieldOperationInfo> result=new ArrayList<>();
  for (  ProgramRunOperations entry : programRunOperations) {
    List<ProgramInfo> programInfo=computeProgramInfo(entry.getProgramRunIds());
    List<FieldOperationInfo> fieldOperationInfo=computeFieldOperationInfo(entry.getOperations());
    result.add(new ProgramFieldOperationInfo(programInfo,fieldOperationInfo));
  }
  return result;
}
Program: 4549
Project: 4549
Buggy source:
private Constants.FieldLineage.Direction parseDirection(String directionStr) throws BadRequestException {
  try {
    return Constants.FieldLineage.Direction.valueOf(directionStr);
  }
 catch (  IllegalArgumentException e) {
    String directionValues=Joiner.on("String_Node_Str").join(Constants.FieldLineage.Direction.values());
    throw new BadRequestException(String.format("String_Node_Str" + "String_Node_Str",directionValues.toLowerCase()));
  }
}

Fixed version (ground truth):
private Constants.FieldLineage.Direction parseDirection(String directionStr) throws BadRequestException {
  try {
    return Constants.FieldLineage.Direction.valueOf(directionStr.toUpperCase());
  }
 catch (  IllegalArgumentException e) {
    String directionValues=Joiner.on("String_Node_Str").join(Constants.FieldLineage.Direction.values());
    throw new BadRequestException(String.format("String_Node_Str" + "String_Node_Str",directionValues.toLowerCase()));
  }
}
Program: 4550
Project: 4550
Buggy source:
public RuntimeMonitor(ProgramRunId programRunId,CConfiguration cConf,RuntimeMonitorClient monitorClient,DatasetFramework datasetFramework,Transactional transactional,MessagingContext messagingContext,ScheduledExecutorService scheduledExecutorService,ProfileMetricScheduledService metricScheduledService){
  super(RetryStrategies.fromConfiguration(cConf,"String_Node_Str"));
  this.programRunId=programRunId;
  this.cConf=cConf;
  this.monitorClient=monitorClient;
  this.limit=cConf.getInt(Constants.RuntimeMonitor.BATCH_LIMIT);
  this.pollTimeMillis=cConf.getLong(Constants.RuntimeMonitor.POLL_TIME_MS);
  this.gracefulShutdownMillis=cConf.getLong(Constants.RuntimeMonitor.GRACEFUL_SHUTDOWN_MS);
  this.topicsToRequest=new HashMap<>();
  this.datasetFramework=datasetFramework;
  this.messagingContext=messagingContext;
  this.transactional=transactional;
  this.scheduledExecutorService=scheduledExecutorService;
  this.programFinishTime=-1L;
  this.lastProgramStateMessages=new LinkedList<>();
  this.requestKeyToLocalTopic=createTopicConfigs(cConf);
  this.metricScheduledService=metricScheduledService;
}

Fixed version (ground truth):
public RuntimeMonitor(ProgramRunId programRunId,CConfiguration cConf,RuntimeMonitorClient monitorClient,DatasetFramework datasetFramework,Transactional transactional,MessagingContext messagingContext,ScheduledExecutorService scheduledExecutorService,RemoteExecutionLogProcessor logProcessor,ProfileMetricScheduledService metricScheduledService){
  super(RetryStrategies.fromConfiguration(cConf,"String_Node_Str"));
  this.programRunId=programRunId;
  this.cConf=cConf;
  this.monitorClient=monitorClient;
  this.limit=cConf.getInt(Constants.RuntimeMonitor.BATCH_LIMIT);
  this.pollTimeMillis=cConf.getLong(Constants.RuntimeMonitor.POLL_TIME_MS);
  this.gracefulShutdownMillis=cConf.getLong(Constants.RuntimeMonitor.GRACEFUL_SHUTDOWN_MS);
  this.topicsToRequest=new HashMap<>();
  this.datasetFramework=datasetFramework;
  this.messagingContext=messagingContext;
  this.transactional=transactional;
  this.scheduledExecutorService=scheduledExecutorService;
  this.logProcessor=logProcessor;
  this.programFinishTime=-1L;
  this.lastProgramStateMessages=new LinkedList<>();
  this.requestKeyToLocalTopic=createTopicConfigs(cConf);
  this.metricScheduledService=metricScheduledService;
}
Program: 4551
Project: 4551
Buggy source:
/** 
 * Transactionally publish the given set of messages to the local TMS.
 * @return the latest message publish time
 */
private long publish(String topicConfig,String topic,Deque<MonitorMessage> messages,AppMetadataStore store) throws Exception {
  MessagePublisher messagePublisher=messagingContext.getMessagePublisher();
  messagePublisher.publish(NamespaceId.SYSTEM.getNamespace(),topic,messages.stream().map(MonitorMessage::getMessage).iterator());
  MonitorMessage lastMessage=messages.getLast();
  store.persistSubscriberState(topicConfig,programRunId.getRun(),lastMessage.getMessageId());
  return getMessagePublishTime(lastMessage);
}

Fixed version (ground truth):
/** 
 * Transactionally publish the given set of messages to the local TMS.
 * @return the latest message publish time
 */
private long publish(String topicConfig,String topic,Deque<MonitorMessage> messages,AppMetadataStore store) throws Exception {
  if (topic.startsWith(cConf.get(Constants.Logging.TMS_TOPIC_PREFIX))) {
    logProcessor.process(messages.stream().map(MonitorMessage::getMessage).iterator());
  }
 else {
    MessagePublisher messagePublisher=messagingContext.getMessagePublisher();
    messagePublisher.publish(NamespaceId.SYSTEM.getNamespace(),topic,messages.stream().map(MonitorMessage::getMessage).iterator());
  }
  MonitorMessage lastMessage=messages.getLast();
  store.persistSubscriberState(topicConfig,programRunId.getRun(),lastMessage.getMessageId());
  return getMessagePublishTime(lastMessage);
}
Program: 4552
Project: 4552
Buggy source:
@Override public Map<String,String> getSystemTagsAsString(){
  return Maps.transformValues(getSystemTagsMap(),SYSTEM_TAG_TO_STRING);
}

Fixed version (ground truth):
@Override public Map<String,String> getSystemTagsAsString(){
  return Maps.transformValues(getSystemTagsMap(),SystemTag::getValue);
}
Program: 4553
Project: 4553
Buggy source:
/** 
 * Create a cluster. This will return after the initial request to create the cluster is completed. At this point, the cluster is likely not yet running, but in a provisioning state.
 * @param name the name of the cluster to create
 * @return the id of the created EMR cluster
 */
public String createCluster(String name){
  AmazonEC2 ec2=AmazonEC2ClientBuilder.standard().withCredentials(emrConf.getCredentialsProvider()).withRegion(emrConf.getRegion()).build();
  ec2.importKeyPair(new ImportKeyPairRequest(name,emrConf.getPublicKey().getKey()));
  RunJobFlowRequest request=new RunJobFlowRequest().withName(name).withApplications(new Application().withName("String_Node_Str")).withReleaseLabel("String_Node_Str").withServiceRole(emrConf.getServiceRole()).withJobFlowRole(emrConf.getJobFlowRole()).withInstances(new JobFlowInstancesConfig().withEc2KeyName(name).withAdditionalMasterSecurityGroups(emrConf.getAdditionalMasterSecurityGroup()).withInstanceCount(emrConf.getInstanceCount()).withEc2SubnetId(emrConf.getEc2SubnetId()).withKeepJobFlowAliveWhenNoSteps(true).withMasterInstanceType(emrConf.getMasterInstanceType()).withSlaveInstanceType(emrConf.getWorkerInstanceType()));
  if (emrConf.getLogURI() != null) {
    request.withLogUri(emrConf.getLogURI());
  }
  LOG.info("String_Node_Str",name);
  return client.runJobFlow(request).getJobFlowId();
}

Fixed version (ground truth):
/** 
 * Create a cluster. This will return after the initial request to create the cluster is completed. At this point, the cluster is likely not yet running, but in a provisioning state.
 * @param name the name of the cluster to create
 * @return the id of the created EMR cluster
 */
public String createCluster(String name){
  AmazonEC2 ec2=AmazonEC2ClientBuilder.standard().withCredentials(emrConf.getCredentialsProvider()).withRegion(emrConf.getRegion()).build();
  ec2.importKeyPair(new ImportKeyPairRequest(name,emrConf.getPublicKey().getKey()));
  RunJobFlowRequest request=new RunJobFlowRequest().withName(name).withApplications(new Application().withName("String_Node_Str")).withConfigurations(new Configuration().withClassification("String_Node_Str").withProperties(Collections.singletonMap("String_Node_Str","String_Node_Str"))).withReleaseLabel("String_Node_Str").withServiceRole(emrConf.getServiceRole()).withJobFlowRole(emrConf.getJobFlowRole()).withInstances(new JobFlowInstancesConfig().withEc2KeyName(name).withAdditionalMasterSecurityGroups(emrConf.getAdditionalMasterSecurityGroup()).withInstanceCount(emrConf.getInstanceCount()).withEc2SubnetId(emrConf.getEc2SubnetId()).withKeepJobFlowAliveWhenNoSteps(true).withMasterInstanceType(emrConf.getMasterInstanceType()).withSlaveInstanceType(emrConf.getWorkerInstanceType()));
  if (emrConf.getLogURI() != null) {
    request.withLogUri(emrConf.getLogURI());
  }
  LOG.info("String_Node_Str",name);
  return client.runJobFlow(request).getJobFlowId();
}
Program: 4554
Project: 4554
Buggy source:
@GET @Path("String_Node_Str") public void readDashboardDetail(FullHttpRequest request,HttpResponder responder,@QueryParam("String_Node_Str") long startTimeSecs,@QueryParam("String_Node_Str") int durationTimeSecs,@QueryParam("String_Node_Str") Set<String> namespaces) throws Exception {
  if (startTimeSecs < 0) {
    throw new BadRequestException("String_Node_Str");
  }
  if (durationTimeSecs < 0) {
    throw new BadRequestException("String_Node_Str");
  }
  if (namespaces.isEmpty()) {
    throw new BadRequestException("String_Node_Str");
  }
  long endTimeSecs=startTimeSecs + durationTimeSecs;
  Collection<RunRecordMeta> runRecordMetas=programHeartbeatService.scan(startTimeSecs,endTimeSecs + 1,namespaces);
  List<DashboardProgramRunRecord> result=runRecordMetas.stream().map(OperationsDashboardHttpHandler::runRecordToDashboardRecord).collect(Collectors.toList());
  Set<NamespaceId> namespaceIds=namespaces.stream().map(NamespaceId::new).collect(Collectors.toSet());
  long currentTimeInSeconds=TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis());
  long scheduleStartTimeSeconds=startTimeSecs > currentTimeInSeconds ? startTimeSecs : currentTimeInSeconds;
  if (endTimeSecs > currentTimeInSeconds) {
    result.addAll(getAllScheduledRuns(namespaceIds,scheduleStartTimeSeconds,endTimeSecs + 1));
  }
  responder.sendJson(HttpResponseStatus.OK,GSON.toJson(result));
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") public void readDashboardDetail(FullHttpRequest request,HttpResponder responder,@QueryParam("String_Node_Str") long startTimeSecs,@QueryParam("String_Node_Str") int durationTimeSecs,@QueryParam("String_Node_Str") Set<String> namespaces) throws Exception {
  if (startTimeSecs < 0) {
    throw new BadRequestException("String_Node_Str");
  }
  if (durationTimeSecs < 0) {
    throw new BadRequestException("String_Node_Str");
  }
  if (namespaces.isEmpty()) {
    throw new BadRequestException("String_Node_Str");
  }
  long endTimeSecs=startTimeSecs + durationTimeSecs;
  Collection<RunRecordMeta> runRecordMetas=programHeartbeatService.scan(startTimeSecs,endTimeSecs + 1,namespaces);
  List<DashboardProgramRunRecord> result=new ArrayList<>();
  for (  RunRecordMeta runRecordMeta : runRecordMetas) {
    result.add(OperationsDashboardHttpHandler.runRecordToDashboardRecord(runRecordMeta));
  }
  Set<NamespaceId> namespaceIds=namespaces.stream().map(NamespaceId::new).collect(Collectors.toSet());
  long currentTimeInSeconds=TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis());
  long scheduleStartTimeSeconds=startTimeSecs > currentTimeInSeconds ? startTimeSecs : currentTimeInSeconds;
  if (endTimeSecs > currentTimeInSeconds) {
    result.addAll(getAllScheduledRuns(namespaceIds,scheduleStartTimeSeconds,endTimeSecs + 1));
  }
  responder.sendJson(HttpResponseStatus.OK,GSON.toJson(result));
}
Program: 4555
Project: 4555
Buggy source:
/** 
 * Converts a   {@link RunRecordMeta} to a {@link DashboardProgramRunRecord}
 */
@VisibleForTesting static DashboardProgramRunRecord runRecordToDashboardRecord(RunRecordMeta meta){
  ProgramRunId runId=meta.getProgramRunId();
  String startMethod=MANUAL;
  String scheduleInfoJson=meta.getSystemArgs().get(ProgramOptionConstants.TRIGGERING_SCHEDULE_INFO);
  if (scheduleInfoJson != null) {
    TriggeringScheduleInfo scheduleInfo=GSON.fromJson(scheduleInfoJson,TriggeringScheduleInfo.class);
    startMethod=scheduleInfo.getTriggerInfos().stream().findFirst().map(trigger -> TriggerInfo.Type.TIME.equals(trigger.getType()) ? SCHEDULED : TRIGGERED).orElse(MANUAL);
  }
  return new DashboardProgramRunRecord(runId,meta,meta.getArtifactId(),meta.getPrincipal(),startMethod);
}

Fixed version (ground truth):
/** 
 * Converts a   {@link RunRecordMeta} to a {@link DashboardProgramRunRecord}
 */
@VisibleForTesting static DashboardProgramRunRecord runRecordToDashboardRecord(RunRecordMeta meta) throws IOException {
  ProgramRunId runId=meta.getProgramRunId();
  String startMethod=MANUAL;
  String scheduleInfoJson=meta.getSystemArgs().get(ProgramOptionConstants.TRIGGERING_SCHEDULE_INFO);
  if (scheduleInfoJson != null) {
    TriggeringScheduleInfo scheduleInfo=GSON.fromJson(scheduleInfoJson,TriggeringScheduleInfo.class);
    startMethod=scheduleInfo.getTriggerInfos().stream().findFirst().map(trigger -> TriggerInfo.Type.TIME.equals(trigger.getType()) ? SCHEDULED : TRIGGERED).orElse(MANUAL);
  }
  String user=meta.getPrincipal();
  if (user != null) {
    user=new KerberosName(user).getShortName();
  }
  return new DashboardProgramRunRecord(runId,meta,meta.getArtifactId(),user,startMethod);
}
Program: 4556
Project: 4556
Buggy source:
@Override protected void handleStateSaveFailure(ProvisioningTaskInfo taskInfo,TransactionFailureException e){
  if (taskInfo.getProvisioningOp().getStatus() == ProvisioningOp.Status.REQUESTING_CREATE) {
    provisionerNotifier.deprovisioned(programRunId);
  }
 else {
    provisionerNotifier.deprovisioning(programRunId);
  }
}

Fixed version (ground truth):
@Override protected void handleStateSaveFailure(ProvisioningTaskInfo taskInfo,TransactionFailureException e){
  provisionerNotifier.deprovisioning(programRunId);
}
Program: 4557
Project: 4557
Buggy source:
private ProvisioningSubtask createPollingDeleteSubtask(){
  long taskStartTime=System.currentTimeMillis();
  return new ClusterPollSubtask(provisioner,provisionerContext,ClusterStatus.DELETING,cluster -> {
switch (cluster.getStatus()) {
case CREATING:
      return Optional.of(ProvisioningOp.Status.POLLING_CREATE);
case RUNNING:
    return Optional.of(ProvisioningOp.Status.INITIALIZING);
case NOT_EXISTS:
  if (TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - taskStartTime) > retryTimeLimitSecs) {
    provisionerNotifier.deprovisioned(programRunId);
    return Optional.of(ProvisioningOp.Status.FAILED);
  }
 else {
    return Optional.of(ProvisioningOp.Status.REQUESTING_CREATE);
  }
case FAILED:
return Optional.of(ProvisioningOp.Status.REQUESTING_DELETE);
case DELETING:
case ORPHANED:
provisionerNotifier.deprovisioning(programRunId);
return Optional.of(ProvisioningOp.Status.FAILED);
}
throw new IllegalStateException(String.format("String_Node_Str",cluster.getStatus()));
}
);
}

Fixed version (ground truth):
private ProvisioningSubtask createPollingDeleteSubtask(){
  long taskStartTime=System.currentTimeMillis();
  return new ClusterPollSubtask(provisioner,provisionerContext,ClusterStatus.DELETING,cluster -> {
switch (cluster.getStatus()) {
case CREATING:
      return Optional.of(ProvisioningOp.Status.POLLING_CREATE);
case RUNNING:
    return Optional.of(ProvisioningOp.Status.INITIALIZING);
case NOT_EXISTS:
  if (TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - taskStartTime) > retryTimeLimitSecs) {
    provisionerNotifier.deprovisioning(programRunId);
    return Optional.of(ProvisioningOp.Status.FAILED);
  }
 else {
    return Optional.of(ProvisioningOp.Status.REQUESTING_CREATE);
  }
case FAILED:
return Optional.of(ProvisioningOp.Status.REQUESTING_DELETE);
case DELETING:
case ORPHANED:
provisionerNotifier.deprovisioning(programRunId);
return Optional.of(ProvisioningOp.Status.FAILED);
}
throw new IllegalStateException(String.format("String_Node_Str",cluster.getStatus()));
}
);
}
Program: 4558
Project: 4558
Buggy source:
@Inject protected AbstractNotificationSubscriberService(String name,CConfiguration cConf,String topicName,boolean transactionalFetch,int fetchSize,long emptyFetchDelayMillis,MessagingService messagingService,DatasetFramework datasetFramework,TransactionSystemClient txClient,MetricsCollectionService metricsCollectionService){
  super(NamespaceId.SYSTEM.topic(topicName),transactionalFetch,fetchSize,emptyFetchDelayMillis,RetryStrategies.fromConfiguration(cConf,"String_Node_Str"),metricsCollectionService.getContext(ImmutableMap.of(Constants.Metrics.Tag.COMPONENT,Constants.Service.MASTER_SERVICES,Constants.Metrics.Tag.INSTANCE_ID,"String_Node_Str",Constants.Metrics.Tag.NAMESPACE,NamespaceId.SYSTEM.getNamespace(),Constants.Metrics.Tag.TOPIC,topicName,Constants.Metrics.Tag.CONSUMER,name)));
  this.name=name;
  this.messagingContext=new MultiThreadMessagingContext(messagingService);
  this.transactional=Transactions.createTransactionalWithRetry(Transactions.createTransactional(new MultiThreadDatasetCache(new SystemDatasetInstantiator(datasetFramework),new TransactionSystemClientAdapter(txClient),NamespaceId.SYSTEM,ImmutableMap.of(),null,null,messagingContext)),org.apache.tephra.RetryStrategies.retryOnConflict(20,100));
}

Fixed version (ground truth):
@Inject protected AbstractNotificationSubscriberService(String name,CConfiguration cConf,String topicName,boolean transactionalFetch,int fetchSize,long emptyFetchDelayMillis,MessagingService messagingService,DatasetFramework datasetFramework,TransactionSystemClient txClient,MetricsCollectionService metricsCollectionService){
  super(NamespaceId.SYSTEM.topic(topicName),transactionalFetch,fetchSize,cConf.getInt(TxConstants.Manager.CFG_TX_TIMEOUT),emptyFetchDelayMillis,RetryStrategies.fromConfiguration(cConf,"String_Node_Str"),metricsCollectionService.getContext(ImmutableMap.of(Constants.Metrics.Tag.COMPONENT,Constants.Service.MASTER_SERVICES,Constants.Metrics.Tag.INSTANCE_ID,"String_Node_Str",Constants.Metrics.Tag.NAMESPACE,NamespaceId.SYSTEM.getNamespace(),Constants.Metrics.Tag.TOPIC,topicName,Constants.Metrics.Tag.CONSUMER,name)));
  this.name=name;
  this.messagingContext=new MultiThreadMessagingContext(messagingService);
  this.transactional=Transactions.createTransactionalWithRetry(Transactions.createTransactional(new MultiThreadDatasetCache(new SystemDatasetInstantiator(datasetFramework),new TransactionSystemClientAdapter(txClient),NamespaceId.SYSTEM,ImmutableMap.of(),null,null,messagingContext)),org.apache.tephra.RetryStrategies.retryOnConflict(20,100));
}
Program: 4559
Project: 4559
Buggy source:
@Override protected void processMessages(DatasetContext datasetContext,Iterator<ImmutablePair<String,MetadataMessage>> messages){
  Map<MetadataMessage.Type,MetadataMessageProcessor> processors=new HashMap<>();
  while (messages.hasNext()) {
    MetadataMessage message=messages.next().getSecond();
    MetadataMessageProcessor processor=processors.computeIfAbsent(message.getType(),type -> {
switch (type) {
case LINEAGE:
        return new DataAccessLineageProcessor(datasetContext);
case FIELD_LINEAGE:
      return new FieldLineageProcessor(datasetContext);
case USAGE:
    return new UsageProcessor(datasetContext);
case WORKFLOW_TOKEN:
case WORKFLOW_STATE:
  return new WorkflowProcessor(datasetContext);
case METADATA_OPERATION:
return new MetadataOperationProcessor();
case DATASET_OPERATION:
return new DatasetOperationMessageProcessor(datasetFramework);
case PROFILE_ASSIGNMENT:
case PROFILE_UNASSIGNMENT:
case ENTITY_CREATION:
case ENTITY_DELETION:
return new ProfileMetadataMessageProcessor(cConf,datasetContext,datasetFramework);
default :
return null;
}
}
);
if (processor == null) {
LOG.warn("String_Node_Str",message.getType());
continue;
}
processor.processMessage(message);
if (processor.isTimeConsumingMessage(message)) {
return;
}
}
}

Fixed version (ground truth):
@Override protected void processMessages(DatasetContext datasetContext,Iterator<ImmutablePair<String,MetadataMessage>> messages){
  Map<MetadataMessage.Type,MetadataMessageProcessor> processors=new HashMap<>();
  while (messages.hasNext()) {
    MetadataMessage message=messages.next().getSecond();
    MetadataMessageProcessor processor=processors.computeIfAbsent(message.getType(),type -> {
switch (type) {
case LINEAGE:
        return new DataAccessLineageProcessor(datasetContext);
case FIELD_LINEAGE:
      return new FieldLineageProcessor(datasetContext);
case USAGE:
    return new UsageProcessor(datasetContext);
case WORKFLOW_TOKEN:
case WORKFLOW_STATE:
  return new WorkflowProcessor(datasetContext);
case METADATA_OPERATION:
return new MetadataOperationProcessor();
case DATASET_OPERATION:
return new DatasetOperationMessageProcessor(datasetFramework);
case PROFILE_ASSIGNMENT:
case PROFILE_UNASSIGNMENT:
case ENTITY_CREATION:
case ENTITY_DELETION:
return new ProfileMetadataMessageProcessor(cConf,datasetContext,datasetFramework);
default :
return null;
}
}
);
if (processor == null) {
LOG.warn("String_Node_Str",message.getType());
continue;
}
processor.processMessage(message);
}
}
Program: 4560
Project: 4560
Buggy source:
@Inject MetadataSubscriberService(CConfiguration cConf,MessagingService messagingService,DatasetFramework datasetFramework,TransactionSystemClient txClient,MetricsCollectionService metricsCollectionService,MetadataAdmin metadataAdmin){
  super(NamespaceId.SYSTEM.topic(cConf.get(Constants.Metadata.MESSAGING_TOPIC)),true,cConf.getInt(Constants.Metadata.MESSAGING_FETCH_SIZE),cConf.getLong(Constants.Metadata.MESSAGING_POLL_DELAY_MILLIS),RetryStrategies.fromConfiguration(cConf,"String_Node_Str"),metricsCollectionService.getContext(ImmutableMap.of(Constants.Metrics.Tag.COMPONENT,Constants.Service.MASTER_SERVICES,Constants.Metrics.Tag.INSTANCE_ID,"String_Node_Str",Constants.Metrics.Tag.NAMESPACE,NamespaceId.SYSTEM.getNamespace(),Constants.Metrics.Tag.TOPIC,cConf.get(Constants.Metadata.MESSAGING_TOPIC),Constants.Metrics.Tag.CONSUMER,"String_Node_Str")));
  this.cConf=cConf;
  this.messagingContext=new MultiThreadMessagingContext(messagingService);
  this.datasetFramework=datasetFramework;
  this.metadataAdmin=metadataAdmin;
  this.transactional=Transactions.createTransactionalWithRetry(Transactions.createTransactional(new MultiThreadDatasetCache(new SystemDatasetInstantiator(datasetFramework),new TransactionSystemClientAdapter(txClient),NamespaceId.SYSTEM,Collections.emptyMap(),null,null,messagingContext)),org.apache.tephra.RetryStrategies.retryOnConflict(20,100));
}

Fixed version (ground truth):
@Inject MetadataSubscriberService(CConfiguration cConf,MessagingService messagingService,DatasetFramework datasetFramework,TransactionSystemClient txClient,MetricsCollectionService metricsCollectionService,MetadataAdmin metadataAdmin){
  super(NamespaceId.SYSTEM.topic(cConf.get(Constants.Metadata.MESSAGING_TOPIC)),true,cConf.getInt(Constants.Metadata.MESSAGING_FETCH_SIZE),cConf.getInt(TxConstants.Manager.CFG_TX_TIMEOUT),cConf.getLong(Constants.Metadata.MESSAGING_POLL_DELAY_MILLIS),RetryStrategies.fromConfiguration(cConf,"String_Node_Str"),metricsCollectionService.getContext(ImmutableMap.of(Constants.Metrics.Tag.COMPONENT,Constants.Service.MASTER_SERVICES,Constants.Metrics.Tag.INSTANCE_ID,"String_Node_Str",Constants.Metrics.Tag.NAMESPACE,NamespaceId.SYSTEM.getNamespace(),Constants.Metrics.Tag.TOPIC,cConf.get(Constants.Metadata.MESSAGING_TOPIC),Constants.Metrics.Tag.CONSUMER,"String_Node_Str")));
  this.cConf=cConf;
  this.messagingContext=new MultiThreadMessagingContext(messagingService);
  this.datasetFramework=datasetFramework;
  this.metadataAdmin=metadataAdmin;
  this.transactional=Transactions.createTransactionalWithRetry(Transactions.createTransactional(new MultiThreadDatasetCache(new SystemDatasetInstantiator(datasetFramework),new TransactionSystemClientAdapter(txClient),NamespaceId.SYSTEM,Collections.emptyMap(),null,null,messagingContext)),org.apache.tephra.RetryStrategies.retryOnConflict(20,100));
}
Program: 4561
Project: 4561
Buggy source:
@Override public void prepareRun(BatchSinkContext context) throws Exception {
  Map<String,String> arguments=new HashMap<>();
  PartitionKey outputPartition=PartitionKey.builder().addStringField("String_Node_Str",phaseName).build();
  PartitionedFileSetArguments.setOutputPartitionKey(arguments,outputPartition);
  context.addOutput(Output.ofDataset(datasetName,arguments));
}

Fixed version (ground truth):
@Override public void prepareRun(BatchSinkContext context){
  Map<String,String> arguments=new HashMap<>();
  FileSetArguments.setOutputPath(arguments,Constants.Connector.DATA_DIR + "String_Node_Str" + phaseName);
  context.addOutput(Output.ofDataset(datasetName,arguments));
}
Program: 4562
Project: 4562
Buggy source:
@Override public void prepareRun(BatchSourceContext context) throws Exception {
  Map<String,String> arguments=new HashMap<>();
  PartitionedFileSet inputFileset=context.getDataset(datasetName);
  for (  PartitionDetail partitionDetail : inputFileset.getPartitions(PartitionFilter.ALWAYS_MATCH)) {
    PartitionedFileSetArguments.addInputPartition(arguments,partitionDetail);
  }
  context.setInput(Input.ofDataset(datasetName,arguments));
}

Fixed version (ground truth):
@Override public void prepareRun(BatchSourceContext context){
  Map<String,String> arguments=new HashMap<>();
  FileSetArguments.setInputPath(arguments,Constants.Connector.DATA_DIR);
  context.setInput(Input.ofDataset(datasetName,arguments));
}
Program: 4563
Project: 4563
Buggy source:
public void configure(WorkflowConfigurer workflowConfigurer){
  Partitioning partitioning=Partitioning.builder().addField("String_Node_Str",Partitioning.FieldType.STRING).build();
  workflowConfigurer.createLocalDataset(datasetName,PartitionedFileSet.class,PartitionedFileSetProperties.builder().setPartitioning(partitioning).setInputFormat(CombineTextInputFormat.class).setOutputFormat(TextOutputFormat.class).build());
}

Fixed version (ground truth):
public void configure(WorkflowConfigurer workflowConfigurer){
  workflowConfigurer.createLocalDataset(datasetName,FileSet.class,FileSetProperties.builder().setInputFormat(CombineTextInputFormat.class).setInputProperty(FileInputFormat.INPUT_DIR_RECURSIVE,"String_Node_Str").setOutputFormat(TextOutputFormat.class).build());
}
Program: 4564
Project: 4564
Buggy source:
@Test public void testStartProgramWithDisabledRuntimeArgs() throws Exception {
  ProfileId profileId=new NamespaceId(TEST_NAMESPACE1).profile("String_Node_Str");
  Profile profile=new Profile("String_Node_Str",Profile.NATIVE.getLabel(),Profile.NATIVE.getDescription(),Profile.NATIVE.getScope(),Profile.NATIVE.getProvisioner());
  putProfile(profileId,profile,200);
  disableProfile(profileId,200);
  deploy(AppWithWorkflow.class,200,Constants.Gateway.API_VERSION_3_TOKEN,TEST_NAMESPACE1);
  ProgramId programId=new NamespaceId(TEST_NAMESPACE1).app(APP_WITH_WORKFLOW_APP_ID).workflow(APP_WITH_WORKFLOW_WORKFLOW_NAME);
  Assert.assertEquals(STOPPED,getProgramStatus(programId));
  ImmutableMap<String,String> args=ImmutableMap.of(SystemArguments.PROFILE_NAME,ProfileId.NATIVE.getScopedName());
  startProgram(programId,Collections.singletonMap(SystemArguments.PROFILE_NAME,profileId.getScopedName()),409);
  Assert.assertEquals(STOPPED,getProgramStatus(programId));
  startProgram(programId,Collections.singletonMap(SystemArguments.PROFILE_NAME,ProfileId.NATIVE.getScopedName()),200);
  waitState(programId,STOPPED);
}

Fixed version (ground truth):
@Test public void testStartProgramWithDisabledRuntimeArgs() throws Exception {
  ProfileId profileId=new NamespaceId(TEST_NAMESPACE1).profile("String_Node_Str");
  Profile profile=new Profile("String_Node_Str",Profile.NATIVE.getLabel(),Profile.NATIVE.getDescription(),Profile.NATIVE.getScope(),Profile.NATIVE.getProvisioner());
  putProfile(profileId,profile,200);
  disableProfile(profileId,200);
  deploy(AppWithWorkflow.class,200,Constants.Gateway.API_VERSION_3_TOKEN,TEST_NAMESPACE1);
  ProgramId programId=new NamespaceId(TEST_NAMESPACE1).app(APP_WITH_WORKFLOW_APP_ID).workflow(APP_WITH_WORKFLOW_WORKFLOW_NAME);
  Assert.assertEquals(STOPPED,getProgramStatus(programId));
  startProgram(programId,Collections.singletonMap(SystemArguments.PROFILE_NAME,profileId.getScopedName()),409);
  Assert.assertEquals(STOPPED,getProgramStatus(programId));
  startProgram(programId,Collections.singletonMap(SystemArguments.PROFILE_NAME,ProfileId.NATIVE.getScopedName()),200);
  waitState(programId,STOPPED);
}
Program: 4565
Project: 4565
Buggy source:
@Override public ByteBuf nextChunk() throws Exception {
  ByteBuf startBuffer=Unpooled.EMPTY_BUFFER;
  if (!hasStarted) {
    hasStarted=true;
    startBuffer=Unpooled.copiedBuffer(onWriteStart());
  }
  if (logEventIter.hasNext()) {
    ByteBuf eventsBuffer=writeLogEvents(logEventIter);
    return startBuffer.isReadable() ? Unpooled.wrappedBuffer(startBuffer,eventsBuffer) : eventsBuffer;
  }
  if (!hasFinished) {
    hasFinished=true;
    return onWriteFinish();
  }
  return Unpooled.EMPTY_BUFFER;
}

Fixed version (ground truth):
@Override public ByteBuf nextChunk() throws Exception {
  ByteBuf startBuffer=Unpooled.EMPTY_BUFFER;
  if (!hasStarted) {
    hasStarted=true;
    startBuffer=Unpooled.copiedBuffer(onWriteStart());
  }
  if (logEventIter.hasNext()) {
    ByteBuf eventsBuffer=writeLogEvents(logEventIter);
    return startBuffer.isReadable() ? Unpooled.wrappedBuffer(startBuffer,eventsBuffer) : eventsBuffer;
  }
  if (!hasFinished) {
    hasFinished=true;
    return Unpooled.wrappedBuffer(startBuffer,onWriteFinish());
  }
  return Unpooled.EMPTY_BUFFER;
}
Program: 4567
Project: 4567
Buggy source:
public MetadataServiceModule(TwillContext twillContext){
  this.instanceId=twillContext.getInstanceId();
}

Fixed version (ground truth):
public MetadataServiceModule(){
  this.instanceId=0;
}
Program: 4568
Project: 4568
Buggy source:
@Test public void testPutAndDeleteProfiles() throws Exception {
  Profile invalidProfile=new Profile("String_Node_Str","String_Node_Str",new ProvisionerInfo("String_Node_Str",PROPERTY_SUMMARIES));
  putProfile(NamespaceId.DEFAULT,invalidProfile.getName(),invalidProfile,400);
  Profile expected=new Profile("String_Node_Str","String_Node_Str",new ProvisionerInfo(MockProvisioner.NAME,PROPERTY_SUMMARIES));
  putProfile(NamespaceId.DEFAULT,expected.getName(),expected,200);
  Profile actual=getProfile(NamespaceId.DEFAULT,expected.getName(),200);
  Assert.assertEquals(expected,actual);
  List<Profile> profiles=listProfiles(NamespaceId.DEFAULT,true,200);
  Set<Profile> expectedList=ImmutableSet.of(Profile.DEFAULT,expected);
  Assert.assertEquals(expectedList.size(),profiles.size());
  Assert.assertEquals(expectedList,new HashSet<>(profiles));
  putProfile(NamespaceId.DEFAULT,expected.getName(),expected,409);
  deleteProfile(NamespaceId.DEFAULT,"String_Node_Str",404);
  deleteProfile(NamespaceId.DEFAULT,expected.getName(),200);
  Assert.assertEquals(Collections.emptyList(),listProfiles(NamespaceId.DEFAULT,false,200));
}

Fixed version (ground truth):
@Test public void testPutAndDeleteProfiles() throws Exception {
  Profile invalidProfile=new Profile("String_Node_Str","String_Node_Str",new ProvisionerInfo("String_Node_Str",PROPERTY_SUMMARIES));
  putProfile(NamespaceId.DEFAULT,invalidProfile.getName(),invalidProfile,400);
  Profile expected=new Profile("String_Node_Str","String_Node_Str",new ProvisionerInfo(MockProvisioner.NAME,PROPERTY_SUMMARIES));
  putProfile(NamespaceId.DEFAULT,expected.getName(),expected,200);
  Profile actual=getProfile(NamespaceId.DEFAULT,expected.getName(),200);
  Assert.assertEquals(expected,actual);
  List<Profile> profiles=listProfiles(NamespaceId.DEFAULT,true,200);
  Set<Profile> expectedList=ImmutableSet.of(Profile.DEFAULT,expected);
  Assert.assertEquals(expectedList.size(),profiles.size());
  Assert.assertEquals(expectedList,new HashSet<>(profiles));
  putProfile(NamespaceId.DEFAULT,expected.getName(),expected,409);
  deleteProfile(NamespaceId.DEFAULT,"String_Node_Str",404);
  deleteProfile(NamespaceId.DEFAULT,expected.getName(),200);
  Assert.assertEquals(Collections.emptyList(),listProfiles(NamespaceId.DEFAULT,false,200));
  ProvisionerSpecification spec=new MockProvisioner().getSpec();
  ProvisionerDetail test=new ProvisionerDetail(spec.getName(),spec.getDescription(),new ArrayList<>());
  putProfile(NamespaceId.DEFAULT,test.getName(),test,400);
}