nus-yam/ex-repair huggingface dataset:
Program: 5336
Project: 5336
Buggy source:
@Inject public DatasetInstanceManager(TransactionSystemClientService txClientService,TransactionExecutorFactory txExecutorFactory,@Named("String_Node_Str") DatasetFramework datasetFramework){
  this.txExecutorFactory=txExecutorFactory;
  Map<String,String> emptyArgs=Collections.emptyMap();
  this.datasetCache=new MultiThreadDatasetCache(new SystemDatasetInstantiator(datasetFramework),txClientService,NamespaceId.SYSTEM,emptyArgs,null,ImmutableMap.of(DatasetMetaTableUtil.INSTANCE_TABLE_NAME,emptyArgs));
}

Fixed version (ground truth):
@Inject public DatasetInstanceManager(TransactionSystemClientService txClientService,TransactionExecutorFactory txExecutorFactory,@Named("String_Node_Str") DatasetFramework datasetFramework){
  this.txExecutorFactory=txExecutorFactory;
  Map<String,String> emptyArgs=Collections.emptyMap();
  this.datasetCache=new MultiThreadDatasetCache(new SystemDatasetInstantiator(datasetFramework),new TransactionSystemClientAdapter(txClientService),NamespaceId.SYSTEM,emptyArgs,null,ImmutableMap.of(DatasetMetaTableUtil.INSTANCE_TABLE_NAME,emptyArgs));
}
Program: 5337
Project: 5337
Buggy source:
/** 
 * Executes the given runnable with a transaction.
 * @param transactional the {@link Transactional} used to submit the task
 * @param runnable task
 * @throws ServiceUnavailableException when the transaction service is not running
 * @throws RuntimeException for any other errors that occurs
 */
public static void executeUnchecked(Transactional transactional,final TxRunnable runnable){
  executeUnchecked(transactional,new TxCallable<Void>(){
    @Override public Void call(    DatasetContext context) throws Exception {
      runnable.run(context);
      return null;
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Executes the given runnable with a transaction. Think twice before you call this. Usages of this method likely indicate poor exception handling.
 * @param transactional the {@link Transactional} used to submit the task
 * @param runnable task
 * @throws RuntimeException for errors that occur
 */
public static void executeUnchecked(Transactional transactional,final TxRunnable runnable){
  executeUnchecked(transactional,new TxCallable<Void>(){
    @Override public Void call(    DatasetContext context) throws Exception {
      runnable.run(context);
      return null;
    }
  }
);
}
Program: 5338
Project: 5338
Buggy source:
@Override @Nullable protected Configuration getConfiguration(CoprocessorEnvironment env){
  CConfiguration cConf=getCConfCache((RegionCoprocessorEnvironment)env).getCConf();
  if (cConf == null) {
    return null;
  }
  Configuration hConf=new Configuration();
  for (  Map.Entry<String,String> entry : cConf) {
    hConf.set(entry.getKey(),entry.getValue());
  }
  return hConf;
}

Fixed version (ground truth):
@Override @Nullable protected Configuration getConfiguration(CoprocessorEnvironment env){
  CConfiguration cConf=cConfCache.getCConf();
  if (cConf == null) {
    return null;
  }
  Configuration hConf=new Configuration();
  for (  Map.Entry<String,String> entry : cConf) {
    hConf.set(entry.getKey(),entry.getValue());
  }
  return hConf;
}
Program: 5339
Project: 5339
Buggy source:
@Override public void stop(CoprocessorEnvironment e) throws IOException {
  super.stop(e);
  if (cConfCache != null) {
    cConfCache.stop();
  }
}

Fixed version (ground truth):
@Override public void stop(CoprocessorEnvironment e) throws IOException {
  super.stop(e);
  cConfCacheSupplier.release();
}
Program: 5340
Project: 5340
Buggy source:
@Override public void start(CoprocessorEnvironment e) throws IOException {
  if (e instanceof RegionCoprocessorEnvironment) {
    RegionCoprocessorEnvironment env=(RegionCoprocessorEnvironment)e;
    HTableDescriptor tableDesc=env.getRegion().getTableDesc();
    String hbaseNamespacePrefix=tableDesc.getValue(Constants.Dataset.TABLE_PREFIX);
    this.sysConfigTablePrefix=HTableNameConverter.getSysConfigTablePrefix(hbaseNamespacePrefix);
    this.cConfCache=createCConfCache(env);
  }
  super.start(e);
}

Fixed version (ground truth):
@Override public void start(CoprocessorEnvironment e) throws IOException {
  if (e instanceof RegionCoprocessorEnvironment) {
    RegionCoprocessorEnvironment env=(RegionCoprocessorEnvironment)e;
    HTableDescriptor tableDesc=env.getRegion().getTableDesc();
    String hbaseNamespacePrefix=tableDesc.getValue(Constants.Dataset.TABLE_PREFIX);
    this.sysConfigTablePrefix=HTableNameConverter.getSysConfigTablePrefix(hbaseNamespacePrefix);
    this.cConfCacheSupplier=new CConfigurationCacheSupplier(env.getConfiguration(),sysConfigTablePrefix);
    this.cConfCache=cConfCacheSupplier.get();
  }
  super.start(e);
}
Program: 5341
Project: 5341
Buggy source:
@Override public void start(CoprocessorEnvironment env) throws IOException {
  if (env instanceof RegionCoprocessorEnvironment) {
    HTableDescriptor tableDesc=((RegionCoprocessorEnvironment)env).getRegion().getTableDesc();
    metadataTableNamespace=tableDesc.getValue(Constants.MessagingSystem.HBASE_METADATA_TABLE_NAMESPACE);
    hbaseNamespacePrefix=tableDesc.getValue(Constants.Dataset.TABLE_PREFIX);
    prefixLength=Integer.valueOf(tableDesc.getValue(Constants.MessagingSystem.HBASE_MESSAGING_TABLE_PREFIX_NUM_BYTES));
    String sysConfigTablePrefix=HTableNameConverter.getSysConfigTablePrefix(hbaseNamespacePrefix);
    cConfReader=new CConfigurationReader(env.getConfiguration(),sysConfigTablePrefix);
    Supplier<TransactionStateCache> cacheSupplier=getTransactionStateCacheSupplier(hbaseNamespacePrefix,env.getConfiguration());
    txStateCache=cacheSupplier.get();
    topicMetadataCache=createTopicMetadataCache((RegionCoprocessorEnvironment)env);
  }
}

Fixed version (ground truth):
@Override public void start(CoprocessorEnvironment e) throws IOException {
  if (e instanceof RegionCoprocessorEnvironment) {
    RegionCoprocessorEnvironment env=(RegionCoprocessorEnvironment)e;
    HTableDescriptor tableDesc=env.getRegion().getTableDesc();
    String metadataTableNamespace=tableDesc.getValue(Constants.MessagingSystem.HBASE_METADATA_TABLE_NAMESPACE);
    String hbaseNamespacePrefix=tableDesc.getValue(Constants.Dataset.TABLE_PREFIX);
    prefixLength=Integer.valueOf(tableDesc.getValue(Constants.MessagingSystem.HBASE_MESSAGING_TABLE_PREFIX_NUM_BYTES));
    String sysConfigTablePrefix=HTableNameConverter.getSysConfigTablePrefix(hbaseNamespacePrefix);
    CConfigurationReader cConfReader=new CConfigurationReader(env.getConfiguration(),sysConfigTablePrefix);
    Supplier<TransactionStateCache> cacheSupplier=getTransactionStateCacheSupplier(hbaseNamespacePrefix,env.getConfiguration());
    txStateCache=cacheSupplier.get();
    topicMetadataCacheSupplier=new TopicMetadataCacheSupplier(env,cConfReader,hbaseNamespacePrefix,metadataTableNamespace,new DefaultScanBuilder());
    topicMetadataCache=topicMetadataCacheSupplier.get();
  }
}
Program: 5342
Project: 5342
Buggy source:
@Override public InternalScanner preFlushScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c,Store store,KeyValueScanner memstoreScanner,InternalScanner s) throws IOException {
  TopicMetadataCache metadataCache=getTopicMetadataCache(c.getEnvironment());
  LOG.info("String_Node_Str");
  TransactionVisibilityState txVisibilityState=txStateCache.getLatestState();
  Scan scan=new Scan();
  scan.setFilter(new MessageDataFilter(c.getEnvironment(),System.currentTimeMillis(),prefixLength,metadataCache,txVisibilityState));
  return new LoggingInternalScanner("String_Node_Str","String_Node_Str",new StoreScanner(store,store.getScanInfo(),scan,Collections.singletonList(memstoreScanner),ScanType.COMPACT_DROP_DELETES,store.getSmallestReadPoint(),HConstants.OLDEST_TIMESTAMP),txVisibilityState);
}

Fixed version (ground truth):
@Override public InternalScanner preFlushScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c,Store store,KeyValueScanner memstoreScanner,InternalScanner s) throws IOException {
  LOG.info("String_Node_Str");
  TransactionVisibilityState txVisibilityState=txStateCache.getLatestState();
  Scan scan=new Scan();
  scan.setFilter(new MessageDataFilter(c.getEnvironment(),System.currentTimeMillis(),prefixLength,topicMetadataCache,txVisibilityState));
  return new LoggingInternalScanner("String_Node_Str","String_Node_Str",new StoreScanner(store,store.getScanInfo(),scan,Collections.singletonList(memstoreScanner),ScanType.COMPACT_DROP_DELETES,store.getSmallestReadPoint(),HConstants.OLDEST_TIMESTAMP),txVisibilityState);
}
Program: 5344
Project: 5344
Buggy source:
@Override public void stop(CoprocessorEnvironment e){
  if (e instanceof RegionCoprocessorEnvironment) {
    getTopicMetadataCache((RegionCoprocessorEnvironment)e).stop();
  }
  if (compactionState != null) {
    compactionState.stop();
  }
}

Fixed version (ground truth):
@Override public void stop(CoprocessorEnvironment e){
  topicMetadataCacheSupplier.release();
  if (compactionState != null) {
    compactionState.stop();
  }
}
Program: 5345
Project: 5345
Buggy source:
@Override public void stop(CoprocessorEnvironment e) throws IOException {
  if (e instanceof RegionCoprocessorEnvironment) {
    getTopicMetadataCache((RegionCoprocessorEnvironment)e).stop();
  }
}

Fixed version (ground truth):
@Override public void stop(CoprocessorEnvironment e) throws IOException {
  topicMetadataCacheSupplier.release();
}
Program: 5346
Project: 5346
Buggy source:
@Override public void start(CoprocessorEnvironment env) throws IOException {
  if (env instanceof RegionCoprocessorEnvironment) {
    HTableDescriptor tableDesc=((RegionCoprocessorEnvironment)env).getRegion().getTableDesc();
    metadataTableNamespace=tableDesc.getValue(Constants.MessagingSystem.HBASE_METADATA_TABLE_NAMESPACE);
    hbaseNamespacePrefix=tableDesc.getValue(Constants.Dataset.TABLE_PREFIX);
    prefixLength=Integer.valueOf(tableDesc.getValue(Constants.MessagingSystem.HBASE_MESSAGING_TABLE_PREFIX_NUM_BYTES));
    String sysConfigTablePrefix=HTableNameConverter.getSysConfigTablePrefix(hbaseNamespacePrefix);
    cConfReader=new CConfigurationReader(env.getConfiguration(),sysConfigTablePrefix);
    topicMetadataCache=createTopicMetadataCache((RegionCoprocessorEnvironment)env);
  }
}

Fixed version (ground truth):
@Override public void start(CoprocessorEnvironment e) throws IOException {
  if (e instanceof RegionCoprocessorEnvironment) {
    RegionCoprocessorEnvironment env=(RegionCoprocessorEnvironment)e;
    HTableDescriptor tableDesc=env.getRegion().getTableDesc();
    String metadataTableNamespace=tableDesc.getValue(Constants.MessagingSystem.HBASE_METADATA_TABLE_NAMESPACE);
    String hbaseNamespacePrefix=tableDesc.getValue(Constants.Dataset.TABLE_PREFIX);
    prefixLength=Integer.valueOf(tableDesc.getValue(Constants.MessagingSystem.HBASE_MESSAGING_TABLE_PREFIX_NUM_BYTES));
    String sysConfigTablePrefix=HTableNameConverter.getSysConfigTablePrefix(hbaseNamespacePrefix);
    CConfigurationReader cConfReader=new CConfigurationReader(env.getConfiguration(),sysConfigTablePrefix);
    topicMetadataCacheSupplier=new TopicMetadataCacheSupplier(env,cConfReader,hbaseNamespacePrefix,metadataTableNamespace,new DefaultScanBuilder());
    topicMetadataCache=topicMetadataCacheSupplier.get();
  }
}
Program: 5347
Project: 5347
Buggy source:
@Override public InternalScanner preFlushScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c,Store store,KeyValueScanner memstoreScanner,InternalScanner s) throws IOException {
  TopicMetadataCache metadataCache=getTopicMetadataCache(c.getEnvironment());
  LOG.info("String_Node_Str");
  Scan scan=new Scan();
  scan.setFilter(new PayloadDataFilter(c.getEnvironment(),System.currentTimeMillis(),prefixLength,metadataCache));
  return new StoreScanner(store,store.getScanInfo(),scan,Collections.singletonList(memstoreScanner),ScanType.COMPACT_DROP_DELETES,store.getSmallestReadPoint(),HConstants.OLDEST_TIMESTAMP);
}

Fixed version (ground truth):
@Override public InternalScanner preFlushScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c,Store store,KeyValueScanner memstoreScanner,InternalScanner s) throws IOException {
  LOG.info("String_Node_Str");
  Scan scan=new Scan();
  scan.setFilter(new PayloadDataFilter(c.getEnvironment(),System.currentTimeMillis(),prefixLength,topicMetadataCache));
  return new StoreScanner(store,store.getScanInfo(),scan,Collections.singletonList(memstoreScanner),ScanType.COMPACT_DROP_DELETES,store.getSmallestReadPoint(),HConstants.OLDEST_TIMESTAMP);
}
Program: 5348
Project: 5348
Buggy source:
@Override public InternalScanner preCompactScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c,Store store,List<? extends KeyValueScanner> scanners,ScanType scanType,long earliestPutTs,InternalScanner s,CompactionRequest request) throws IOException {
  TopicMetadataCache metadataCache=getTopicMetadataCache(c.getEnvironment());
  LOG.info("String_Node_Str");
  Scan scan=new Scan();
  scan.setFilter(new PayloadDataFilter(c.getEnvironment(),System.currentTimeMillis(),prefixLength,metadataCache));
  return new StoreScanner(store,store.getScanInfo(),scan,scanners,scanType,store.getSmallestReadPoint(),earliestPutTs);
}

Fixed version (ground truth):
@Override public InternalScanner preCompactScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c,Store store,List<? extends KeyValueScanner> scanners,ScanType scanType,long earliestPutTs,InternalScanner s,CompactionRequest request) throws IOException {
  LOG.info("String_Node_Str");
  Scan scan=new Scan();
  scan.setFilter(new PayloadDataFilter(c.getEnvironment(),System.currentTimeMillis(),prefixLength,topicMetadataCache));
  return new StoreScanner(store,store.getScanInfo(),scan,scanners,scanType,store.getSmallestReadPoint(),earliestPutTs);
}
Program: 5349
Project: 5349
Buggy source:
@Override @Nullable protected Configuration getConfiguration(CoprocessorEnvironment env){
  CConfiguration cConf=getCConfCache((RegionCoprocessorEnvironment)env).getCConf();
  if (cConf == null) {
    return null;
  }
  Configuration hConf=new Configuration();
  for (  Map.Entry<String,String> entry : cConf) {
    hConf.set(entry.getKey(),entry.getValue());
  }
  return hConf;
}

Fixed version (ground truth):
@Override @Nullable protected Configuration getConfiguration(CoprocessorEnvironment env){
  CConfiguration cConf=cConfCache.getCConf();
  if (cConf == null) {
    return null;
  }
  Configuration hConf=new Configuration();
  for (  Map.Entry<String,String> entry : cConf) {
    hConf.set(entry.getKey(),entry.getValue());
  }
  return hConf;
}
Program: 5350
Project: 5350
Buggy source:
@Override public void stop(CoprocessorEnvironment e) throws IOException {
  super.stop(e);
  if (cConfCache != null) {
    cConfCache.stop();
  }
}

Fixed version (ground truth):
@Override public void stop(CoprocessorEnvironment e) throws IOException {
  super.stop(e);
  cConfCacheSupplier.release();
}
Program: 5351
Project: 5351
Buggy source:
@Override public void start(CoprocessorEnvironment e) throws IOException {
  if (e instanceof RegionCoprocessorEnvironment) {
    RegionCoprocessorEnvironment env=(RegionCoprocessorEnvironment)e;
    HTableDescriptor tableDesc=env.getRegion().getTableDesc();
    String hbaseNamespacePrefix=tableDesc.getValue(Constants.Dataset.TABLE_PREFIX);
    this.sysConfigTablePrefix=HTableNameConverter.getSysConfigTablePrefix(hbaseNamespacePrefix);
    this.cConfCache=createCConfCache(env);
  }
  super.start(e);
}

Fixed version (ground truth):
@Override public void start(CoprocessorEnvironment e) throws IOException {
  if (e instanceof RegionCoprocessorEnvironment) {
    RegionCoprocessorEnvironment env=(RegionCoprocessorEnvironment)e;
    HTableDescriptor tableDesc=env.getRegion().getTableDesc();
    String hbaseNamespacePrefix=tableDesc.getValue(Constants.Dataset.TABLE_PREFIX);
    this.sysConfigTablePrefix=HTableNameConverter.getSysConfigTablePrefix(hbaseNamespacePrefix);
    this.cConfCacheSupplier=new CConfigurationCacheSupplier(env.getConfiguration(),sysConfigTablePrefix);
    this.cConfCache=cConfCacheSupplier.get();
  }
  super.start(e);
}
Program: 5352
Project: 5352
Buggy source:
@Override protected void startUp() throws Exception {
  DatasetId serviceStoreDatasetInstanceId=NamespaceId.SYSTEM.dataset(Constants.Service.SERVICE_INSTANCE_TABLE_NAME);
  table=DatasetsUtil.getOrCreateDataset(dsFramework,serviceStoreDatasetInstanceId,NoTxKeyValueTable.class.getName(),DatasetProperties.EMPTY,null,null);
}

Fixed version (ground truth):
@Override protected void startUp() throws Exception {
  final DatasetId serviceStoreDatasetInstanceId=NamespaceId.SYSTEM.dataset(Constants.Service.SERVICE_INSTANCE_TABLE_NAME);
  table=Retries.supplyWithRetries(new Supplier<NoTxKeyValueTable>(){
    @Override public NoTxKeyValueTable get(){
      try {
        return DatasetsUtil.getOrCreateDataset(dsFramework,serviceStoreDatasetInstanceId,NoTxKeyValueTable.class.getName(),DatasetProperties.EMPTY,null,null);
      }
 catch (      Exception e) {
        LOG.warn("String_Node_Str",serviceStoreDatasetInstanceId,e.getMessage());
        throw new RetryableException(e);
      }
    }
  }
,RetryStrategies.exponentialDelay(1,30,TimeUnit.SECONDS));
}
Program: 5355
Project: 5355
Buggy source:
@Override public void failed(Service.State from,@Nullable Throwable failure){
  closeAllQuietly(closeables);
  runtimeStore.setStop(programId,runId.getId(),TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()),ProgramController.State.ERROR.getRunStatus(),new BasicThrowable(failure));
}

Fixed version (ground truth):
@Override public void failed(Service.State from,@Nullable final Throwable failure){
  closeAllQuietly(closeables);
  Retries.supplyWithRetries(new Supplier<Void>(){
    @Override public Void get(){
      runtimeStore.setStop(programId,runId.getId(),TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()),ProgramController.State.ERROR.getRunStatus(),new BasicThrowable(failure));
      return null;
    }
  }
,RetryStrategies.fixDelay(Constants.Retry.RUN_RECORD_UPDATE_RETRY_DELAY_SECS,TimeUnit.SECONDS));
}
Program: 5356
Project: 5356
Buggy source:
@Override public void starting(){
  long startTimeInSeconds=RunIds.getTime(runId,TimeUnit.SECONDS);
  if (startTimeInSeconds == -1) {
    startTimeInSeconds=TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis());
  }
  runtimeStore.setStart(programId,runId.getId(),startTimeInSeconds,twillRunId,userArgs.asMap(),arguments.asMap());
}

Fixed version (ground truth):
@Override public void starting(){
  long startTimeInSeconds=RunIds.getTime(runId,TimeUnit.SECONDS);
  if (startTimeInSeconds == -1) {
    startTimeInSeconds=TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis());
  }
  final long finalStartTimeInSeconds=startTimeInSeconds;
  Retries.supplyWithRetries(new Supplier<Void>(){
    @Override public Void get(){
      runtimeStore.setStart(programId,runId.getId(),finalStartTimeInSeconds,twillRunId,userArgs.asMap(),arguments.asMap());
      return null;
    }
  }
,RetryStrategies.fixDelay(Constants.Retry.RUN_RECORD_UPDATE_RETRY_DELAY_SECS,TimeUnit.SECONDS));
}
Program: 5357
Project: 5357
Buggy source:
@Override public void terminated(Service.State from){
  closeAllQuietly(closeables);
  ProgramRunStatus runStatus=ProgramController.State.COMPLETED.getRunStatus();
  if (from == Service.State.STOPPING) {
    runStatus=ProgramController.State.KILLED.getRunStatus();
  }
  runtimeStore.setStop(programId,runId.getId(),TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()),runStatus);
}

Fixed version (ground truth):
@Override public void terminated(Service.State from){
  closeAllQuietly(closeables);
  ProgramRunStatus runStatus=ProgramController.State.COMPLETED.getRunStatus();
  if (from == Service.State.STOPPING) {
    runStatus=ProgramController.State.KILLED.getRunStatus();
  }
  final ProgramRunStatus finalRunStatus=runStatus;
  Retries.supplyWithRetries(new Supplier<Void>(){
    @Override public Void get(){
      runtimeStore.setStop(programId,runId.getId(),TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()),finalRunStatus);
      return null;
    }
  }
,RetryStrategies.fixDelay(Constants.Retry.RUN_RECORD_UPDATE_RETRY_DELAY_SECS,TimeUnit.SECONDS));
}
Program: 5358
Project: 5358
Buggy source:
@Override public void init(ProgramController.State state,@Nullable Throwable cause){
  long startTimeInSeconds=RunIds.getTime(controller.getRunId(),TimeUnit.SECONDS);
  if (startTimeInSeconds == -1) {
    startTimeInSeconds=TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis());
  }
  runtimeStore.setStart(program.getId(),runId.getId(),startTimeInSeconds,twillRunId,options.getUserArguments().asMap(),options.getArguments().asMap());
  if (state == ProgramController.State.COMPLETED) {
    completed();
  }
  if (state == ProgramController.State.ERROR) {
    error(controller.getFailureCause());
  }
}

Fixed version (ground truth):
@Override public void init(ProgramController.State state,@Nullable Throwable cause){
  long startTimeInSeconds=RunIds.getTime(controller.getRunId(),TimeUnit.SECONDS);
  if (startTimeInSeconds == -1) {
    startTimeInSeconds=TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis());
  }
  final long finalStartTimeInSeconds=startTimeInSeconds;
  Retries.supplyWithRetries(new Supplier<Void>(){
    @Override public Void get(){
      runtimeStore.setStart(program.getId(),runId.getId(),finalStartTimeInSeconds,twillRunId,options.getUserArguments().asMap(),options.getArguments().asMap());
      return null;
    }
  }
,RetryStrategies.fixDelay(Constants.Retry.RUN_RECORD_UPDATE_RETRY_DELAY_SECS,TimeUnit.SECONDS));
  if (state == ProgramController.State.COMPLETED) {
    completed();
  }
  if (state == ProgramController.State.ERROR) {
    error(controller.getFailureCause());
  }
}
Program: 5359
Project: 5359
Buggy source:
@Override public void resuming(){
  LOG.debug("String_Node_Str",program.getId(),runId.getId());
  runtimeStore.setResume(program.getId(),runId.getId());
}

Fixed version (ground truth):
@Override public void resuming(){
  LOG.debug("String_Node_Str",program.getId(),runId.getId());
  Retries.supplyWithRetries(new Supplier<Void>(){
    @Override public Void get(){
      runtimeStore.setResume(program.getId(),runId.getId());
      return null;
    }
  }
,RetryStrategies.fixDelay(Constants.Retry.RUN_RECORD_UPDATE_RETRY_DELAY_SECS,TimeUnit.SECONDS));
}
Program: 5361
Project: 5361
Buggy source:
@Override public void completed(){
  LOG.debug("String_Node_Str",program.getId(),runId.getId());
  runtimeStore.setStop(program.getId(),runId.getId(),TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()),ProgramController.State.COMPLETED.getRunStatus());
}

Fixed version (ground truth):
@Override public void completed(){
  LOG.debug("String_Node_Str",program.getId(),runId.getId());
  Retries.supplyWithRetries(new Supplier<Void>(){
    @Override public Void get(){
      runtimeStore.setStop(program.getId(),runId.getId(),TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()),ProgramController.State.COMPLETED.getRunStatus());
      return null;
    }
  }
,RetryStrategies.fixDelay(Constants.Retry.RUN_RECORD_UPDATE_RETRY_DELAY_SECS,TimeUnit.SECONDS));
}
Program: 5362
Project: 5362
Buggy source:
@Override public void error(Throwable cause){
  LOG.info("String_Node_Str",program.getId(),runId.getId(),cause);
  closeAllQuietly(closeables);
  runtimeStore.setStop(program.getId(),runId.getId(),TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()),ProgramController.State.ERROR.getRunStatus(),new BasicThrowable(cause));
}

Fixed version (ground truth):
@Override public void error(final Throwable cause){
  LOG.info("String_Node_Str",program.getId(),runId.getId(),cause);
  closeAllQuietly(closeables);
  Retries.supplyWithRetries(new Supplier<Void>(){
    @Override public Void get(){
      runtimeStore.setStop(program.getId(),runId.getId(),TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()),ProgramController.State.ERROR.getRunStatus(),new BasicThrowable(cause));
      return null;
    }
  }
,RetryStrategies.fixDelay(Constants.Retry.RUN_RECORD_UPDATE_RETRY_DELAY_SECS,TimeUnit.SECONDS));
}
Program: 5363
Project: 5363
Buggy source:
@Override public void killed(){
  LOG.debug("String_Node_Str",program.getId(),runId.getId());
  runtimeStore.setStop(program.getId(),runId.getId(),TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()),ProgramController.State.KILLED.getRunStatus());
}

Fixed version (ground truth):
@Override public void killed(){
  LOG.debug("String_Node_Str",program.getId(),runId.getId());
  Retries.supplyWithRetries(new Supplier<Void>(){
    @Override public Void get(){
      runtimeStore.setStop(program.getId(),runId.getId(),TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()),ProgramController.State.KILLED.getRunStatus());
      return null;
    }
  }
,RetryStrategies.fixDelay(Constants.Retry.RUN_RECORD_UPDATE_RETRY_DELAY_SECS,TimeUnit.SECONDS));
}
Program: 5364
Project: 5364
Buggy source:
@Override public void suspended(){
  LOG.debug("String_Node_Str",program.getId(),runId.getId());
  runtimeStore.setSuspend(program.getId(),runId.getId());
}

Fixed version (ground truth):
@Override public void suspended(){
  LOG.debug("String_Node_Str",program.getId(),runId.getId());
  Retries.supplyWithRetries(new Supplier<Void>(){
    @Override public Void get(){
      runtimeStore.setSuspend(program.getId(),runId.getId());
      return null;
    }
  }
,RetryStrategies.fixDelay(Constants.Retry.RUN_RECORD_UPDATE_RETRY_DELAY_SECS,TimeUnit.SECONDS));
}
Program: 5365
Project: 5365
Buggy source:
@Override public void error(Throwable cause){
  LOG.info("String_Node_Str",programId,runId,cause);
  store.setStop(programId,runId,TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()),ProgramController.State.ERROR.getRunStatus(),new BasicThrowable(cause));
}

Fixed version (ground truth):
@Override public void error(final Throwable cause){
  LOG.info("String_Node_Str",programId,runId,cause);
  Retries.supplyWithRetries(new Supplier<Void>(){
    @Override public Void get(){
      store.setStop(programId,runId,TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()),ProgramController.State.ERROR.getRunStatus(),new BasicThrowable(cause));
      return null;
    }
  }
,RetryStrategies.fixDelay(Constants.Retry.RUN_RECORD_UPDATE_RETRY_DELAY_SECS,TimeUnit.SECONDS));
}
Program: 5366
Project: 5366
Buggy source:
@Override public void resuming(){
  LOG.debug("String_Node_Str",programId,runId);
  store.setResume(programId,runId);
}

Fixed version (ground truth):
@Override public void resuming(){
  LOG.debug("String_Node_Str",programId,runId);
  Retries.supplyWithRetries(new Supplier<Void>(){
    @Override public Void get(){
      store.setResume(programId,runId);
      return null;
    }
  }
,RetryStrategies.fixDelay(Constants.Retry.RUN_RECORD_UPDATE_RETRY_DELAY_SECS,TimeUnit.SECONDS));
}
Program: 5367
Project: 5367
Buggy source:
@Override public void init(ProgramController.State state,@Nullable Throwable cause){
  long startTimeInSeconds=RunIds.getTime(controller.getRunId(),TimeUnit.SECONDS);
  if (startTimeInSeconds == -1) {
    startTimeInSeconds=TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis());
  }
  store.setStart(programId,runId,startTimeInSeconds,twillRunId,userArgs,systemArgs);
  if (state == ProgramController.State.COMPLETED) {
    completed();
  }
  if (state == ProgramController.State.ERROR) {
    error(controller.getFailureCause());
  }
}

Fixed version (ground truth):
@Override public void init(ProgramController.State state,@Nullable Throwable cause){
  long startTimeInSeconds=RunIds.getTime(controller.getRunId(),TimeUnit.SECONDS);
  if (startTimeInSeconds == -1) {
    startTimeInSeconds=TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis());
  }
  final long finalStartTimeInSeconds=startTimeInSeconds;
  Retries.supplyWithRetries(new Supplier<Void>(){
    @Override public Void get(){
      store.setStart(programId,runId,finalStartTimeInSeconds,twillRunId,userArgs,systemArgs);
      return null;
    }
  }
,RetryStrategies.fixDelay(Constants.Retry.RUN_RECORD_UPDATE_RETRY_DELAY_SECS,TimeUnit.SECONDS));
  if (state == ProgramController.State.COMPLETED) {
    completed();
  }
  if (state == ProgramController.State.ERROR) {
    error(controller.getFailureCause());
  }
}
Program: 5369
Project: 5369
Buggy source:
@Override public void completed(){
  LOG.debug("String_Node_Str",programId);
  store.setStop(programId,runId,TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()),ProgramController.State.COMPLETED.getRunStatus());
}

Fixed version (ground truth):
@Override public void completed(){
  LOG.debug("String_Node_Str",programId);
  Retries.supplyWithRetries(new Supplier<Void>(){
    @Override public Void get(){
      store.setStop(programId,runId,TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()),ProgramController.State.COMPLETED.getRunStatus());
      return null;
    }
  }
,RetryStrategies.fixDelay(Constants.Retry.RUN_RECORD_UPDATE_RETRY_DELAY_SECS,TimeUnit.SECONDS));
}
Program: 5370
Project: 5370
Buggy source:
@Override public void killed(){
  LOG.debug("String_Node_Str",programId);
  store.setStop(programId,runId,TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()),ProgramController.State.KILLED.getRunStatus());
}

Fixed version (ground truth):
@Override public void killed(){
  LOG.debug("String_Node_Str",programId);
  Retries.supplyWithRetries(new Supplier<Void>(){
    @Override public Void get(){
      store.setStop(programId,runId,TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()),ProgramController.State.KILLED.getRunStatus());
      return null;
    }
  }
,RetryStrategies.fixDelay(Constants.Retry.RUN_RECORD_UPDATE_RETRY_DELAY_SECS,TimeUnit.SECONDS));
}
Program: 5371
Project: 5371
Buggy source:
@Override public void suspended(){
  LOG.debug("String_Node_Str",programId,runId);
  store.setSuspend(programId,runId);
}

Fixed version (ground truth):
@Override public void suspended(){
  LOG.debug("String_Node_Str",programId,runId);
  Retries.supplyWithRetries(new Supplier<Void>(){
    @Override public Void get(){
      store.setSuspend(programId,runId);
      return null;
    }
  }
,RetryStrategies.fixDelay(Constants.Retry.RUN_RECORD_UPDATE_RETRY_DELAY_SECS,TimeUnit.SECONDS));
}
Program: 5373
Project: 5373
Buggy source:
@Path("String_Node_Str") @GET public void getIdleRegions(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") @DefaultValue("String_Node_Str") int numRegions){
  if (debugClazz == null || debugObject == null) {
    responder.sendString(HttpResponseStatus.INTERNAL_SERVER_ERROR,"String_Node_Str");
    return;
  }
  try {
    Method method=debugClazz.getMethod("String_Node_Str",Integer.class);
    method.setAccessible(true);
    Object response=method.invoke(debugObject,numRegions);
    Queue<RegionPruneInfo> pruneInfos=(Queue<RegionPruneInfo>)response;
    responder.sendJson(HttpResponseStatus.OK,pruneInfos);
  }
 catch (  Exception e) {
    responder.sendString(HttpResponseStatus.BAD_REQUEST,e.getMessage());
    LOG.debug("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Path("String_Node_Str") @GET public void getIdleRegions(HttpRequest request,HttpResponder responder,@QueryParam("String_Node_Str") @DefaultValue("String_Node_Str") int numRegions){
  if (debugClazz == null || debugObject == null) {
    responder.sendString(HttpResponseStatus.INTERNAL_SERVER_ERROR,"String_Node_Str");
    return;
  }
  try {
    Method method=debugClazz.getMethod("String_Node_Str",Integer.class);
    method.setAccessible(true);
    Object response=method.invoke(debugObject,numRegions);
    Queue<RegionPruneInfo> pruneInfos=(Queue<RegionPruneInfo>)response;
    responder.sendJson(HttpResponseStatus.OK,pruneInfos);
  }
 catch (  Exception e) {
    responder.sendString(HttpResponseStatus.BAD_REQUEST,e.getMessage());
    LOG.debug("String_Node_Str",e);
  }
}
Program: 5374
Project: 5374
Buggy source:
@Inject public TransactionHttpHandler(TransactionSystemClient txClient){
  this.txClient=txClient;
}

Fixed version (ground truth):
@Inject public TransactionHttpHandler(CConfiguration cConf,TransactionSystemClient txClient){
  this.txClient=txClient;
  try {
    this.debugClazz=getClass().getClassLoader().loadClass("String_Node_Str");
    this.debugObject=debugClazz.newInstance();
    Configuration hConf=new Configuration();
    for (    Map.Entry<String,String> entry : cConf) {
      hConf.set(entry.getKey(),entry.getValue());
    }
    Method initMethod=debugClazz.getMethod("String_Node_Str",Configuration.class);
    initMethod.setAccessible(true);
    initMethod.invoke(debugObject,hConf);
  }
 catch (  ClassNotFoundException|IllegalAccessException|InstantiationException ex) {
    LOG.warn("String_Node_Str",ex);
    this.debugClazz=null;
  }
catch (  NoSuchMethodException|InvocationTargetException ex) {
    LOG.warn("String_Node_Str",ex);
    this.debugClazz=null;
  }
}
Program: 5375
Project: 5375
Buggy source:
@Override protected void doStop(){
  startupThread.interrupt();
  Uninterruptibles.joinUninterruptibly(startupThread);
  Service service=currentDelegate;
  if (service != null) {
    Futures.addCallback(service.stop(),new FutureCallback<State>(){
      @Override public void onSuccess(      State result){
        notifyStopped();
      }
      @Override public void onFailure(      Throwable t){
        notifyFailed(t);
      }
    }
,Threads.SAME_THREAD_EXECUTOR);
  }
 else {
    notifyStopped();
  }
}

Fixed version (ground truth):
@Override protected void doStop(){
  stopped=true;
  startupThread.interrupt();
  Uninterruptibles.joinUninterruptibly(startupThread);
  Service service=currentDelegate;
  if (service != null) {
    Futures.addCallback(service.stop(),new FutureCallback<State>(){
      @Override public void onSuccess(      State result){
        notifyStopped();
      }
      @Override public void onFailure(      Throwable t){
        notifyFailed(t);
      }
    }
,Threads.SAME_THREAD_EXECUTOR);
  }
 else {
    notifyStopped();
  }
}
Program: 5377
Project: 5377
Buggy source:
@Override public void run(){
  int failures=0;
  long startTime=System.currentTimeMillis();
  long delay=0L;
  Service delegateService=service;
  while (delay >= 0 && !isInterrupted()) {
    try {
      currentDelegate=delegateService;
      delegateService.start().get();
      break;
    }
 catch (    InterruptedException e) {
      interrupt();
      break;
    }
catch (    Throwable t) {
      LOG.debug("String_Node_Str",delegateServiceName,t);
      delay=retryStrategy.nextRetry(++failures,startTime);
      if (delay < 0) {
        LOG.error("String_Node_Str",delegateServiceName,failures,System.currentTimeMillis() - startTime);
        notifyFailed(t);
        break;
      }
      try {
        TimeUnit.MILLISECONDS.sleep(delay);
        LOG.debug("String_Node_Str",delegateServiceName);
        delegateService=delegate.get();
      }
 catch (      InterruptedException e) {
        interrupt();
      }
    }
  }
  if (isInterrupted()) {
    LOG.warn("String_Node_Str",delegateServiceName);
  }
}

Fixed version (ground truth):
@Override public void run(){
  int failures=0;
  long startTime=System.currentTimeMillis();
  long delay=0L;
  Service delegateService=service;
  while (delay >= 0 && !isInterrupted() && !stopped) {
    try {
      currentDelegate=delegateService;
      delegateService.start().get();
      break;
    }
 catch (    InterruptedException e) {
      interrupt();
      break;
    }
catch (    Throwable t) {
      LOG.debug("String_Node_Str",delegateServiceName,t);
      delay=retryStrategy.nextRetry(++failures,startTime);
      if (delay < 0) {
        LOG.error("String_Node_Str",delegateServiceName,failures,System.currentTimeMillis() - startTime);
        notifyFailed(t);
        break;
      }
      try {
        TimeUnit.MILLISECONDS.sleep(delay);
        LOG.debug("String_Node_Str",delegateServiceName);
        delegateService=delegate.get();
      }
 catch (      InterruptedException e) {
        interrupt();
      }
    }
  }
  if (isInterrupted()) {
    LOG.warn("String_Node_Str",delegateServiceName);
  }
}
Program: 5378
Project: 5378
Buggy source:
@BeforeClass public static void init() throws Exception {
  cConf=CConfiguration.create();
  cConf.set(Constants.CFG_LOCAL_DATA_DIR,TEMP_FOLDER.newFolder().getAbsolutePath());
  miniKdc=new MiniKdc(MiniKdc.createConf(),TEMP_FOLDER.newFolder());
  miniKdc.start();
  System.setProperty("String_Node_Str",miniKdc.getKrb5conf().getAbsolutePath());
  keytabFile=TEMP_FOLDER.newFile();
  miniKdc.createPrincipal(keytabFile,"String_Node_Str","String_Node_Str","String_Node_Str");
  Configuration hConf=new Configuration();
  hConf.set(MiniDFSCluster.HDFS_MINIDFS_BASEDIR,TEMP_FOLDER.newFolder().getAbsolutePath());
  miniDFSCluster=new MiniDFSCluster.Builder(hConf).numDataNodes(1).build();
  miniDFSCluster.waitClusterUp();
  locationFactory=new FileContextLocationFactory(miniDFSCluster.getFileSystem().getConf());
  hConf=new Configuration();
  hConf.set("String_Node_Str","String_Node_Str");
  UserGroupInformation.setConfiguration(hConf);
}

Fixed version (ground truth):
@BeforeClass public static void init() throws Exception {
  cConf=CConfiguration.create();
  cConf.set(Constants.CFG_LOCAL_DATA_DIR,TEMP_FOLDER.newFolder().getAbsolutePath());
  miniKdc=new MiniKdc(MiniKdc.createConf(),TEMP_FOLDER.newFolder());
  miniKdc.start();
  System.setProperty("String_Node_Str",miniKdc.getKrb5conf().getAbsolutePath());
  keytabFile=TEMP_FOLDER.newFile();
  miniKdc.createPrincipal(keytabFile,"String_Node_Str","String_Node_Str","String_Node_Str");
  Configuration hConf=new Configuration();
  hConf.set(MiniDFSCluster.HDFS_MINIDFS_BASEDIR,TEMP_FOLDER.newFolder().getAbsolutePath());
  hConf.setBoolean("String_Node_Str",true);
  miniDFSCluster=new MiniDFSCluster.Builder(hConf).numDataNodes(1).build();
  miniDFSCluster.waitClusterUp();
  locationFactory=new FileContextLocationFactory(miniDFSCluster.getFileSystem().getConf());
  hConf=new Configuration();
  hConf.set("String_Node_Str","String_Node_Str");
  UserGroupInformation.setConfiguration(hConf);
}
Program: 5379
Project: 5379
Buggy source:
@Path("String_Node_Str") @POST public void getCredentials(HttpRequest request,HttpResponder responder) throws IOException {
  ImpersonationInfo impersonationInfo=new Gson().fromJson(request.getContent().toString(StandardCharsets.UTF_8),ImpersonationInfo.class);
  Credentials credentials=new Credentials();
  credentials.addToken(new Text("String_Node_Str"),new Token<>(impersonationInfo.getPrincipal().getBytes(StandardCharsets.UTF_8),impersonationInfo.getPrincipal().getBytes(StandardCharsets.UTF_8),new Text("String_Node_Str"),new Text("String_Node_Str")));
  credentials.addToken(new Text("String_Node_Str"),new Token<>(impersonationInfo.getKeytabURI().getBytes(StandardCharsets.UTF_8),impersonationInfo.getKeytabURI().getBytes(StandardCharsets.UTF_8),new Text("String_Node_Str"),new Text("String_Node_Str")));
  Location credentialsDir=locationFactory.create("String_Node_Str");
  Preconditions.checkState(credentialsDir.mkdirs());
  Location credentialsFile=credentialsDir.append("String_Node_Str").getTempFile("String_Node_Str");
  try (DataOutputStream os=new DataOutputStream(new BufferedOutputStream(credentialsFile.getOutputStream()))){
    credentials.writeTokenStorageToStream(os);
  }
   responder.sendString(HttpResponseStatus.OK,credentialsFile.toURI().toString());
}

Fixed version (ground truth):
@Path("String_Node_Str") @POST public void getCredentials(HttpRequest request,HttpResponder responder) throws IOException {
  ImpersonationInfo impersonationInfo=new Gson().fromJson(request.getContent().toString(StandardCharsets.UTF_8),ImpersonationInfo.class);
  Credentials credentials=new Credentials();
  credentials.addToken(new Text("String_Node_Str"),new Token<>(impersonationInfo.getPrincipal().getBytes(StandardCharsets.UTF_8),impersonationInfo.getPrincipal().getBytes(StandardCharsets.UTF_8),new Text("String_Node_Str"),new Text("String_Node_Str")));
  credentials.addToken(new Text("String_Node_Str"),new Token<>(impersonationInfo.getKeytabURI().getBytes(StandardCharsets.UTF_8),impersonationInfo.getKeytabURI().getBytes(StandardCharsets.UTF_8),new Text("String_Node_Str"),new Text("String_Node_Str")));
  Location credentialsDir=locationFactory.create("String_Node_Str");
  if (!credentialsDir.exists()) {
    Preconditions.checkState(credentialsDir.mkdirs());
  }
  Location credentialsFile=credentialsDir.append("String_Node_Str").getTempFile("String_Node_Str");
  try (DataOutputStream os=new DataOutputStream(new BufferedOutputStream(credentialsFile.getOutputStream()))){
    credentials.writeTokenStorageToStream(os);
  }
   responder.sendString(HttpResponseStatus.OK,credentialsFile.toURI().toString());
}
Program: 5381
Project: 5381
Buggy source:
/** 
 * Sets the logging context. <p> NOTE: in work execution frameworks where threads are shared between workers (like Akka) we would have to init context very frequently (before every chunk of work is started). In that case we really want to re-use logging context object instance. </p>
 * @param context context to set
 */
public static void setLoggingContext(LoggingContext context){
  loggingContext.set(context);
}

Fixed version (ground truth):
/** 
 * Sets the logging context. <p> NOTE: in work execution frameworks where threads are shared between workers (like Akka) we would have to init context very frequently (before every chunk of work is started). In that case we really want to re-use logging context object instance. </p>
 * @param context context to set
 */
public static void setLoggingContext(LoggingContext context){
  loggingContext.set(context);
  try {
    MDC.setContextMap(context.getSystemTagsAsString());
  }
 catch (  IllegalStateException e) {
  }
}
Program: 5382
Project: 5382
Buggy source:
public DefaultStreamBatchWriter(HttpURLConnection connection,Id.Stream stream) throws IOException {
  this.connection=connection;
  this.outputStream=connection.getOutputStream();
  this.stream=stream;
  this.open=true;
}

Fixed version (ground truth):
public DefaultStreamBatchWriter(HttpURLConnection connection,StreamId stream) throws IOException {
  this.connection=connection;
  this.outputStream=connection.getOutputStream();
  this.stream=stream;
  this.open=true;
}
Program: 5383
Project: 5383
Buggy source:
private void registerStream(Id.Stream stream){
  if (!isStreamRegistered.containsKey(stream)) {
    runtimeUsageRegistry.registerAll(owners,stream.toEntityId());
    isStreamRegistered.put(stream,true);
  }
  lineageWriter.addAccess(run.toEntityId(),stream.toEntityId(),AccessType.WRITE);
}

Fixed version (ground truth):
private void registerStream(StreamId stream){
  if (!isStreamRegistered.containsKey(stream)) {
    runtimeUsageRegistry.registerAll(owners,stream);
    isStreamRegistered.put(stream,true);
  }
  lineageWriter.addAccess(run,stream,AccessType.WRITE);
}
Program: 5384
Project: 5384
Buggy source:
private void writeToStream(Id.Stream stream,HttpRequest.Builder builder) throws IOException {
  if (authorizationEnabled) {
    builder.addHeader(Constants.Security.Headers.USER_ID,authenticationContext.getPrincipal().getName());
  }
  HttpResponse response=HttpRequests.execute(builder.build(),new DefaultHttpRequestConfig(false));
  int responseCode=response.getResponseCode();
  if (responseCode == HttpResponseStatus.NOT_FOUND.getCode()) {
    throw new IOException(String.format("String_Node_Str",stream));
  }
  registerStream(stream);
  if (responseCode < 200 || responseCode >= 300) {
    throw new IOException(String.format("String_Node_Str",stream,responseCode));
  }
}

Fixed version (ground truth):
private void writeToStream(StreamId stream,HttpRequest.Builder builder) throws IOException {
  if (authorizationEnabled) {
    builder.addHeader(Constants.Security.Headers.USER_ID,authenticationContext.getPrincipal().getName());
  }
  HttpResponse response=remoteClient.execute(builder.build());
  int responseCode=response.getResponseCode();
  if (responseCode == HttpResponseStatus.NOT_FOUND.getCode()) {
    throw new IOException(String.format("String_Node_Str",stream));
  }
  registerStream(stream);
  if (responseCode < 200 || responseCode >= 300) {
    throw new IOException(String.format("String_Node_Str",stream,responseCode));
  }
}
Program: 5385
Project: 5385
Buggy source:
@Override public StreamBatchWriter createBatchWriter(String stream,String contentType) throws IOException {
  URL url=getStreamURL(stream,true);
  HttpURLConnection connection=(HttpURLConnection)url.openConnection();
  connection.setRequestMethod(HttpMethod.POST.name());
  connection.setReadTimeout(15000);
  connection.setConnectTimeout(15000);
  connection.setRequestProperty(HttpHeaders.CONTENT_TYPE,contentType);
  if (authorizationEnabled) {
    connection.setRequestProperty(Constants.Security.Headers.USER_ID,authenticationContext.getPrincipal().getName());
  }
  connection.setDoOutput(true);
  connection.setChunkedStreamingMode(0);
  connection.connect();
  try {
    Id.Stream streamId=Id.Stream.from(namespace,stream);
    registerStream(streamId);
    return new DefaultStreamBatchWriter(connection,streamId);
  }
 catch (  IOException e) {
    connection.disconnect();
    throw e;
  }
}

Fixed version (ground truth):
@Override public StreamBatchWriter createBatchWriter(final String stream,String contentType) throws IOException {
  URL url=Retries.callWithRetries(new Retries.Callable<URL,IOException>(){
    @Override public URL call() throws IOException {
      return remoteClient.resolve(stream + "String_Node_Str");
    }
  }
,retryStrategy);
  HttpURLConnection connection=(HttpURLConnection)url.openConnection();
  connection.setRequestMethod(HttpMethod.POST.name());
  connection.setReadTimeout(15000);
  connection.setConnectTimeout(15000);
  connection.setRequestProperty(HttpHeaders.CONTENT_TYPE,contentType);
  if (authorizationEnabled) {
    connection.setRequestProperty(Constants.Security.Headers.USER_ID,authenticationContext.getPrincipal().getName());
  }
  connection.setDoOutput(true);
  connection.setChunkedStreamingMode(0);
  connection.connect();
  try {
    StreamId streamId=namespace.stream(stream);
    registerStream(streamId);
    return new DefaultStreamBatchWriter(connection,streamId);
  }
 catch (  IOException e) {
    connection.disconnect();
    throw e;
  }
}
Program: 5386
Project: 5386
Buggy source:
@Inject public DefaultStreamWriter(@Assisted("String_Node_Str") Id.Run run,@Assisted("String_Node_Str") Iterable<? extends EntityId> owners,@Assisted("String_Node_Str") RetryStrategy retryStrategy,RuntimeUsageRegistry runtimeUsageRegistry,LineageWriter lineageWriter,DiscoveryServiceClient discoveryServiceClient,AuthenticationContext authenticationContext,CConfiguration cConf){
  this.run=run;
  this.namespace=run.getNamespace();
  this.owners=owners;
  this.lineageWriter=lineageWriter;
  this.endpointStrategy=new RandomEndpointStrategy(discoveryServiceClient.discover(Constants.Service.STREAMS));
  this.isStreamRegistered=Maps.newConcurrentMap();
  this.runtimeUsageRegistry=runtimeUsageRegistry;
  this.authenticationContext=authenticationContext;
  this.authorizationEnabled=cConf.getBoolean(Constants.Security.Authorization.ENABLED);
  this.retryStrategy=retryStrategy;
}

Fixed version (ground truth):
@Inject public DefaultStreamWriter(@Assisted("String_Node_Str") Id.Run run,@Assisted("String_Node_Str") Iterable<? extends EntityId> owners,@Assisted("String_Node_Str") RetryStrategy retryStrategy,RuntimeUsageRegistry runtimeUsageRegistry,LineageWriter lineageWriter,DiscoveryServiceClient discoveryServiceClient,AuthenticationContext authenticationContext,CConfiguration cConf){
  this.run=run.toEntityId();
  this.namespace=run.getNamespace().toEntityId();
  this.owners=owners;
  this.lineageWriter=lineageWriter;
  this.isStreamRegistered=Maps.newConcurrentMap();
  this.runtimeUsageRegistry=runtimeUsageRegistry;
  this.authenticationContext=authenticationContext;
  this.authorizationEnabled=cConf.getBoolean(Constants.Security.Authorization.ENABLED);
  this.retryStrategy=retryStrategy;
  this.remoteClient=new RemoteClient(discoveryServiceClient,Constants.Service.STREAMS,new DefaultHttpRequestConfig(false),String.format("String_Node_Str",Constants.Gateway.API_VERSION_3,namespace.getNamespace()));
}