nus-yam/ex-repair huggingface dataset:
Program: 4873
Project: 4873
Buggy source:
/** 
 * Fetch new notifications and update job queue
 * @return sleep time in milliseconds before next fetch
 */
private long processNotifications(){
  boolean emptyFetch=false;
  try {
    final MessageFetcher fetcher=messagingContext.getMessageFetcher();
    emptyFetch=Transactions.execute(transactional,new TxCallable<Boolean>(){
      @Override public Boolean call(      DatasetContext context) throws Exception {
        return fetchAndProcessNotifications(context,fetcher);
      }
    }
);
    failureCount=0;
  }
 catch (  Exception e) {
    LOG.warn("String_Node_Str",e);
    failureCount++;
  }
  if (failureCount > 0) {
    return scheduleStrategy.nextRetry(failureCount,0);
  }
  return emptyFetch ? 2000L : 0L;
}

Fixed version (ground truth):
/** 
 * Fetch new notifications and update job queue
 * @return sleep time in milliseconds before next fetch
 */
private long processNotifications(){
  try {
    final MessageFetcher fetcher=messagingContext.getMessageFetcher();
    String lastFetchedMessageId=Transactionals.execute(transactional,new TxCallable<String>(){
      @Override public String call(      DatasetContext context) throws Exception {
        return fetchAndProcessNotifications(context,fetcher);
      }
    }
,ServiceUnavailableException.class,TopicNotFoundException.class);
    failureCount=0;
    if (lastFetchedMessageId != null) {
      messageId=lastFetchedMessageId;
      return cConf.getLong(Constants.Scheduler.EVENT_POLL_DELAY_MILLIS);
    }
    return 0L;
  }
 catch (  ServiceUnavailableException e) {
    SAMPLING_LOG.warn("String_Node_Str",e.getServiceName(),e);
  }
catch (  TopicNotFoundException e) {
    SAMPLING_LOG.warn("String_Node_Str",e);
  }
catch (  Exception e) {
    LOG.warn("String_Node_Str",e);
  }
  return scheduleStrategy.nextRetry(++failureCount,0);
}
Program: 4874
Project: 4874
Buggy source:
@Override public Boolean call(DatasetContext context) throws Exception {
  return fetchAndProcessNotifications(context,fetcher);
}

Fixed version (ground truth):
@Override public String call(DatasetContext context) throws Exception {
  return fetchAndProcessNotifications(context,fetcher);
}
Program: 4875
Project: 4875
Buggy source:
@Override protected void startUp(){
  LOG.info("String_Node_Str");
  taskExecutorService=MoreExecutors.listeningDecorator(Executors.newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat("String_Node_Str").build()));
  taskExecutorService.submit(new SchedulerEventNotificationSubscriberThread(cConf.get(Constants.Scheduler.TIME_EVENT_TOPIC)));
  taskExecutorService.submit(new SchedulerEventNotificationSubscriberThread(cConf.get(Constants.Scheduler.STREAM_SIZE_EVENT_TOPIC)));
  taskExecutorService.submit(new DataEventNotificationSubscriberThread());
}

Fixed version (ground truth):
@Override protected void startUp(){
  LOG.info("String_Node_Str");
  taskExecutorService=Executors.newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat("String_Node_Str").build());
  taskExecutorService.submit(new SchedulerEventNotificationSubscriberThread(cConf.get(Constants.Scheduler.TIME_EVENT_TOPIC)));
  taskExecutorService.submit(new SchedulerEventNotificationSubscriberThread(cConf.get(Constants.Scheduler.STREAM_SIZE_EVENT_TOPIC)));
  taskExecutorService.submit(new DataEventNotificationSubscriberThread());
}
Program: 4876
Project: 4876
Buggy source:
private String loadMessageId(){
  try {
    return Transactions.execute(transactional,new TxCallable<String>(){
      @Override public String call(      DatasetContext context) throws Exception {
        return jobQueue.retrieveSubscriberState(topic);
      }
    }
);
  }
 catch (  TransactionFailureException e) {
    throw Throwables.propagate(e);
  }
}

Fixed version (ground truth):
private String loadMessageId(){
  return Transactionals.execute(transactional,new TxCallable<String>(){
    @Override public String call(    DatasetContext context) throws Exception {
      return jobQueue.retrieveSubscriberState(topic);
    }
  }
);
}
Program: 4877
Project: 4877
Buggy source:
protected static CConfiguration createBasicCConf() throws IOException {
  CConfiguration cConf=CConfiguration.create();
  cConf.set(Constants.Service.MASTER_SERVICES_BIND_ADDRESS,hostname);
  cConf.set(Constants.CFG_LOCAL_DATA_DIR,tmpFolder.newFolder("String_Node_Str").getAbsolutePath());
  cConf.set(Constants.AppFabric.OUTPUT_DIR,System.getProperty("String_Node_Str"));
  cConf.set(Constants.AppFabric.TEMP_DIR,System.getProperty("String_Node_Str"));
  cConf.setBoolean(Constants.Dangerous.UNRECOVERABLE_RESET,true);
  String updateSchedules=System.getProperty(Constants.AppFabric.APP_UPDATE_SCHEDULES);
  if (updateSchedules != null) {
    cConf.set(Constants.AppFabric.APP_UPDATE_SCHEDULES,updateSchedules);
  }
  return cConf;
}

Fixed version (ground truth):
protected static CConfiguration createBasicCConf() throws IOException {
  CConfiguration cConf=CConfiguration.create();
  cConf.set(Constants.Service.MASTER_SERVICES_BIND_ADDRESS,hostname);
  cConf.set(Constants.CFG_LOCAL_DATA_DIR,tmpFolder.newFolder("String_Node_Str").getAbsolutePath());
  cConf.set(Constants.AppFabric.OUTPUT_DIR,System.getProperty("String_Node_Str"));
  cConf.set(Constants.AppFabric.TEMP_DIR,System.getProperty("String_Node_Str"));
  cConf.setBoolean(Constants.Dangerous.UNRECOVERABLE_RESET,true);
  String updateSchedules=System.getProperty(Constants.AppFabric.APP_UPDATE_SCHEDULES);
  if (updateSchedules != null) {
    cConf.set(Constants.AppFabric.APP_UPDATE_SCHEDULES,updateSchedules);
  }
  cConf.setLong(Constants.Scheduler.EVENT_POLL_DELAY_MILLIS,100L);
  return cConf;
}
Program: 4878
Project: 4878
Buggy source:
@Override protected Entry computeNext(){
  if (closed || (maxLimit <= 0)) {
    return endOfData();
  }
  while (scanner.hasNext()) {
    RawMessageTableEntry tableEntry=scanner.next();
    if (skipStartRow != null) {
      byte[] row=skipStartRow;
      skipStartRow=null;
      if (Bytes.equals(row,tableEntry.getKey())) {
        continue;
      }
    }
    MessageFilter.Result status=accept(tableEntry.getTxPtr());
    if (status == MessageFilter.Result.ACCEPT) {
      maxLimit--;
      return new ImmutableMessageTableEntry(tableEntry.getKey(),tableEntry.getPayload(),tableEntry.getTxPtr());
    }
    if (status == MessageFilter.Result.HOLD) {
      break;
    }
  }
  return endOfData();
}

Fixed version (ground truth):
@Override protected RawMessageTableEntry computeNext(){
  if (!entries.hasNext()) {
    return endOfData();
  }
  Entry entry=entries.next();
  if (topicId == null || (!topicId.equals(entry.getTopicId())) || (generation != entry.getGeneration())) {
    topicId=entry.getTopicId();
    generation=entry.getGeneration();
    topic=MessagingUtils.toDataKeyPrefix(topicId,entry.getGeneration());
    rowKey=new byte[topic.length + Bytes.SIZEOF_LONG + Bytes.SIZEOF_SHORT];
  }
  Bytes.putBytes(rowKey,0,topic,0,topic.length);
  Bytes.putLong(rowKey,topic.length,entry.getPublishTimestamp());
  Bytes.putShort(rowKey,topic.length + Bytes.SIZEOF_LONG,entry.getSequenceId());
  byte[] txPtr=null;
  if (entry.isTransactional()) {
    txPtr=Bytes.toBytes(entry.getTransactionWritePointer());
  }
  return tableEntry.set(rowKey,txPtr,entry.getPayload());
}
Program: 4879
Project: 4879
Buggy source:
@Override public void store(Iterator<? extends Entry> entries) throws IOException {
  persist(storeIterator.reset(entries));
}

Fixed version (ground truth):
@Override public void store(Iterator<? extends Entry> entries) throws IOException {
  persist(new StoreIterator(entries));
}
Program: 4880
Project: 4880
Buggy source:
@Override protected Entry computeNext(){
  if (closed || (!scanner.hasNext())) {
    return endOfData();
  }
  RawPayloadTableEntry entry=scanner.next();
  if (skipFirstRow) {
    skipFirstRow=false;
    if (!scanner.hasNext()) {
      return endOfData();
    }
    entry=scanner.next();
  }
  return new ImmutablePayloadTableEntry(entry.getKey(),entry.getValue());
}

Fixed version (ground truth):
@Override protected RawPayloadTableEntry computeNext(){
  if (!entries.hasNext()) {
    return endOfData();
  }
  Entry entry=entries.next();
  if (topicId == null || (!topicId.equals(entry.getTopicId())) || (generation != entry.getGeneration())) {
    topicId=entry.getTopicId();
    generation=entry.getGeneration();
    topic=MessagingUtils.toDataKeyPrefix(topicId,entry.getGeneration());
    rowKey=new byte[topic.length + (2 * Bytes.SIZEOF_LONG) + Bytes.SIZEOF_SHORT];
  }
  Bytes.putBytes(rowKey,0,topic,0,topic.length);
  Bytes.putLong(rowKey,topic.length,entry.getTransactionWritePointer());
  Bytes.putLong(rowKey,topic.length + Bytes.SIZEOF_LONG,entry.getPayloadWriteTimestamp());
  Bytes.putShort(rowKey,topic.length + (2 * Bytes.SIZEOF_LONG),entry.getPayloadSequenceId());
  return tableEntry.set(rowKey,entry.getPayload());
}
Program: 4881
Project: 4881
Buggy source:
@Override public void store(Iterator<? extends Entry> entries) throws IOException {
  persist(storeIterator.reset(entries));
}

Fixed version (ground truth):
@Override public void store(Iterator<? extends Entry> entries) throws IOException {
  persist(new StoreIterator(entries));
}
Program: 4882
Project: 4882
Buggy source:
private boolean fetchAndProcessNotifications(DatasetContext context,MessageFetcher fetcher) throws Exception {
  boolean emptyFetch=true;
  try (CloseableIterator<Message> iterator=fetcher.fetch(NamespaceId.SYSTEM.getNamespace(),topic,100,messageId)){
    LOG.trace("String_Node_Str",messageId);
    while (iterator.hasNext() && !stopping) {
      emptyFetch=false;
      Message message=iterator.next();
      Notification notification;
      try {
        notification=GSON.fromJson(new String(message.getPayload(),StandardCharsets.UTF_8),Notification.class);
      }
 catch (      JsonSyntaxException e) {
        LOG.warn("String_Node_Str",message.getId(),e);
        messageId=message.getId();
        continue;
      }
      updateJobQueue(context,notification);
      messageId=message.getId();
    }
    if (!emptyFetch) {
      jobQueue.persistSubscriberState(topic,messageId);
    }
  }
 catch (  ServiceUnavailableException|TopicNotFoundException e) {
    SAMPLING_LOG.warn("String_Node_Str",e);
    failureCount++;
  }
  return emptyFetch;
}

Fixed version (ground truth):
@Nullable private String fetchAndProcessNotifications(DatasetContext context,MessageFetcher fetcher) throws Exception {
  String lastFetchedMessageId=null;
  try (CloseableIterator<Message> iterator=fetcher.fetch(NamespaceId.SYSTEM.getNamespace(),topic,100,messageId)){
    LOG.trace("String_Node_Str",messageId);
    while (iterator.hasNext() && !stopping) {
      Message message=iterator.next();
      Notification notification;
      try {
        notification=GSON.fromJson(new String(message.getPayload(),StandardCharsets.UTF_8),Notification.class);
      }
 catch (      JsonSyntaxException e) {
        LOG.warn("String_Node_Str",message.getId(),e);
        lastFetchedMessageId=message.getId();
        continue;
      }
      updateJobQueue(context,notification);
      lastFetchedMessageId=message.getId();
    }
    if (lastFetchedMessageId != null) {
      jobQueue.persistSubscriberState(topic,lastFetchedMessageId);
    }
    return lastFetchedMessageId;
  }
 }
Program: 4883
Project: 4883
Buggy source:
/** 
 * Fetch new notifications and update job queue
 * @return sleep time in milliseconds before next fetch
 */
private long processNotifications(){
  boolean emptyFetch=false;
  try {
    final MessageFetcher fetcher=messagingContext.getMessageFetcher();
    emptyFetch=Transactions.execute(transactional,new TxCallable<Boolean>(){
      @Override public Boolean call(      DatasetContext context) throws Exception {
        return fetchAndProcessNotifications(context,fetcher);
      }
    }
);
    failureCount=0;
  }
 catch (  Exception e) {
    LOG.warn("String_Node_Str",e);
    failureCount++;
  }
  if (failureCount > 0) {
    return scheduleStrategy.nextRetry(failureCount,0);
  }
  return emptyFetch ? 2000L : 0L;
}

Fixed version (ground truth):
/** 
 * Fetch new notifications and update job queue
 * @return sleep time in milliseconds before next fetch
 */
private long processNotifications(){
  try {
    final MessageFetcher fetcher=messagingContext.getMessageFetcher();
    String lastFetchedMessageId=Transactionals.execute(transactional,new TxCallable<String>(){
      @Override public String call(      DatasetContext context) throws Exception {
        return fetchAndProcessNotifications(context,fetcher);
      }
    }
,ServiceUnavailableException.class,TopicNotFoundException.class);
    failureCount=0;
    if (lastFetchedMessageId != null) {
      messageId=lastFetchedMessageId;
      return cConf.getLong(Constants.Scheduler.EVENT_POLL_DELAY_MILLIS);
    }
    return 0L;
  }
 catch (  ServiceUnavailableException e) {
    SAMPLING_LOG.warn("String_Node_Str",e.getServiceName(),e);
  }
catch (  TopicNotFoundException e) {
    SAMPLING_LOG.warn("String_Node_Str",e);
  }
catch (  Exception e) {
    LOG.warn("String_Node_Str",e);
  }
  return scheduleStrategy.nextRetry(++failureCount,0);
}
Program: 4884
Project: 4884
Buggy source:
@Override public Boolean call(DatasetContext context) throws Exception {
  return fetchAndProcessNotifications(context,fetcher);
}

Fixed version (ground truth):
@Override public String call(DatasetContext context) throws Exception {
  return fetchAndProcessNotifications(context,fetcher);
}
Program: 4885
Project: 4885
Buggy source:
@Override protected void startUp(){
  LOG.info("String_Node_Str");
  taskExecutorService=MoreExecutors.listeningDecorator(Executors.newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat("String_Node_Str").build()));
  taskExecutorService.submit(new SchedulerEventNotificationSubscriberThread(cConf.get(Constants.Scheduler.TIME_EVENT_TOPIC)));
  taskExecutorService.submit(new SchedulerEventNotificationSubscriberThread(cConf.get(Constants.Scheduler.STREAM_SIZE_EVENT_TOPIC)));
  taskExecutorService.submit(new DataEventNotificationSubscriberThread());
}

Fixed version (ground truth):
@Override protected void startUp(){
  LOG.info("String_Node_Str");
  taskExecutorService=Executors.newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat("String_Node_Str").build());
  taskExecutorService.submit(new SchedulerEventNotificationSubscriberThread(cConf.get(Constants.Scheduler.TIME_EVENT_TOPIC)));
  taskExecutorService.submit(new SchedulerEventNotificationSubscriberThread(cConf.get(Constants.Scheduler.STREAM_SIZE_EVENT_TOPIC)));
  taskExecutorService.submit(new DataEventNotificationSubscriberThread());
}
Program: 4886
Project: 4886
Buggy source:
private String loadMessageId(){
  try {
    return Transactions.execute(transactional,new TxCallable<String>(){
      @Override public String call(      DatasetContext context) throws Exception {
        return jobQueue.retrieveSubscriberState(topic);
      }
    }
);
  }
 catch (  TransactionFailureException e) {
    throw Throwables.propagate(e);
  }
}

Fixed version (ground truth):
private String loadMessageId(){
  return Transactionals.execute(transactional,new TxCallable<String>(){
    @Override public String call(    DatasetContext context) throws Exception {
      return jobQueue.retrieveSubscriberState(topic);
    }
  }
);
}
Program: 4887
Project: 4887
Buggy source:
protected static CConfiguration createBasicCConf() throws IOException {
  CConfiguration cConf=CConfiguration.create();
  cConf.set(Constants.Service.MASTER_SERVICES_BIND_ADDRESS,hostname);
  cConf.set(Constants.CFG_LOCAL_DATA_DIR,tmpFolder.newFolder("String_Node_Str").getAbsolutePath());
  cConf.set(Constants.AppFabric.OUTPUT_DIR,System.getProperty("String_Node_Str"));
  cConf.set(Constants.AppFabric.TEMP_DIR,System.getProperty("String_Node_Str"));
  cConf.setBoolean(Constants.Dangerous.UNRECOVERABLE_RESET,true);
  String updateSchedules=System.getProperty(Constants.AppFabric.APP_UPDATE_SCHEDULES);
  if (updateSchedules != null) {
    cConf.set(Constants.AppFabric.APP_UPDATE_SCHEDULES,updateSchedules);
  }
  return cConf;
}

Fixed version (ground truth):
protected static CConfiguration createBasicCConf() throws IOException {
  CConfiguration cConf=CConfiguration.create();
  cConf.set(Constants.Service.MASTER_SERVICES_BIND_ADDRESS,hostname);
  cConf.set(Constants.CFG_LOCAL_DATA_DIR,tmpFolder.newFolder("String_Node_Str").getAbsolutePath());
  cConf.set(Constants.AppFabric.OUTPUT_DIR,System.getProperty("String_Node_Str"));
  cConf.set(Constants.AppFabric.TEMP_DIR,System.getProperty("String_Node_Str"));
  cConf.setBoolean(Constants.Dangerous.UNRECOVERABLE_RESET,true);
  String updateSchedules=System.getProperty(Constants.AppFabric.APP_UPDATE_SCHEDULES);
  if (updateSchedules != null) {
    cConf.set(Constants.AppFabric.APP_UPDATE_SCHEDULES,updateSchedules);
  }
  cConf.setLong(Constants.Scheduler.EVENT_POLL_DELAY_MILLIS,100L);
  return cConf;
}
Program: 4888
Project: 4888
Buggy source:
@Override public void upgrade() throws Exception {
  int numThreads=cConf.getInt(Constants.Upgrade.UPGRADE_THREAD_POOL_SIZE);
  ExecutorService executor=Executors.newFixedThreadPool(numThreads,new ThreadFactoryBuilder().setNameFormat("String_Node_Str").setDaemon(true).build());
  try {
    upgradeSystemDatasets(executor);
    upgradeUserTables(executor);
  }
  finally {
    executor.shutdownNow();
  }
}

Fixed version (ground truth):
@Override public void upgrade() throws Exception {
  int numThreads=cConf.getInt(Constants.Upgrade.UPGRADE_THREAD_POOL_SIZE);
  ExecutorService executor=Executors.newFixedThreadPool(numThreads,new ThreadFactoryBuilder().setThreadFactory(Executors.privilegedThreadFactory()).setNameFormat("String_Node_Str").setDaemon(true).build());
  try {
    upgradeSystemDatasets(executor);
    upgradeUserTables(executor);
  }
  finally {
    executor.shutdownNow();
  }
}
Program: 4889
Project: 4889
Buggy source:
@Override public T call() throws Exception {
  return callable.call();
}

Fixed version (ground truth):
@Override public T call() throws Exception {
  return impersonator.doAs(namespaceMeta.getNamespaceId(),callable);
}
Program: 4890
Project: 4890
Buggy source:
/** 
 * Creates a   {@link Callable} which will impersonate the specified namespace before executing the specified callable.This is useful in case the impersonation needs to be delayed or will be performed later.
 */
public static <T>Callable<T> createImpersonatingCallable(final Impersonator impersonator,final NamespaceMeta namespaceMeta,final Callable<T> callable){
  return new Callable<T>(){
    @Override public T call() throws Exception {
      return impersonator.doAs(namespaceMeta.getNamespaceId(),new Callable<T>(){
        @Override public T call() throws Exception {
          return callable.call();
        }
      }
);
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Creates a   {@link Callable} which will impersonate the specified namespace before executing the specified callable.This is useful in case the impersonation needs to be delayed or will be performed later.
 */
public static <T>Callable<T> createImpersonatingCallable(final Impersonator impersonator,final NamespaceMeta namespaceMeta,final Callable<T> callable){
  return new Callable<T>(){
    @Override public T call() throws Exception {
      return impersonator.doAs(namespaceMeta.getNamespaceId(),callable);
    }
  }
;
}
Program: 4893
Project: 4893
Buggy source:
@Override public Void call() throws Exception {
  Map<TableId,Future<?>> futures=upgradeQueues(namespaceMeta,executor);
  allFutures.putAll(futures);
  return null;
}

Fixed version (ground truth):
public Void call() throws Exception {
  LOG.info("String_Node_Str",tableId);
  DatasetId stateStoreId=createStateStoreDataset(namespaceMeta.getName());
  DatasetAdmin datasetAdmin=datasetFramework.getAdmin(stateStoreId,null);
  if (datasetAdmin == null) {
    LOG.error("String_Node_Str",stateStoreId);
    return null;
  }
  datasetAdmin.upgrade();
  LOG.info("String_Node_Str",tableId);
  return null;
}
Program: 4894
Project: 4894
Buggy source:
public void run(){
  try {
    impersonator.doAs(namespaceMeta.getNamespaceId(),new Callable<Void>(){
      @Override public Void call() throws Exception {
        if (isCDAPUserTable(desc)) {
          upgradeUserTable(desc);
        }
 else         if (isStreamOrQueueTable(desc.getNameAsString())) {
          updateTableDesc(desc,ddlExecutor);
        }
        return null;
      }
    }
);
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public void run(){
  try {
    LOG.info("String_Node_Str",spec.getName(),spec.toString());
    DatasetAdmin admin=dsFramework.getAdmin(datasetId,null);
    admin.upgrade();
    LOG.info("String_Node_Str",spec.getName());
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}
Program: 4895
Project: 4895
Buggy source:
@Override public Void call() throws Exception {
  if (isCDAPUserTable(desc)) {
    upgradeUserTable(desc);
  }
 else   if (isStreamOrQueueTable(desc.getNameAsString())) {
    updateTableDesc(desc,ddlExecutor);
  }
  return null;
}

Fixed version (ground truth):
public Void call() throws Exception {
  if (isCDAPUserTable(desc)) {
    upgradeUserTable(desc);
  }
 else   if (isStreamOrQueueTable(desc.getNameAsString())) {
    updateTableDesc(desc,ddlExecutor);
  }
  return null;
}
Program: 4896
Project: 4896
Buggy source:
private Map<String,Future<?>> upgradeUserTables(final NamespaceMeta namespaceMeta,ExecutorService executor) throws Exception {
  Map<String,Future<?>> futures=new HashMap<>();
  String hBaseNamespace=hBaseTableUtil.getHBaseNamespace(namespaceMeta);
  try (HBaseDDLExecutor ddlExecutor=ddlExecutorFactory.get();HBaseAdmin hAdmin=new HBaseAdmin(hConf)){
    for (    final HTableDescriptor desc : hAdmin.listTableDescriptorsByNamespace(HTableNameConverter.encodeHBaseEntity(hBaseNamespace))) {
      Runnable runnable=new Runnable(){
        public void run(){
          try {
            impersonator.doAs(namespaceMeta.getNamespaceId(),new Callable<Void>(){
              @Override public Void call() throws Exception {
                if (isCDAPUserTable(desc)) {
                  upgradeUserTable(desc);
                }
 else                 if (isStreamOrQueueTable(desc.getNameAsString())) {
                  updateTableDesc(desc,ddlExecutor);
                }
                return null;
              }
            }
);
          }
 catch (          Exception e) {
            throw new RuntimeException(e);
          }
        }
      }
;
      Future<?> future=executor.submit(runnable);
      futures.put(desc.getNameAsString(),future);
    }
  }
   return futures;
}

Fixed version (ground truth):
private Map<String,Future<?>> upgradeUserTables(final NamespaceMeta namespaceMeta,final ExecutorService executor,final HBaseDDLExecutor ddlExecutor) throws Exception {
  Map<String,Future<?>> futures=new HashMap<>();
  String hBaseNamespace=hBaseTableUtil.getHBaseNamespace(namespaceMeta);
  try (HBaseAdmin hAdmin=new HBaseAdmin(hConf)){
    for (    final HTableDescriptor desc : hAdmin.listTableDescriptorsByNamespace(HTableNameConverter.encodeHBaseEntity(hBaseNamespace))) {
      Callable<Void> callable=new Callable<Void>(){
        public Void call() throws Exception {
          if (isCDAPUserTable(desc)) {
            upgradeUserTable(desc);
          }
 else           if (isStreamOrQueueTable(desc.getNameAsString())) {
            updateTableDesc(desc,ddlExecutor);
          }
          return null;
        }
      }
;
      Future<?> future=executor.submit(ImpersonationUtils.createImpersonatingCallable(impersonator,namespaceMeta,callable));
      futures.put(desc.getNameAsString(),future);
    }
  }
   return futures;
}
Program: 4898
Project: 4898
Buggy source:
/** 
 * Delete the specified namespace if it exists.
 * @param name the namespace to delete
 * @throws IOException if a remote or network exception occurs
 * @throws IllegalStateException if there are tables in the namespace
 */
void deleteNamespaceIfExists(String name) throws IOException ;

Fixed version (ground truth):
/** 
 * Delete the specified namespace if it exists. This method is called during namespace deletion process.
 * @param name the namespace to delete
 * @throws IOException if a remote or network exception occurs
 * @throws IllegalStateException if there are tables in the namespace
 */
void deleteNamespaceIfExists(String name) throws IOException ;
Program: 4899
Project: 4899
Buggy source:
/** 
 * Create the specified table if it does not exist.
 * @param descriptor the descriptor for the table to create
 * @param splitKeys the initial split keys for the table
 * @throws IOException if a remote or network exception occurs
 */
void createTableIfNotExists(TableDescriptor descriptor,@Nullable byte[][] splitKeys) throws IOException ;

Fixed version (ground truth):
/** 
 * Create the specified table if it does not exist. This method is called during the creation of an HBase backed dataset (either system or user).
 * @param descriptor the descriptor for the table to create
 * @param splitKeys the initial split keys for the table
 * @throws IOException if a remote or network exception occurs
 */
void createTableIfNotExists(TableDescriptor descriptor,@Nullable byte[][] splitKeys) throws IOException ;
Program: 4900
Project: 4900
Buggy source:
/** 
 * Disable the specified table if it is enabled.
 * @param namespace the namespace of the table to disable
 * @param name the name of the table to disable
 * @throws IOException if a remote or network exception occurs
 */
void disableTableIfEnabled(String namespace,String name) throws IOException ;

Fixed version (ground truth):
/** 
 * Disable the specified table if it is enabled. This is called when an HBase backed dataset has its properties modified. In order to modify the HBase table, CDAP first disables it with this method, then calls   {@code modifyTable}, then calls  {@code enableTableIfDisabled}.
 * @param namespace the namespace of the table to disable
 * @param name the name of the table to disable
 * @throws IOException if a remote or network exception occurs
 */
void disableTableIfEnabled(String namespace,String name) throws IOException ;
Program: 4901
Project: 4901
Buggy source:
/** 
 * Modify the specified table. The table must be disabled.
 * @param namespace the namespace of the table to modify
 * @param name the name of the table to modify
 * @param descriptor the descriptor for the table
 * @throws IOException if a remote or network exception occurs
 * @throws IllegalStateException if the specified table is not disabled
 */
void modifyTable(String namespace,String name,TableDescriptor descriptor) throws IOException ;

Fixed version (ground truth):
/** 
 * Modify the specified table. This is called when an HBase backed dataset has its properties modified. In order to modify the HBase table, CDAP first calls  {@code disableTableIfEnabled}, then calls this method, then calls   {@code enableTableIfDisabled}.
 * @param namespace the namespace of the table to modify
 * @param name the name of the table to modify
 * @param descriptor the descriptor for the table
 * @throws IOException if a remote or network exception occurs
 * @throws IllegalStateException if the specified table is not disabled
 */
void modifyTable(String namespace,String name,TableDescriptor descriptor) throws IOException ;
Program: 4902
Project: 4902
Buggy source:
/** 
 * Enable the specified table if it is disabled.
 * @param namespace the namespace of the table to enable
 * @param name the name of the table to enable
 * @throws IOException if a remote or network exception occurs
 */
void enableTableIfDisabled(String namespace,String name) throws IOException ;

Fixed version (ground truth):
/** 
 * Enable the specified table if it is disabled. This is called when an HBase backed dataset has its properties modified. In order to modify the HBase table, CDAP first calls   {@code disableTableIfEnabled}, then calls   {@code modifyTable}, then enables the table with this method.
 * @param namespace the namespace of the table to enable
 * @param name the name of the table to enable
 * @throws IOException if a remote or network exception occurs
 */
void enableTableIfDisabled(String namespace,String name) throws IOException ;
Program: 4903
Project: 4903
Buggy source:
/** 
 * Create the specified namespace if it does not exist.
 * @param name the namespace to create
 * @return whether the namespace was created
 * @throws IOException if a remote or network exception occurs
 */
boolean createNamespaceIfNotExists(String name) throws IOException ;

Fixed version (ground truth):
/** 
 * Create the specified namespace if it does not exist. This method gets called when CDAP attempts to create a new namespace.
 * @param name the namespace to create
 * @return whether the namespace was created
 * @throws IOException if a remote or network exception occurs
 */
boolean createNamespaceIfNotExists(String name) throws IOException ;
Program: 4904
Project: 4904
Buggy source:
/** 
 * Truncate the specified table. The table must be disabled.
 * @param namespace the namespace of the table to truncate
 * @param name the name of the table to truncate
 * @throws IOException if a remote or network exception occurs
 * @throws IllegalStateException if the specified table is not disabled
 */
void truncateTable(String namespace,String name) throws IOException ;

Fixed version (ground truth):
/** 
 * Truncate the specified table. The table must be disabled first to truncate it, after which it must be enabled again.
 * @param namespace the namespace of the table to truncate
 * @param name the name of the table to truncate
 * @throws IOException if a remote or network exception occurs
 * @throws IllegalStateException if the specified table is not disabled
 */
void truncateTable(String namespace,String name) throws IOException ;
Program: 4905
Project: 4905
Buggy source:
/** 
 * Initialize the   {@link HBaseDDLExecutor}.
 * @param context the context for the executor
 */
void initialize(HBaseDDLExecutorContext context);

Fixed version (ground truth):
/** 
 * Initialize the   {@link HBaseDDLExecutor}. This method is called once when the executor is created, before any other methods are called.
 * @param context the context for the executor
 */
void initialize(HBaseDDLExecutorContext context);
Program: 4906
Project: 4906
Buggy source:
@Override public void run(JavaSparkExecutionContext sec) throws Exception {
  String stageName=sec.getSpecification().getProperty(ExternalSparkProgram.STAGE_NAME);
  BatchPhaseSpec batchPhaseSpec=GSON.fromJson(sec.getSpecification().getProperty(Constants.PIPELINEID),BatchPhaseSpec.class);
  PipelinePluginContext pluginContext=new SparkPipelinePluginContext(sec.getPluginContext(),sec.getMetrics(),batchPhaseSpec.isStageLoggingEnabled(),batchPhaseSpec.isProcessTimingEnabled());
  Class<?> mainClass=pluginContext.loadPluginClass(stageName);
  if (mainClass.isAssignableFrom(JavaSparkMain.class)) {
    MacroEvaluator macroEvaluator=new DefaultMacroEvaluator(sec.getWorkflowToken(),sec.getRuntimeArguments(),sec.getLogicalStartTime(),sec.getSecureStore(),sec.getNamespace());
    JavaSparkMain javaSparkMain=pluginContext.newPluginInstance(stageName,macroEvaluator);
    javaSparkMain.run(sec);
  }
 else {
    String programArgs=getProgramArgs(sec,stageName);
    String[] args=programArgs == null ? RuntimeArguments.toPosixArray(sec.getRuntimeArguments()) : programArgs.split("String_Node_Str");
    final Method mainMethod=mainClass.getMethod("String_Node_Str",String[].class);
    final Object[] methodArgs=new Object[1];
    methodArgs[0]=args;
    Caller caller=pluginContext.getCaller(stageName);
    caller.call(new Callable<Void>(){
      @Override public Void call() throws Exception {
        mainMethod.invoke(null,methodArgs);
        return null;
      }
    }
);
  }
}

Fixed version (ground truth):
@Override public void run(JavaSparkExecutionContext sec) throws Exception {
  String stageName=sec.getSpecification().getProperty(ExternalSparkProgram.STAGE_NAME);
  BatchPhaseSpec batchPhaseSpec=GSON.fromJson(sec.getSpecification().getProperty(Constants.PIPELINEID),BatchPhaseSpec.class);
  PipelinePluginContext pluginContext=new SparkPipelinePluginContext(sec.getPluginContext(),sec.getMetrics(),batchPhaseSpec.isStageLoggingEnabled(),batchPhaseSpec.isProcessTimingEnabled());
  Class<?> mainClass=pluginContext.loadPluginClass(stageName);
  if (JavaSparkMain.class.isAssignableFrom(mainClass)) {
    MacroEvaluator macroEvaluator=new DefaultMacroEvaluator(sec.getWorkflowToken(),sec.getRuntimeArguments(),sec.getLogicalStartTime(),sec.getSecureStore(),sec.getNamespace());
    JavaSparkMain javaSparkMain=pluginContext.newPluginInstance(stageName,macroEvaluator);
    javaSparkMain.run(sec);
  }
 else {
    String programArgs=getProgramArgs(sec,stageName);
    String[] args=programArgs == null ? RuntimeArguments.toPosixArray(sec.getRuntimeArguments()) : programArgs.split("String_Node_Str");
    final Method mainMethod=mainClass.getMethod("String_Node_Str",String[].class);
    final Object[] methodArgs=new Object[1];
    methodArgs[0]=args;
    Caller caller=pluginContext.getCaller(stageName);
    caller.call(new Callable<Void>(){
      @Override public Void call() throws Exception {
        mainMethod.invoke(null,methodArgs);
        return null;
      }
    }
);
  }
}
Program: 4907
Project: 4907
Buggy source:
public void run(){
  try {
    if (isCDAPUserTable(desc)) {
      upgradeUserTable(desc);
    }
 else     if (isStreamOrQueueTable(desc.getNameAsString())) {
      updateTableDesc(desc,ddlExecutor);
    }
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public void run(){
  try {
    impersonator.doAs(namespaceMeta.getNamespaceId(),new Callable<Void>(){
      @Override public Void call() throws Exception {
        if (isCDAPUserTable(desc)) {
          upgradeUserTable(desc);
        }
 else         if (isStreamOrQueueTable(desc.getNameAsString())) {
          updateTableDesc(desc,ddlExecutor);
        }
        return null;
      }
    }
);
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}
Program: 4908
Project: 4908
Buggy source:
@Override public Void call() throws Exception {
  Map<String,Future<?>> futures=upgradeUserTables(namespaceMeta,executor);
  allFutures.putAll(futures);
  return null;
}

Fixed version (ground truth):
@Override public Void call() throws Exception {
  if (isCDAPUserTable(desc)) {
    upgradeUserTable(desc);
  }
 else   if (isStreamOrQueueTable(desc.getNameAsString())) {
    updateTableDesc(desc,ddlExecutor);
  }
  return null;
}
Program: 4909
Project: 4909
Buggy source:
private Map<String,Future<?>> upgradeUserTables(NamespaceMeta namespaceMeta,ExecutorService executor) throws Exception {
  Map<String,Future<?>> futures=new HashMap<>();
  String hBaseNamespace=hBaseTableUtil.getHBaseNamespace(namespaceMeta);
  try (HBaseDDLExecutor ddlExecutor=ddlExecutorFactory.get();HBaseAdmin hAdmin=new HBaseAdmin(hConf)){
    for (    final HTableDescriptor desc : hAdmin.listTableDescriptorsByNamespace(HTableNameConverter.encodeHBaseEntity(hBaseNamespace))) {
      Runnable runnable=new Runnable(){
        public void run(){
          try {
            if (isCDAPUserTable(desc)) {
              upgradeUserTable(desc);
            }
 else             if (isStreamOrQueueTable(desc.getNameAsString())) {
              updateTableDesc(desc,ddlExecutor);
            }
          }
 catch (          Exception e) {
            throw new RuntimeException(e);
          }
        }
      }
;
      Future<?> future=executor.submit(runnable);
      futures.put(desc.getNameAsString(),future);
    }
  }
   return futures;
}

Fixed version (ground truth):
private Map<String,Future<?>> upgradeUserTables(final NamespaceMeta namespaceMeta,ExecutorService executor) throws Exception {
  Map<String,Future<?>> futures=new HashMap<>();
  String hBaseNamespace=hBaseTableUtil.getHBaseNamespace(namespaceMeta);
  try (HBaseDDLExecutor ddlExecutor=ddlExecutorFactory.get();HBaseAdmin hAdmin=new HBaseAdmin(hConf)){
    for (    final HTableDescriptor desc : hAdmin.listTableDescriptorsByNamespace(HTableNameConverter.encodeHBaseEntity(hBaseNamespace))) {
      Runnable runnable=new Runnable(){
        public void run(){
          try {
            impersonator.doAs(namespaceMeta.getNamespaceId(),new Callable<Void>(){
              @Override public Void call() throws Exception {
                if (isCDAPUserTable(desc)) {
                  upgradeUserTable(desc);
                }
 else                 if (isStreamOrQueueTable(desc.getNameAsString())) {
                  updateTableDesc(desc,ddlExecutor);
                }
                return null;
              }
            }
);
          }
 catch (          Exception e) {
            throw new RuntimeException(e);
          }
        }
      }
;
      Future<?> future=executor.submit(runnable);
      futures.put(desc.getNameAsString(),future);
    }
  }
   return futures;
}
Program: 4910
Project: 4910
Buggy source:
public CloseableIterator<Job> fullScan(){
  return createCloseableIterator(table.scan(null,null));
}

Fixed version (ground truth):
public CloseableIterator<Job> fullScan(){
  return createCloseableIterator(table.scan(JOB_ROW_PREFIX,Bytes.stopKeyForPrefix(JOB_ROW_PREFIX)));
}
Program: 4911
Project: 4911
Buggy source:
@Test public void testGetAllJobs() throws Exception {
  txExecutor.execute(new TransactionExecutor.Subroutine(){
    @Override public void apply() throws Exception {
      Assert.assertEquals(0,getAllJobs(jobQueue).size());
      jobQueue.persistSubscriberState("String_Node_Str","String_Node_Str");
      jobQueue.put(SCHED1_JOB);
      Assert.assertEquals(ImmutableSet.of(SCHED1_JOB),getAllJobs(jobQueue));
    }
  }
);
}

Fixed version (ground truth):
@Test public void testGetAllJobs() throws Exception {
  txExecutor.execute(new TransactionExecutor.Subroutine(){
    @Override public void apply() throws Exception {
      Assert.assertEquals(0,getAllJobs(jobQueue).size());
      jobQueue.persistSubscriberState("String_Node_Str","String_Node_Str");
      jobQueue.put(SCHED1_JOB);
      Assert.assertEquals(ImmutableSet.of(SCHED1_JOB),getAllJobs(jobQueue));
      Assert.assertEquals(ImmutableSet.of(SCHED1_JOB),toSet(jobQueue.fullScan()));
    }
  }
);
}
Program: 4912
Project: 4912
Buggy source:
@Override public void run(JavaSparkExecutionContext sec) throws Exception {
  String stageName=sec.getSpecification().getProperty(ExternalSparkProgram.STAGE_NAME);
  BatchPhaseSpec batchPhaseSpec=GSON.fromJson(sec.getSpecification().getProperty(Constants.PIPELINEID),BatchPhaseSpec.class);
  PipelinePluginContext pluginContext=new SparkPipelinePluginContext(sec.getPluginContext(),sec.getMetrics(),batchPhaseSpec.isStageLoggingEnabled(),batchPhaseSpec.isProcessTimingEnabled());
  Class<?> mainClass=pluginContext.loadPluginClass(stageName);
  if (mainClass.isAssignableFrom(JavaSparkMain.class)) {
    MacroEvaluator macroEvaluator=new DefaultMacroEvaluator(sec.getWorkflowToken(),sec.getRuntimeArguments(),sec.getLogicalStartTime(),sec.getSecureStore(),sec.getNamespace());
    JavaSparkMain javaSparkMain=pluginContext.newPluginInstance(stageName,macroEvaluator);
    javaSparkMain.run(sec);
  }
 else {
    String programArgs=getProgramArgs(sec,stageName);
    String[] args=programArgs == null ? RuntimeArguments.toPosixArray(sec.getRuntimeArguments()) : programArgs.split("String_Node_Str");
    final Method mainMethod=mainClass.getMethod("String_Node_Str",String[].class);
    final Object[] methodArgs=new Object[1];
    methodArgs[0]=args;
    Caller caller=pluginContext.getCaller(stageName);
    caller.call(new Callable<Void>(){
      @Override public Void call() throws Exception {
        mainMethod.invoke(null,methodArgs);
        return null;
      }
    }
);
  }
}

Fixed version (ground truth):
@Override public void run(JavaSparkExecutionContext sec) throws Exception {
  String stageName=sec.getSpecification().getProperty(ExternalSparkProgram.STAGE_NAME);
  BatchPhaseSpec batchPhaseSpec=GSON.fromJson(sec.getSpecification().getProperty(Constants.PIPELINEID),BatchPhaseSpec.class);
  PipelinePluginContext pluginContext=new SparkPipelinePluginContext(sec.getPluginContext(),sec.getMetrics(),batchPhaseSpec.isStageLoggingEnabled(),batchPhaseSpec.isProcessTimingEnabled());
  Class<?> mainClass=pluginContext.loadPluginClass(stageName);
  if (JavaSparkMain.class.isAssignableFrom(mainClass)) {
    MacroEvaluator macroEvaluator=new DefaultMacroEvaluator(sec.getWorkflowToken(),sec.getRuntimeArguments(),sec.getLogicalStartTime(),sec.getSecureStore(),sec.getNamespace());
    JavaSparkMain javaSparkMain=pluginContext.newPluginInstance(stageName,macroEvaluator);
    javaSparkMain.run(sec);
  }
 else {
    String programArgs=getProgramArgs(sec,stageName);
    String[] args=programArgs == null ? RuntimeArguments.toPosixArray(sec.getRuntimeArguments()) : programArgs.split("String_Node_Str");
    final Method mainMethod=mainClass.getMethod("String_Node_Str",String[].class);
    final Object[] methodArgs=new Object[1];
    methodArgs[0]=args;
    Caller caller=pluginContext.getCaller(stageName);
    caller.call(new Callable<Void>(){
      @Override public Void call() throws Exception {
        mainMethod.invoke(null,methodArgs);
        return null;
      }
    }
);
  }
}
Program: 4913
Project: 4913
Buggy source:
public static boolean isValidName(String name){
  return isValidId(name);
}

Fixed version (ground truth):
public static boolean isValidName(String name){
  return isValidArtifactId(name);
}
Program: 4914
Project: 4914
Buggy source:
public Artifact(Namespace namespace,String name,ArtifactVersion version){
  if (namespace == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (name == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (!isValidId(name)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (version == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (version.getVersion() == null) {
    throw new NullPointerException("String_Node_Str");
  }
  this.namespace=namespace;
  this.name=name;
  this.version=version;
}

Fixed version (ground truth):
public Artifact(Namespace namespace,String name,ArtifactVersion version){
  if (namespace == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (name == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (!isValidArtifactId(name)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (version == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (version.getVersion() == null) {
    throw new NullPointerException("String_Node_Str");
  }
  this.namespace=namespace;
  this.name=name;
  this.version=version;
}
Program: 4916
Project: 4916
Buggy source:
@Override public HBaseDDLExecutor get(){
  Map<String,HBaseDDLExecutor> extensions=hBaseDDLExecutorLoader.getAll();
  HBaseDDLExecutor executor;
  if (!extensions.isEmpty()) {
    executor=extensions.values().iterator().next();
  }
 else {
    executor=super.get();
  }
  executor.initialize(context);
  return executor;
}

Fixed version (ground truth):
@Override public HBaseDDLExecutor get(){
  Map<String,HBaseDDLExecutor> extensions=hBaseDDLExecutorLoader.getAll();
  HBaseDDLExecutor executor;
  if (!extensions.isEmpty()) {
    executor=extensions.values().iterator().next();
  }
 else {
    if (extensionDir != null) {
      throw new RuntimeException(String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str",extensionDir));
    }
    executor=super.get();
  }
  executor.initialize(context);
  return executor;
}
Program: 4917
Project: 4917
Buggy source:
public HBaseDDLExecutorFactory(CConfiguration cConf,Configuration hConf){
  this.hBaseDDLExecutorLoader=new HBaseDDLExecutorLoader(cConf.get(Constants.HBaseDDLExecutor.EXTENSIONS_DIR,"String_Node_Str"));
  this.context=new BasicHBaseDDLExecutorContext(cConf,hConf);
}

Fixed version (ground truth):
public HBaseDDLExecutorFactory(CConfiguration cConf,Configuration hConf){
  this.extensionDir=cConf.get(Constants.HBaseDDLExecutor.EXTENSIONS_DIR);
  this.hBaseDDLExecutorLoader=new HBaseDDLExecutorLoader(extensionDir == null ? "String_Node_Str" : extensionDir);
  this.context=new BasicHBaseDDLExecutorContext(cConf,hConf);
}
Program: 4918
Project: 4918
Buggy source:
@Override public void run(){
  LOG.info("String_Node_Str");
  Set<String> problemKeys=new HashSet<>();
  checkServiceResources(problemKeys);
  checkBindAddresses();
  checkPotentialPortConflicts(problemKeys);
  checkKafkaTopic(problemKeys);
  checkMessagingTopics(problemKeys);
  checkLogPartitionKey(problemKeys);
  checkPruningAndReplication(problemKeys);
  if (!problemKeys.isEmpty()) {
    throw new RuntimeException("String_Node_Str" + Joiner.on(',').join(problemKeys));
  }
  LOG.info("String_Node_Str");
}

Fixed version (ground truth):
@Override public void run(){
  LOG.info("String_Node_Str");
  Set<String> problemKeys=new HashSet<>();
  checkServiceResources(problemKeys);
  checkBindAddresses();
  checkPotentialPortConflicts(problemKeys);
  checkKafkaTopic(problemKeys);
  checkMessagingTopics(problemKeys);
  checkLogPartitionKey(problemKeys);
  checkPruningAndReplication(problemKeys);
  checkHBaseDDLExtension(problemKeys);
  if (!problemKeys.isEmpty()) {
    throw new RuntimeException("String_Node_Str" + Joiner.on(',').join(problemKeys));
  }
  LOG.info("String_Node_Str");
}
Program: 4919
Project: 4919
Buggy source:
@Inject private ConfigurationCheck(CConfiguration cConf){
  super(cConf);
}

Fixed version (ground truth):
@Inject private ConfigurationCheck(CConfiguration cConf,Configuration hConf){
  super(cConf);
  this.hConf=hConf;
}
Program: 4920
Project: 4920
Buggy source:
private ConstraintResult notSatisfied(){
  if (!waitUntilMet) {
    return ConstraintResult.NEVER_SATISFIED;
  }
  return new ConstraintResult(ConstraintResult.SatisfiedState.NOT_SATISFIED,TimeUnit.SECONDS.toMillis(10));
}

Fixed version (ground truth):
private ConstraintResult notSatisfied(ConstraintContext context){
  if (!waitUntilMet) {
    return ConstraintResult.NEVER_SATISFIED;
  }
  return new ConstraintResult(ConstraintResult.SatisfiedState.NOT_SATISFIED,context.getCheckTime() + TimeUnit.SECONDS.toMillis(10));
}
Program: 4921
Project: 4921
Buggy source:
@Override public ConstraintResult check(ProgramSchedule schedule,ConstraintContext context){
  int numRunning=context.getProgramRuns(schedule.getProgramId(),ProgramRunStatus.RUNNING,maxConcurrency).size();
  if (numRunning >= maxConcurrency) {
    LOG.debug("String_Node_Str",schedule.getProgramId(),schedule.getName(),maxConcurrency);
    return notSatisfied();
  }
  int numSuspended=context.getProgramRuns(schedule.getProgramId(),ProgramRunStatus.SUSPENDED,maxConcurrency).size();
  if (numRunning + numSuspended >= maxConcurrency) {
    LOG.debug("String_Node_Str" + "String_Node_Str",schedule.getProgramId(),schedule.getName(),numRunning,numSuspended);
    return notSatisfied();
  }
  return ConstraintResult.SATISFIED;
}

Fixed version (ground truth):
@Override public ConstraintResult check(ProgramSchedule schedule,ConstraintContext context){
  int numRunning=context.getProgramRuns(schedule.getProgramId(),ProgramRunStatus.RUNNING,maxConcurrency).size();
  if (numRunning >= maxConcurrency) {
    LOG.debug("String_Node_Str",schedule.getProgramId(),schedule.getName(),maxConcurrency);
    return notSatisfied(context);
  }
  int numSuspended=context.getProgramRuns(schedule.getProgramId(),ProgramRunStatus.SUSPENDED,maxConcurrency).size();
  if (numRunning + numSuspended >= maxConcurrency) {
    LOG.debug("String_Node_Str" + "String_Node_Str",schedule.getProgramId(),schedule.getName(),numRunning,numSuspended);
    return notSatisfied(context);
  }
  return ConstraintResult.SATISFIED;
}
Program: 4922
Project: 4922
Buggy source:
ConstraintResult(SatisfiedState satisfiedState,Long millisBeforeNextRetry){
  if (satisfiedState == SatisfiedState.NOT_SATISFIED) {
    Preconditions.checkNotNull(millisBeforeNextRetry);
  }
  this.satisfiedState=satisfiedState;
  this.millisBeforeNextRetry=millisBeforeNextRetry;
}

Fixed version (ground truth):
ConstraintResult(SatisfiedState satisfiedState,Long nextCheckTime){
  if (satisfiedState == SatisfiedState.NOT_SATISFIED) {
    Preconditions.checkNotNull(nextCheckTime);
  }
  this.satisfiedState=satisfiedState;
  this.nextCheckTime=nextCheckTime;
}