nus-yam/ex-repair huggingface dataset:
Program: 6961
Project: 6961
Buggy source:
private void verifyEmittedMessages(KafkaSource source,int msgCount){
  MockEmitter emitter=new MockEmitter();
  SourceState sourceState=source.poll(emitter,new SourceState());
  System.out.println("String_Node_Str" + msgCount);
  System.out.println("String_Node_Str" + emitter.getInternalSize());
  Assert.assertTrue(sourceState.getState() != null && !sourceState.getState().isEmpty());
  Assert.assertTrue(emitter.getInternalSize() == msgCount);
}

Fixed version (ground truth):
private void verifyEmittedMessages(KafkaSource source,int msgCount,SourceState sourceState){
  MockEmitter emitter=new MockEmitter();
  SourceState updatedSourceState=source.poll(emitter,sourceState);
  System.out.println("String_Node_Str" + msgCount);
  System.out.println("String_Node_Str" + emitter.getInternalSize());
  Assert.assertTrue(updatedSourceState.getState() != null && !updatedSourceState.getState().isEmpty());
  Assert.assertTrue(emitter.getInternalSize() == msgCount);
}
Program: 6962
Project: 6962
Buggy source:
/** 
 * Fix all the possible inconsistent states for RunRecords that shows it is in RUNNING state but actually not via check to   {@link ProgramRuntimeService}.
 * @param programType The type of programs the run records nee to validate and update.
 */
private void validateAndCorrectRunningRunRecords(ProgramType programType){
  final Map<RunId,RuntimeInfo> runIdToRuntimeInfo=runtimeService.list(programType);
  List<RunRecord> invalidRunRecords=store.getRuns(ProgramRunStatus.RUNNING,new Predicate<RunRecord>(){
    @Override public boolean apply(    @Nullable RunRecord input){
      if (input == null) {
        return false;
      }
      String runId=input.getPid();
      return !runIdToRuntimeInfo.containsKey(RunIds.fromString(runId));
    }
  }
);
  if (!invalidRunRecords.isEmpty()) {
    LOG.warn("String_Node_Str",invalidRunRecords.size(),programType.getPrettyName());
  }
  for (  RunRecord rr : invalidRunRecords) {
    boolean shouldCorrect=shouldCorrectForWorkflowChildren(rr);
    if (!shouldCorrect) {
      continue;
    }
    String runId=rr.getPid();
    Id.Program targetProgramId=retrieveProgramIdForRunRecord(programType,runId);
    if (targetProgramId != null) {
      store.compareAndSetStatus(targetProgramId,runId,ProgramController.State.ALIVE.getRunStatus(),ProgramController.State.ERROR.getRunStatus());
    }
  }
}

Fixed version (ground truth):
/** 
 * Fix all the possible inconsistent states for RunRecords that shows it is in RUNNING state but actually not via check to   {@link ProgramRuntimeService}.
 * @param programType The type of programs the run records nee to validate and update.
 */
void validateAndCorrectRunningRunRecords(ProgramType programType){
  final Map<RunId,RuntimeInfo> runIdToRuntimeInfo=runtimeService.list(programType);
  List<RunRecord> invalidRunRecords=store.getRuns(ProgramRunStatus.RUNNING,new Predicate<RunRecord>(){
    @Override public boolean apply(    @Nullable RunRecord input){
      if (input == null) {
        return false;
      }
      String runId=input.getPid();
      return !runIdToRuntimeInfo.containsKey(RunIds.fromString(runId));
    }
  }
);
  if (!invalidRunRecords.isEmpty()) {
    LOG.warn("String_Node_Str",invalidRunRecords.size());
  }
  for (  RunRecord rr : invalidRunRecords) {
    boolean shouldCorrect=shouldCorrectForWorkflowChildren(rr);
    if (!shouldCorrect) {
      continue;
    }
    String runId=rr.getPid();
    Id.Program targetProgramId=retrieveProgramIdForRunRecord(programType,runId);
    if (targetProgramId != null) {
      LOG.warn("String_Node_Str",runId,targetProgramId,programType.getPrettyName());
      store.compareAndSetStatus(targetProgramId,runId,ProgramController.State.ALIVE.getRunStatus(),ProgramController.State.ERROR.getRunStatus());
    }
  }
}
Program: 6963
Project: 6963
Buggy source:
private StructuredRecord convertTweet(Status tweet){
  recordBuilder.set(ID,tweet.getId());
  recordBuilder.set(MSG,tweet.getText());
  recordBuilder.set(LANG,tweet.getLang());
  recordBuilder.set(TIME,convertDataToTimeStamp(tweet.getCreatedAt()));
  recordBuilder.set(FAVC,tweet.getFavoriteCount());
  recordBuilder.set(RTC,tweet.getRetweetCount());
  recordBuilder.set(SRC,tweet.getSource());
  if (tweet.getGeoLocation() != null) {
    recordBuilder.set(GLAT,tweet.getGeoLocation().getLatitude());
    recordBuilder.set(GLNG,tweet.getGeoLocation().getLongitude());
  }
 else {
    recordBuilder.set(GLAT,-1d);
    recordBuilder.set(GLNG,-1d);
  }
  recordBuilder.set(ISRT,tweet.isRetweet());
  return recordBuilder.build();
}

Fixed version (ground truth):
private StructuredRecord convertTweet(Status tweet){
  StructuredRecord.Builder recordBuilder=StructuredRecord.builder(this.schema);
  recordBuilder.set(ID,tweet.getId());
  recordBuilder.set(MSG,tweet.getText());
  recordBuilder.set(LANG,tweet.getLang());
  recordBuilder.set(TIME,convertDataToTimeStamp(tweet.getCreatedAt()));
  recordBuilder.set(FAVC,tweet.getFavoriteCount());
  recordBuilder.set(RTC,tweet.getRetweetCount());
  recordBuilder.set(SRC,tweet.getSource());
  if (tweet.getGeoLocation() != null) {
    recordBuilder.set(GLAT,tweet.getGeoLocation().getLatitude());
    recordBuilder.set(GLNG,tweet.getGeoLocation().getLongitude());
  }
 else {
    recordBuilder.set(GLAT,-1d);
    recordBuilder.set(GLNG,-1d);
  }
  recordBuilder.set(ISRT,tweet.isRetweet());
  return recordBuilder.build();
}
Program: 6965
Project: 6965
Buggy source:
public JmsPluginConfig(String destinationName,@Nullable Integer messagesToReceive,String initialContextFactory,String providerUrl,@Nullable String connectionFactoryName){
  this.destinationName=destinationName;
  if (messagesToReceive != null) {
    this.messagesToReceive=messagesToReceive;
  }
 else {
    this.messagesToReceive=50;
  }
  this.initialContextFactory=initialContextFactory;
  this.providerUrl=providerUrl;
  if (connectionFactoryName != null) {
    this.connectionFactoryName=connectionFactoryName;
  }
 else {
    this.connectionFactoryName=DEFAULT_CONNECTION_FACTORY;
  }
}

Fixed version (ground truth):
public JmsPluginConfig(String destinationName,String initialContextFactory,String providerUrl,@Nullable Integer messagesToReceive,@Nullable String connectionFactoryName,@Nullable String jmsPluginName,@Nullable String jmsPluginType){
  this.destinationName=destinationName;
  if (messagesToReceive != null) {
    this.messagesToReceive=messagesToReceive;
  }
 else {
    this.messagesToReceive=50;
  }
  this.initialContextFactory=initialContextFactory;
  this.providerUrl=providerUrl;
  if (connectionFactoryName != null) {
    this.connectionFactoryName=connectionFactoryName;
  }
 else {
    this.connectionFactoryName=DEFAULT_CONNECTION_FACTORY;
  }
  this.jmsPluginName=jmsPluginName;
  if (this.jmsPluginName == null) {
    this.jmsPluginName=Context.INITIAL_CONTEXT_FACTORY;
  }
  this.jmsPluginType=jmsPluginType;
  if (this.jmsPluginType == null) {
    this.jmsPluginType=JMS_PROVIDER;
  }
}
Program: 6966
Project: 6966
Buggy source:
@Override public void configurePipeline(PipelineConfigurer pipelineConfigurer){
  Class<Object> driver=pipelineConfigurer.usePluginClass("String_Node_Str",Context.INITIAL_CONTEXT_FACTORY,"String_Node_Str",PluginProperties.builder().build());
  Preconditions.checkArgument(driver != null,"String_Node_Str");
}

Fixed version (ground truth):
@Override public void configurePipeline(PipelineConfigurer pipelineConfigurer){
  String pluginId=String.format("String_Node_Str","String_Node_Str",config.jmsPluginType,config.jmsPluginName);
  Class<Object> driver=pipelineConfigurer.usePluginClass(config.jmsPluginType,config.jmsPluginName,pluginId,PluginProperties.builder().build());
  Preconditions.checkArgument(driver != null,"String_Node_Str");
}
Program: 6967
Project: 6967
Buggy source:
private void initializeJmsSource(String destination,int messageReceive,String initialContextFactory,String providerUrl){
  jmsSource=new JmsSource(new JmsPluginConfig(destination,messageReceive,initialContextFactory,providerUrl,JmsSource.DEFAULT_CONNECTION_FACTORY));
}

Fixed version (ground truth):
private void initializeJmsSource(String destination,int messageReceive,String initialContextFactory,String providerUrl){
  jmsSource=new JmsSource(new JmsPluginConfig(destination,initialContextFactory,providerUrl,messageReceive,JmsSource.DEFAULT_CONNECTION_FACTORY,null,null));
}
Program: 6968
Project: 6968
Buggy source:
@Override protected Enumeration<URL> findResources(String name) throws IOException {
  Set<URL> urls=Sets.newHashSet();
  for (  ClassLoader classLoader : delegates) {
    Iterators.addAll(urls,Iterators.forEnumeration(classLoader.getResources(name)));
  }
  return Iterators.asEnumeration(urls.iterator());
}

Fixed version (ground truth):
@Override protected Enumeration<URL> findResources(String name) throws IOException {
  Set<URL> urls=Sets.newLinkedHashSet();
  for (  ClassLoader classLoader : delegates) {
    Iterators.addAll(urls,Iterators.forEnumeration(classLoader.getResources(name)));
  }
  return Iterators.asEnumeration(urls.iterator());
}
Program: 6969
Project: 6969
Buggy source:
@Override public void apply(HBaseConsumerStateStore input) throws Exception {
  ImmutablePair<byte[],Map<byte[],byte[]>> result;
  while ((result=scanner.next()) != null) {
    byte[] rowKey=result.getFirst();
    Map<byte[],byte[]> columns=result.getSecond();
    visitRow(outStats,input.getTransaction(),rowKey,columns.get(stateColumnName),queueRowPrefix.length);
  }
}

Fixed version (ground truth):
@Override public void apply(HBaseConsumerStateStore input) throws Exception {
  ImmutablePair<byte[],Map<byte[],byte[]>> result;
  while ((result=scanner.next()) != null) {
    byte[] rowKey=result.getFirst();
    Map<byte[],byte[]> columns=result.getSecond();
    visitRow(outStats,input.getTransaction(),rowKey,columns.get(stateColumnName),queueRowPrefix.length);
    if (Boolean.parseBoolean(System.getProperty("String_Node_Str")) && outStats.getTotal() % rowsCache == 0) {
      System.out.printf("String_Node_Str",instanceId,outStats.getReport());
    }
  }
}
Program: 6970
Project: 6970
Buggy source:
public static void main(String[] args) throws Exception {
  if (args.length == 0) {
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str");
    System.exit(1);
  }
  final QueueName queueName=QueueName.from(URI.create(args[0]));
  Long consumerGroupId=null;
  if (args.length >= 2) {
    String consumerFlowlet=args[1];
    Id.Program flowId=Id.Program.from(queueName.getFirstComponent(),queueName.getSecondComponent(),ProgramType.FLOW,queueName.getThirdComponent());
    consumerGroupId=FlowUtils.generateConsumerGroupId(flowId,consumerFlowlet);
  }
  Injector injector=Guice.createInjector(new ConfigModule(),new ZKClientModule(),new TransactionClientModule(),new AbstractModule(){
    @Override protected void configure(){
      bind(QueueClientFactory.class).to(HBaseQueueClientFactory.class).in(Singleton.class);
      bind(QueueAdmin.class).to(HBaseQueueAdmin.class).in(Singleton.class);
      bind(HBaseTableUtil.class).toProvider(HBaseTableUtilFactory.class);
    }
  }
,new DiscoveryRuntimeModule().getDistributedModules(),new LocationRuntimeModule().getDistributedModules(),new DataSetsModules().getDistributedModules(),new TransactionModules().getDistributedModules());
  HBaseQueueDebugger debugger=injector.getInstance(HBaseQueueDebugger.class);
  debugger.startAndWait();
  debugger.scanQueue(queueName,consumerGroupId);
  debugger.stopAndWait();
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  if (args.length == 0) {
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str");
    System.out.println();
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str");
    System.exit(1);
  }
  final QueueName queueName=QueueName.from(URI.create(args[0]));
  Long consumerGroupId=null;
  if (args.length >= 2) {
    String consumerFlowlet=args[1];
    Id.Program flowId=Id.Program.from(queueName.getFirstComponent(),queueName.getSecondComponent(),ProgramType.FLOW,queueName.getThirdComponent());
    consumerGroupId=FlowUtils.generateConsumerGroupId(flowId,consumerFlowlet);
  }
  Injector injector=Guice.createInjector(new ConfigModule(),new ZKClientModule(),new TransactionClientModule(),new AbstractModule(){
    @Override protected void configure(){
      bind(QueueClientFactory.class).to(HBaseQueueClientFactory.class).in(Singleton.class);
      bind(QueueAdmin.class).to(HBaseQueueAdmin.class).in(Singleton.class);
      bind(HBaseTableUtil.class).toProvider(HBaseTableUtilFactory.class);
    }
  }
,new DiscoveryRuntimeModule().getDistributedModules(),new LocationRuntimeModule().getDistributedModules(),new DataSetsModules().getDistributedModules(),new TransactionModules().getDistributedModules());
  HBaseQueueDebugger debugger=injector.getInstance(HBaseQueueDebugger.class);
  debugger.startAndWait();
  debugger.scanQueue(queueName,consumerGroupId);
  debugger.stopAndWait();
}
Program: 6972
Project: 6972
Buggy source:
@Override public void run(){
  for (  ProgramType programType : ProgramType.values()) {
    programLifecycleService.validateAndCorrectRunningRunRecords(programType,store,runtimeService);
  }
}

Fixed version (ground truth):
@Override public void run(){
  for (  ProgramType programType : ProgramType.values()) {
    programLifecycleService.validateAndCorrectRunningRunRecords(programType);
  }
}
Program: 6973
Project: 6973
Buggy source:
public RunRecordsCorrectorRunnable(ProgramLifecycleService programLifecycleService,Store store,ProgramRuntimeService runtimeService){
  this.programLifecycleService=programLifecycleService;
  this.store=store;
  this.runtimeService=runtimeService;
}

Fixed version (ground truth):
public RunRecordsCorrectorRunnable(ProgramLifecycleService programLifecycleService){
  this.programLifecycleService=programLifecycleService;
}
Program: 6974
Project: 6974
Buggy source:
@Override protected void startUp() throws Exception {
  LOG.info("String_Node_Str");
  scheduledExecutorService.scheduleWithFixedDelay(new RunRecordsCorrectorRunnable(this,store,runtimeService),2L,600L,TimeUnit.SECONDS);
}

Fixed version (ground truth):
@Override protected void startUp() throws Exception {
  LOG.info("String_Node_Str");
  scheduledExecutorService.scheduleWithFixedDelay(new RunRecordsCorrectorRunnable(this),2L,600L,TimeUnit.SECONDS);
}
Program: 6976
Project: 6976
Buggy source:
@Override public boolean apply(RunRecord record){
  if (record.getTwillRunId() == null) {
    return false;
  }
  return twillRunIds.contains(record.getTwillRunId());
}

Fixed version (ground truth):
@Override public boolean apply(RunRecord record){
  return record.getTwillRunId() != null && twillRunIds.contains(org.apache.twill.internal.RunIds.fromString(record.getTwillRunId()));
}
Program: 6978
Project: 6978
Buggy source:
/** 
 * Using the given configuration, configure an Adapter with the given configuration. This method is called when an adapter is created in order to define what Datasets, Streams, and Plugins, and runtime arguments should be available to the adapter.
 * @param name name of the adapter
 * @param configuration adapter configuration. It will be {@code null} if there is no configuration provided.
 * @param configurer {@link AdapterConfigurer} used to configure the adapter.
 * @throws IllegalArgumentException if the configuration is not valid
 * @throws Exception if there was some other error configuring the adapter
 */
public void configureAdapter(String name,@Nullable T configuration,AdapterConfigurer configurer) throws Exception {
}

Fixed version (ground truth):
/** 
 * Called when an adapter is created in order to define what Datasets, Streams, Plugins, and runtime arguments should be available to the adapter, as determined by the given configuration.
 * @param name name of the adapter
 * @param configuration adapter configuration. It will be {@code null} if there is no configuration provided.
 * @param configurer {@link AdapterConfigurer} used to configure the adapter.
 * @throws IllegalArgumentException if the configuration is not valid
 * @throws Exception if there was some other error configuring the adapter
 */
public void configureAdapter(String name,@Nullable T configuration,AdapterConfigurer configurer) throws Exception {
}
Program: 6979
Project: 6979
Buggy source:
@Override public void run(){
  for (  ProgramType programType : ProgramType.values()) {
    programLifecycleService.validateAndCorrectRunningRunRecords(programType,store,runtimeService);
  }
}

Fixed version (ground truth):
@Override public void run(){
  for (  ProgramType programType : ProgramType.values()) {
    programLifecycleService.validateAndCorrectRunningRunRecords(programType);
  }
}
Program: 6980
Project: 6980
Buggy source:
public RunRecordsCorrectorRunnable(ProgramLifecycleService programLifecycleService,Store store,ProgramRuntimeService runtimeService){
  this.programLifecycleService=programLifecycleService;
  this.store=store;
  this.runtimeService=runtimeService;
}

Fixed version (ground truth):
public RunRecordsCorrectorRunnable(ProgramLifecycleService programLifecycleService){
  this.programLifecycleService=programLifecycleService;
}
Program: 6981
Project: 6981
Buggy source:
@Override protected void startUp() throws Exception {
  LOG.info("String_Node_Str");
  scheduledExecutorService.scheduleWithFixedDelay(new RunRecordsCorrectorRunnable(this,store,runtimeService),2L,600L,TimeUnit.SECONDS);
}

Fixed version (ground truth):
@Override protected void startUp() throws Exception {
  LOG.info("String_Node_Str");
  scheduledExecutorService.scheduleWithFixedDelay(new RunRecordsCorrectorRunnable(this),2L,600L,TimeUnit.SECONDS);
}
Program: 6983
Project: 6983
Buggy source:
public JmsPluginConfig(String destinationName,@Nullable Integer messagesToReceive,String initialContextFactory,String providerUrl,@Nullable String connectionFactoryName){
  this.destinationName=destinationName;
  if (messagesToReceive != null) {
    this.messagesToReceive=messagesToReceive;
  }
 else {
    this.messagesToReceive=50;
  }
  this.initialContextFactory=initialContextFactory;
  this.providerUrl=providerUrl;
  if (connectionFactoryName != null) {
    this.connectionFactoryName=connectionFactoryName;
  }
 else {
    this.connectionFactoryName=JMS_CONNECTION_FACTORY_NAME;
  }
}

Fixed version (ground truth):
public JmsPluginConfig(String destinationName,@Nullable Integer messagesToReceive,String initialContextFactory,String providerUrl,@Nullable String connectionFactoryName){
  this.destinationName=destinationName;
  if (messagesToReceive != null) {
    this.messagesToReceive=messagesToReceive;
  }
 else {
    this.messagesToReceive=50;
  }
  this.initialContextFactory=initialContextFactory;
  this.providerUrl=providerUrl;
  if (connectionFactoryName != null) {
    this.connectionFactoryName=connectionFactoryName;
  }
 else {
    this.connectionFactoryName=DEFAULT_CONNECTION_FACTORY;
  }
}
Program: 6984
Project: 6984
Buggy source:
private void initializeJmsSource(String destination,int messageReceive,String initialContextFactory,String providerUrl){
  jmsSource=new JmsSource(new JmsPluginConfig(destination,messageReceive,initialContextFactory,providerUrl,JmsSource.JMS_CONNECTION_FACTORY_NAME));
}

Fixed version (ground truth):
private void initializeJmsSource(String destination,int messageReceive,String initialContextFactory,String providerUrl){
  jmsSource=new JmsSource(new JmsPluginConfig(destination,messageReceive,initialContextFactory,providerUrl,JmsSource.DEFAULT_CONNECTION_FACTORY));
}
Program: 6985
Project: 6985
Buggy source:
/** 
 * Get an instance of the specified Dataset.
 * @param name The name of the Dataset
 * @param arguments the arguments for this dataset instance
 * @param < T > The type of the Dataset
 * @return A new instance of the specified Dataset, never null.
 * @throws DatasetInstantiationException If the Dataset cannot be instantiated: its classcannot be loaded; the default constructor throws an exception; or the Dataset cannot be opened (for example, one of the underlying tables in the DataFabric cannot be accessed).
 */
@Beta public <T extends Dataset>T getDataset(String name,Map<String,String> arguments) throws DatasetInstantiationException ;

Fixed version (ground truth):
/** 
 * Get an instance of the specified Dataset.
 * @param name The name of the Dataset
 * @param arguments the arguments for this dataset instance
 * @param < T > The type of the Dataset
 * @return A new instance of the specified Dataset, never null.
 * @throws DatasetInstantiationException If the Dataset cannot be instantiated: its classcannot be loaded; the default constructor throws an exception; or the Dataset cannot be opened (for example, one of the underlying tables in the DataFabric cannot be accessed).
 */
@Beta <T extends Dataset>T getDataset(String name,Map<String,String> arguments) throws DatasetInstantiationException ;
Program: 6986
Project: 6986
Buggy source:
/** 
 * Writes the record into a dataset.
 * @param record record to write into the dataset.
 * @throws IOException when the {@code RECORD} could not be written to the dataset.
 */
public void write(RECORD record) throws IOException ;

Fixed version (ground truth):
/** 
 * Writes the record into a dataset.
 * @param record record to write into the dataset.
 * @throws IOException when the {@code RECORD} could not be written to the dataset.
 */
void write(RECORD record) throws IOException ;
Program: 6987
Project: 6987
Buggy source:
/** 
 * Writes in batch using   {@link StreamBatchWriter} to a stream
 * @param stream stream id
 * @param contentType content type
 * @return {@link StreamBatchWriter} provides a batch writer
 * @throws IOException if an error occurred during write
 */
public StreamBatchWriter createBatchWriter(String stream,String contentType) throws IOException ;

Fixed version (ground truth):
/** 
 * Writes in batch using   {@link StreamBatchWriter} to a stream
 * @param stream stream id
 * @param contentType content type
 * @return {@link StreamBatchWriter} provides a batch writer
 * @throws IOException if an error occurred during write
 */
StreamBatchWriter createBatchWriter(String stream,String contentType) throws IOException ;
Program: 6988
Project: 6988
Buggy source:
/** 
 * Writes a   {@link StreamEventData} to a stream
 * @param stream stream id
 * @param data {@link StreamEventData} data to be written
 * @throws IOException if an error occurred during write
 */
public void write(String stream,StreamEventData data) throws IOException ;

Fixed version (ground truth):
/** 
 * Writes a   {@link StreamEventData} to a stream
 * @param stream stream id
 * @param data {@link StreamEventData} data to be written
 * @throws IOException if an error occurred during write
 */
void write(String stream,StreamEventData data) throws IOException ;
Program: 6989
Project: 6989
Buggy source:
/** 
 * Writes a File to a stream in batch
 * @param stream stream id
 * @param file File
 * @param contentType content type
 * @throws IOException if an error occurred during write
 */
public void writeFile(String stream,File file,String contentType) throws IOException ;

Fixed version (ground truth):
/** 
 * Writes a File to a stream in batch
 * @param stream stream id
 * @param file File
 * @param contentType content type
 * @throws IOException if an error occurred during write
 */
void writeFile(String stream,File file,String contentType) throws IOException ;
Program: 6990
Project: 6990
Buggy source:
/** 
 * Return the partition associated with the given time, rounded to the minute; or null if no such partition exists.
 */
@Nullable public TimePartition getPartitionByTime(long time);

Fixed version (ground truth):
/** 
 * Return the partition associated with the given time, rounded to the minute; or null if no such partition exists.
 */
@Nullable TimePartition getPartitionByTime(long time);
Program: 6991
Project: 6991
Buggy source:
/** 
 * @return the relative path of the partition for a specific time, rounded to the minute.
 */
@Deprecated @Nullable public String getPartition(long time);

Fixed version (ground truth):
/** 
 * @return the relative path of the partition for a specific time, rounded to the minute.
 */
@Deprecated @Nullable String getPartition(long time);
Program: 6992
Project: 6992
Buggy source:
/** 
 * Return all partitions within the time range given by startTime (inclusive) and endTime (exclusive), both rounded to the full minute.
 */
public Set<TimePartition> getPartitionsByTime(long startTime,long endTime);

Fixed version (ground truth):
/** 
 * Return all partitions within the time range given by startTime (inclusive) and endTime (exclusive), both rounded to the full minute.
 */
Set<TimePartition> getPartitionsByTime(long startTime,long endTime);
Program: 6993
Project: 6993
Buggy source:
/** 
 * @return a mapping from the partition time to the relative path, of all partitions with a timethat is between startTime (inclusive) and endTime (exclusive), both rounded to the full minute.
 */
@Deprecated public Map<Long,String> getPartitions(long startTime,long endTime);

Fixed version (ground truth):
/** 
 * @return a mapping from the partition time to the relative path, of all partitions with a timethat is between startTime (inclusive) and endTime (exclusive), both rounded to the full minute.
 */
@Deprecated Map<Long,String> getPartitions(long startTime,long endTime);
Program: 6994
Project: 6994
Buggy source:
/** 
 * @return the relative paths of all partitions with a time that is between startTime (inclusive)and endTime (exclusive), both rounded to the full minute.
 */
@Deprecated public Collection<String> getPartitionPaths(long startTime,long endTime);

Fixed version (ground truth):
/** 
 * @return the relative paths of all partitions with a time that is between startTime (inclusive)and endTime (exclusive), both rounded to the full minute.
 */
@Deprecated Collection<String> getPartitionPaths(long startTime,long endTime);
Program: 6995
Project: 6995
Buggy source:
/** 
 * Return a partition output for a specific time, rounded to the minute, in preparation for creating a new partition. Obtain the location to write from the PartitionOutput, then call the   {@link PartitionOutput#addPartition}to add the partition to this dataset.
 */
public TimePartitionOutput getPartitionOutput(long time);

Fixed version (ground truth):
/** 
 * Return a partition output for a specific time, rounded to the minute, in preparation for creating a new partition. Obtain the location to write from the PartitionOutput, then call the   {@link PartitionOutput#addPartition}to add the partition to this dataset.
 */
TimePartitionOutput getPartitionOutput(long time);
Program: 6996
Project: 6996
Buggy source:
/** 
 * Add a partition for a given time, stored at a given path (relative to the file set's base path).
 */
public void addPartition(long time,String path);

Fixed version (ground truth):
/** 
 * Add a partition for a given time, stored at a given path (relative to the file set's base path).
 */
void addPartition(long time,String path);
Program: 6997
Project: 6997
Buggy source:
/** 
 * Remove a partition for a given time.
 */
public void dropPartition(long time);

Fixed version (ground truth):
/** 
 * Remove a partition for a given time.
 */
void dropPartition(long time);
Program: 6998
Project: 6998
Buggy source:
/** 
 * @return the underlying (embedded) file set.
 * @deprecated use {@link #getEmbeddedFileSet} instead.
 */
@Deprecated public FileSet getUnderlyingFileSet();

Fixed version (ground truth):
/** 
 * @return the underlying (embedded) file set.
 * @deprecated use {@link #getEmbeddedFileSet} instead.
 */
@Deprecated FileSet getUnderlyingFileSet();
Program: 6999
Project: 6999
Buggy source:
/** 
 * Returns the next row or   {@code null} if the scanner is exhausted.
 */
@Nullable public Row next();

Fixed version (ground truth):
/** 
 * Returns the next row or   {@code null} if the scanner is exhausted.
 */
@Nullable Row next();
Program: 7000
Project: 7000
Buggy source:
/** 
 * Closes the scanner and releases any resources.
 */
public void close();

Fixed version (ground truth):
/** 
 * Closes the scanner and releases any resources.
 */
void close();
Program: 7001
Project: 7001
Buggy source:
/** 
 * Returns value of the given argument key as a String[]
 * @param argsKey {@link String} which is the key for the argument
 * @return String[] containing all the arguments which is indexed by their position as they were supplied
 */
public String[] getRuntimeArguments(String argsKey);

Fixed version (ground truth):
/** 
 * Returns value of the given argument key as a String[]
 * @param argsKey {@link String} which is the key for the argument
 * @return String[] containing all the arguments which is indexed by their position as they were supplied
 */
String[] getRuntimeArguments(String argsKey);
Program: 7002
Project: 7002
Buggy source:
/** 
 * Returns a   {@link Serializable} {@link ServiceDiscoverer} for Service Discovery in Spark Program which can bepassed in Spark program's closures.
 * @return A {@link Serializable} {@link ServiceDiscoverer}
 */
public ServiceDiscoverer getServiceDiscoverer();

Fixed version (ground truth):
/** 
 * Returns a   {@link Serializable} {@link ServiceDiscoverer} for Service Discovery in Spark Program which can bepassed in Spark program's closures.
 * @return A {@link Serializable} {@link ServiceDiscoverer}
 */
ServiceDiscoverer getServiceDiscoverer();
Program: 7003
Project: 7003
Buggy source:
/** 
 * Returns a   {@link Serializable} {@link Metrics} which can be used to emit custom metrics from user's {@link Spark}program. This can also be passed in Spark program's closures and workers can emit their own metrics
 * @return {@link Serializable} {@link Metrics} for {@link Spark} programs
 */
public Metrics getMetrics();

Fixed version (ground truth):
/** 
 * Returns a   {@link Serializable} {@link Metrics} which can be used to emit custom metrics from user's {@link Spark}program. This can also be passed in Spark program's closures and workers can emit their own metrics
 * @return {@link Serializable} {@link Metrics} for {@link Spark} programs
 */
Metrics getMetrics();
Program: 7004
Project: 7004
Buggy source:
/** 
 * User Spark job which will be executed
 * @param context {@link SparkContext} for this job
 */
public void run(SparkContext context);

Fixed version (ground truth):
/** 
 * User Spark job which will be executed
 * @param context {@link SparkContext} for this job
 */
void run(SparkContext context);
Program: 7005
Project: 7005
Buggy source:
/** 
 * Get the Hadoop counters from the previous MapReduce program in the Workflow. The method returns null if the counters are not set.
 * @return the Hadoop MapReduce counters set by the previous MapReduce program
 */
@Nullable public Map<String,Map<String,Long>> getMapReduceCounters();

Fixed version (ground truth):
/** 
 * Get the Hadoop counters from the previous MapReduce program in the Workflow. The method returns null if the counters are not set.
 * @return the Hadoop MapReduce counters set by the previous MapReduce program
 */
@Nullable Map<String,Map<String,Long>> getMapReduceCounters();
Program: 7006
Project: 7006
Buggy source:
@Provides @Named(Constants.AppFabric.SERVER_ADDRESS) public final InetAddress providesHostname(CConfiguration cConf){
  return Networks.resolve(cConf.get(Constants.AppFabric.SERVER_ADDRESS),new InetSocketAddress("String_Node_Str",0).getAddress());
}

Fixed version (ground truth):
@Provides @Named(Constants.AppFabric.SERVER_ADDRESS) public InetAddress providesHostname(CConfiguration cConf){
  return Networks.resolve(cConf.get(Constants.AppFabric.SERVER_ADDRESS),new InetSocketAddress("String_Node_Str",0).getAddress());
}
Program: 7007
Project: 7007
Buggy source:
/** 
 * @param runId for which information will be returned.
 * @return a {@link MRJobInfo} containing information about a particular MapReduce program run.
 */
public MRJobInfo getMRJobInfo(Id.Run runId) throws Exception ;

Fixed version (ground truth):
/** 
 * @param runId for which information will be returned.
 * @return a {@link MRJobInfo} containing information about a particular MapReduce program run.
 */
MRJobInfo getMRJobInfo(Id.Run runId) throws Exception ;
Program: 7008
Project: 7008
Buggy source:
/** 
 * @return A version.
 */
public int get();

Fixed version (ground truth):
/** 
 * @return A version.
 */
int get();
Program: 7009
Project: 7009
Buggy source:
/** 
 * Report resource usage of a program.  Implementors will likely want to write usage to persistant storage.
 */
public void reportResources();

Fixed version (ground truth):
/** 
 * Report resource usage of a program.  Implementors will likely want to write usage to persistant storage.
 */
void reportResources();
Program: 7010
Project: 7010
Buggy source:
/** 
 * Lists all namespaces
 * @return a list of {@link NamespaceMeta} for all namespaces
 */
public List<NamespaceMeta> listNamespaces();

Fixed version (ground truth):
/** 
 * Lists all namespaces
 * @return a list of {@link NamespaceMeta} for all namespaces
 */
List<NamespaceMeta> listNamespaces();
Program: 7011
Project: 7011
Buggy source:
/** 
 * Creates a new namespace
 * @param metadata the {@link NamespaceMeta} for the new namespace to be created
 * @throws NamespaceAlreadyExistsException if the specified namespace already exists
 * @throws co.cask.cdap.common.exception.NamespaceCannotBeCreatedException if the creation operation was unsuccessful
 */
public void createNamespace(NamespaceMeta metadata) throws NamespaceAlreadyExistsException, NamespaceCannotBeCreatedException ;

Fixed version (ground truth):
/** 
 * Creates a new namespace
 * @param metadata the {@link NamespaceMeta} for the new namespace to be created
 * @throws NamespaceAlreadyExistsException if the specified namespace already exists
 * @throws co.cask.cdap.common.exception.NamespaceCannotBeCreatedException if the creation operation was unsuccessful
 */
void createNamespace(NamespaceMeta metadata) throws NamespaceAlreadyExistsException, NamespaceCannotBeCreatedException ;
Program: 7012
Project: 7012
Buggy source:
/** 
 * Deletes the specified namespace
 * @param namespaceId the {@link Id.Namespace} of the specified namespace
 * @throws NamespaceNotFoundException if the specified namespace does not exist
 * @throws NamespaceCannotBeDeletedException if the deletion operation was unsuccessful
 */
public void deleteNamespace(Id.Namespace namespaceId) throws NamespaceNotFoundException, NamespaceCannotBeDeletedException ;

Fixed version (ground truth):
/** 
 * Deletes the specified namespace
 * @param namespaceId the {@link Id.Namespace} of the specified namespace
 * @throws NamespaceNotFoundException if the specified namespace does not exist
 * @throws NamespaceCannotBeDeletedException if the deletion operation was unsuccessful
 */
void deleteNamespace(Id.Namespace namespaceId) throws NamespaceNotFoundException, NamespaceCannotBeDeletedException ;
Program: 7013
Project: 7013
Buggy source:
/** 
 * Deletes all datasets in the specified namespace
 * @param namespaceId the {@link Id.Namespace} of the specified namespace
 * @throws NotFoundException if the specified namespace does not exist
 * @throws NamespaceCannotBeDeletedException if the deletion operation was unsuccessful
 */
public void deleteDatasets(Id.Namespace namespaceId) throws NotFoundException, NamespaceCannotBeDeletedException ;

Fixed version (ground truth):
/** 
 * Deletes all datasets in the specified namespace
 * @param namespaceId the {@link Id.Namespace} of the specified namespace
 * @throws NotFoundException if the specified namespace does not exist
 * @throws NamespaceCannotBeDeletedException if the deletion operation was unsuccessful
 */
void deleteDatasets(Id.Namespace namespaceId) throws NotFoundException, NamespaceCannotBeDeletedException ;
Program: 7014
Project: 7014
Buggy source:
/** 
 * Gets details of a namespace
 * @param namespaceId the {@link Id.Namespace} of the requested namespace
 * @return the {@link NamespaceMeta} of the requested namespace
 * @throws NamespaceNotFoundException if the requested namespace is not found
 */
public NamespaceMeta getNamespace(Id.Namespace namespaceId) throws NamespaceNotFoundException ;

Fixed version (ground truth):
/** 
 * Gets details of a namespace
 * @param namespaceId the {@link Id.Namespace} of the requested namespace
 * @return the {@link NamespaceMeta} of the requested namespace
 * @throws NamespaceNotFoundException if the requested namespace is not found
 */
NamespaceMeta getNamespace(Id.Namespace namespaceId) throws NamespaceNotFoundException ;
Program: 7015
Project: 7015
Buggy source:
/** 
 * Update namespace properties for a given namespace.
 * @param namespaceId  the {@link Id.Namespace} of the namespace to be updated
 * @param namespaceMeta namespacemeta to update
 * @throws NotFoundException if the specified namespace is not found
 */
public void updateProperties(Id.Namespace namespaceId,NamespaceMeta namespaceMeta) throws NotFoundException ;

Fixed version (ground truth):
/** 
 * Update namespace properties for a given namespace.
 * @param namespaceId  the {@link Id.Namespace} of the namespace to be updated
 * @param namespaceMeta namespacemeta to update
 * @throws NotFoundException if the specified namespace is not found
 */
void updateProperties(Id.Namespace namespaceId,NamespaceMeta namespaceMeta) throws NotFoundException ;
Program: 7016
Project: 7016
Buggy source:
/** 
 * Checks if the specified namespace exists
 * @param namespaceId the {@link Id.Namespace} to check for existence
 * @return true, if the specifed namespace exists, false otherwise
 */
public boolean hasNamespace(Id.Namespace namespaceId);

Fixed version (ground truth):
/** 
 * Checks if the specified namespace exists
 * @param namespaceId the {@link Id.Namespace} to check for existence
 * @return true, if the specifed namespace exists, false otherwise
 */
boolean hasNamespace(Id.Namespace namespaceId);
Program: 7017
Project: 7017
Buggy source:
private final void lazyStart(Scheduler scheduler) throws SchedulerException {
  if (scheduler instanceof TimeScheduler) {
    try {
      timeScheduler.lazyStart();
    }
 catch (    Throwable t) {
      Throwables.propagateIfInstanceOf(t,SchedulerException.class);
      throw new SchedulerException(t);
    }
  }
 else   if (scheduler instanceof StreamSizeScheduler) {
    try {
      streamSizeScheduler.lazyStart();
    }
 catch (    Throwable t) {
      Throwables.propagateIfInstanceOf(t,SchedulerException.class);
      throw new SchedulerException(t);
    }
  }
}

Fixed version (ground truth):
private void lazyStart(Scheduler scheduler) throws SchedulerException {
  if (scheduler instanceof TimeScheduler) {
    try {
      timeScheduler.lazyStart();
    }
 catch (    Throwable t) {
      Throwables.propagateIfInstanceOf(t,SchedulerException.class);
      throw new SchedulerException(t);
    }
  }
 else   if (scheduler instanceof StreamSizeScheduler) {
    try {
      streamSizeScheduler.lazyStart();
    }
 catch (    Throwable t) {
      Throwables.propagateIfInstanceOf(t,SchedulerException.class);
      throw new SchedulerException(t);
    }
  }
}
Program: 7022
Project: 7022
Buggy source:
/** 
 * Start the given adapter. Creates a schedule for a workflow adapter and starts the worker for a worker adapter.
 * @param namespace the namespace the adapter is deployed in
 * @param adapterName the name of the adapter
 * @throws NotFoundException if the adapter could not be found
 * @throws InvalidAdapterOperationException if the adapter is already started
 * @throws SchedulerException if there was some error creating the schedule for the adapter
 * @throws IOException if there was some error starting worker adapter
 */
public synchronized void startAdapter(Id.Namespace namespace,String adapterName) throws NotFoundException, InvalidAdapterOperationException, SchedulerException, IOException {
  AdapterStatus adapterStatus=getAdapterStatus(namespace,adapterName);
  if (AdapterStatus.STARTED.equals(adapterStatus)) {
    throw new InvalidAdapterOperationException("String_Node_Str");
  }
  AdapterDefinition adapterSpec=getAdapter(namespace,adapterName);
  ProgramType programType=adapterSpec.getProgram().getType();
  if (programType == ProgramType.WORKFLOW) {
    startWorkflowAdapter(namespace,adapterSpec);
  }
 else   if (programType == ProgramType.WORKER) {
    startWorkerAdapter(namespace,adapterSpec);
  }
 else {
    LOG.warn("String_Node_Str",programType);
    throw new InvalidAdapterOperationException("String_Node_Str" + programType);
  }
  setAdapterStatus(namespace,adapterName,AdapterStatus.STARTED);
}

Fixed version (ground truth):
/** 
 * Start the given adapter. Creates a schedule for a workflow adapter and starts the worker for a worker adapter.
 * @param namespace the namespace the adapter is deployed in
 * @param adapterName the name of the adapter
 * @throws NotFoundException if the adapter could not be found
 * @throws InvalidAdapterOperationException if the adapter is already started
 * @throws SchedulerException if there was some error creating the schedule for the adapter
 * @throws IOException if there was some error starting worker adapter
 */
public synchronized void startAdapter(Id.Namespace namespace,String adapterName) throws NotFoundException, InvalidAdapterOperationException, SchedulerException, IOException {
  AdapterStatus adapterStatus=getAdapterStatus(namespace,adapterName);
  AdapterDefinition adapterSpec=getAdapter(namespace,adapterName);
  ProgramType programType=adapterSpec.getProgram().getType();
  if (AdapterStatus.STARTED.equals(adapterStatus)) {
    Id.Program program=getProgramId(namespace,adapterName);
    ProgramRuntimeService.RuntimeInfo runtimeInfo=lifecycleService.findRuntimeInfo(program,programType);
    if (runtimeInfo != null) {
      throw new InvalidAdapterOperationException("String_Node_Str");
    }
  }
  if (programType == ProgramType.WORKFLOW) {
    startWorkflowAdapter(namespace,adapterSpec);
  }
 else   if (programType == ProgramType.WORKER) {
    startWorkerAdapter(namespace,adapterSpec);
  }
 else {
    LOG.warn("String_Node_Str",programType);
    throw new InvalidAdapterOperationException("String_Node_Str" + programType);
  }
  setAdapterStatus(namespace,adapterName,AdapterStatus.STARTED);
}
Program: 7024
Project: 7024
Buggy source:
/** 
 * Construct the AppFabricServer with service factory and configuration coming from guice injection.
 */
@Inject public AppFabricServer(CConfiguration configuration,DiscoveryService discoveryService,SchedulerService schedulerService,NotificationService notificationService,@Named(Constants.AppFabric.SERVER_ADDRESS) InetAddress hostname,@Named(Constants.AppFabric.HANDLERS_BINDING) Set<HttpHandler> handlers,@Nullable MetricsCollectionService metricsCollectionService,ProgramRuntimeService programRuntimeService,AdapterService adapterService,ApplicationLifecycleService applicationLifecycleService,StreamCoordinatorClient streamCoordinatorClient,@Named("String_Node_Str") Set<String> servicesNames,@Named("String_Node_Str") Set<String> handlerHookNames,NamespaceAdmin namespaceAdmin){
  this.hostname=hostname;
  this.discoveryService=discoveryService;
  this.schedulerService=schedulerService;
  this.handlers=handlers;
  this.configuration=configuration;
  this.metricsCollectionService=metricsCollectionService;
  this.programRuntimeService=programRuntimeService;
  this.adapterService=adapterService;
  this.notificationService=notificationService;
  this.servicesNames=servicesNames;
  this.handlerHookNames=handlerHookNames;
  this.namespaceAdmin=namespaceAdmin;
  this.applicationLifecycleService=applicationLifecycleService;
  this.streamCoordinatorClient=streamCoordinatorClient;
}

Fixed version (ground truth):
/** 
 * Construct the AppFabricServer with service factory and configuration coming from guice injection.
 */
@Inject public AppFabricServer(CConfiguration configuration,DiscoveryService discoveryService,SchedulerService schedulerService,NotificationService notificationService,@Named(Constants.AppFabric.SERVER_ADDRESS) InetAddress hostname,@Named(Constants.AppFabric.HANDLERS_BINDING) Set<HttpHandler> handlers,@Nullable MetricsCollectionService metricsCollectionService,ProgramRuntimeService programRuntimeService,AdapterService adapterService,ApplicationLifecycleService applicationLifecycleService,ProgramLifecycleService programLifecycleService,StreamCoordinatorClient streamCoordinatorClient,@Named("String_Node_Str") Set<String> servicesNames,@Named("String_Node_Str") Set<String> handlerHookNames,NamespaceAdmin namespaceAdmin){
  this.hostname=hostname;
  this.discoveryService=discoveryService;
  this.schedulerService=schedulerService;
  this.handlers=handlers;
  this.configuration=configuration;
  this.metricsCollectionService=metricsCollectionService;
  this.programRuntimeService=programRuntimeService;
  this.adapterService=adapterService;
  this.notificationService=notificationService;
  this.servicesNames=servicesNames;
  this.handlerHookNames=handlerHookNames;
  this.namespaceAdmin=namespaceAdmin;
  this.applicationLifecycleService=applicationLifecycleService;
  this.streamCoordinatorClient=streamCoordinatorClient;
  this.programLifecycleService=programLifecycleService;
}
Program: 7025
Project: 7025
Buggy source:
@Override protected void shutDown() throws Exception {
  httpService.stopAndWait();
  programRuntimeService.stopAndWait();
  schedulerService.stopAndWait();
  applicationLifecycleService.stopAndWait();
  adapterService.stopAndWait();
  notificationService.stopAndWait();
}

Fixed version (ground truth):
@Override protected void shutDown() throws Exception {
  httpService.stopAndWait();
  programRuntimeService.stopAndWait();
  schedulerService.stopAndWait();
  applicationLifecycleService.stopAndWait();
  adapterService.stopAndWait();
  notificationService.stopAndWait();
  programLifecycleService.stopAndWait();
}
Program: 7026
Project: 7026
Buggy source:
@Override protected void shutDown() throws Exception {
  LOG.info("String_Node_Str");
}

Fixed version (ground truth):
@Override protected void shutDown() throws Exception {
  LOG.info("String_Node_Str");
  scheduledExecutorService.shutdown();
  try {
    if (!scheduledExecutorService.awaitTermination(5,TimeUnit.SECONDS)) {
      scheduledExecutorService.shutdownNow();
    }
  }
 catch (  InterruptedException ie) {
    Thread.currentThread().interrupt();
  }
}
Program: 7027
Project: 7027
Buggy source:
@Override protected void startUp() throws Exception {
  LOG.info("String_Node_Str");
}

Fixed version (ground truth):
@Override protected void startUp() throws Exception {
  LOG.info("String_Node_Str");
  scheduledExecutorService.scheduleWithFixedDelay(new RunRecordsCorrectorRunnable(this,store,runtimeService),2L,600L,TimeUnit.SECONDS);
}
Program: 7028
Project: 7028
Buggy source:
@Inject public ProgramLifecycleService(Store store,ProgramRuntimeService runtimeService){
  this.store=store;
  this.runtimeService=runtimeService;
}

Fixed version (ground truth):
@Inject public ProgramLifecycleService(Store store,ProgramRuntimeService runtimeService){
  this.store=store;
  this.runtimeService=runtimeService;
  this.scheduledExecutorService=Executors.newScheduledThreadPool(1);
}