nus-yam/ex-repair huggingface dataset:
Program: 5151
Project: 5151
Buggy source:
@Override public final void initialize(TwillContext context){
  super.initialize(context);
  name=context.getSpecification().getName();
  LOG.info("String_Node_Str",name);
  Map<String,String> configs=context.getSpecification().getConfigs();
  try {
    hConf=new Configuration();
    hConf.clear();
    hConf.addResource(new File(configs.get("String_Node_Str")).toURI().toURL());
    UserGroupInformation.setConfiguration(hConf);
    cConf=CConfiguration.create(new File(configs.get("String_Node_Str")));
    LOG.debug("String_Node_Str",name,cConf);
    LOG.debug("String_Node_Str",name,hConf);
    Injector injector=doInit(context);
    services=Lists.newArrayList();
    services.add(injector.getInstance(ZKClientService.class));
    services.add(injector.getInstance(KafkaClientService.class));
    services.add(injector.getInstance(BrokerService.class));
    services.add(injector.getInstance(MetricsCollectionService.class));
    addServices(services);
    Preconditions.checkArgument(!services.isEmpty(),"String_Node_Str");
    LOG.info("String_Node_Str",name);
  }
 catch (  Throwable t) {
    throw Throwables.propagate(t);
  }
}

Fixed version (ground truth):
@Override public final void initialize(TwillContext context){
  Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler());
  super.initialize(context);
  name=context.getSpecification().getName();
  LOG.info("String_Node_Str",name);
  Map<String,String> configs=context.getSpecification().getConfigs();
  try {
    hConf=new Configuration();
    hConf.clear();
    hConf.addResource(new File(configs.get("String_Node_Str")).toURI().toURL());
    UserGroupInformation.setConfiguration(hConf);
    cConf=CConfiguration.create(new File(configs.get("String_Node_Str")));
    LOG.debug("String_Node_Str",name,cConf);
    LOG.debug("String_Node_Str",name,hConf);
    Injector injector=doInit(context);
    services=Lists.newArrayList();
    services.add(injector.getInstance(ZKClientService.class));
    services.add(injector.getInstance(KafkaClientService.class));
    services.add(injector.getInstance(BrokerService.class));
    services.add(injector.getInstance(MetricsCollectionService.class));
    addServices(services);
    Preconditions.checkArgument(!services.isEmpty(),"String_Node_Str");
    LOG.info("String_Node_Str",name);
  }
 catch (  Throwable t) {
    throw Throwables.propagate(t);
  }
}
Program: 5152
Project: 5152
Buggy source:
@Override protected void startUp() throws Exception {
  executorServer.startAndWait();
}

Fixed version (ground truth):
@Override protected void startUp() throws Exception {
  executorServer.startAndWait();
  LOG.debug("String_Node_Str");
}
Program: 5153
Project: 5153
Buggy source:
@Override protected void shutDown() throws Exception {
  executorServer.stopAndWait();
}

Fixed version (ground truth):
@Override protected void shutDown() throws Exception {
  executorServer.stopAndWait();
  LOG.debug("String_Node_Str");
}
Program: 5154
Project: 5154
Buggy source:
@Override public void execute(Runnable runnable){
  Thread t=new Thread(runnable,String.format("String_Node_Str",id.incrementAndGet()));
  t.setUncaughtExceptionHandler(h);
  t.start();
}

Fixed version (ground truth):
@Override public void execute(Runnable runnable){
  Thread t=new Thread(runnable,String.format("String_Node_Str",id.incrementAndGet()));
  t.start();
}
Program: 5155
Project: 5155
Buggy source:
/** 
 * @noinspection NullableProblems 
 */
@Override protected Executor executor(final State state){
  final AtomicInteger id=new AtomicInteger();
  final Thread.UncaughtExceptionHandler h=new Thread.UncaughtExceptionHandler(){
    @Override public void uncaughtException(    Thread t,    Throwable e){
    }
  }
;
  return new Executor(){
    @Override public void execute(    Runnable runnable){
      Thread t=new Thread(runnable,String.format("String_Node_Str",id.incrementAndGet()));
      t.setUncaughtExceptionHandler(h);
      t.start();
    }
  }
;
}

Fixed version (ground truth):
/** 
 * @noinspection NullableProblems 
 */
@Override protected Executor executor(final State state){
  final AtomicInteger id=new AtomicInteger();
  return new Executor(){
    @Override public void execute(    Runnable runnable){
      Thread t=new Thread(runnable,String.format("String_Node_Str",id.incrementAndGet()));
      t.start();
    }
  }
;
}
Program: 5156
Project: 5156
Buggy source:
@Override protected Executor executor(State state){
  final AtomicInteger id=new AtomicInteger();
  final Thread.UncaughtExceptionHandler h=new Thread.UncaughtExceptionHandler(){
    @Override public void uncaughtException(    Thread t,    Throwable e){
    }
  }
;
  return new Executor(){
    @Override public void execute(    Runnable runnable){
      Thread t=new Thread(runnable,String.format("String_Node_Str",id.incrementAndGet()));
      t.setUncaughtExceptionHandler(h);
      t.start();
    }
  }
;
}

Fixed version (ground truth):
@Override protected Executor executor(State state){
  final AtomicInteger id=new AtomicInteger();
  return new Executor(){
    @Override public void execute(    Runnable runnable){
      Thread t=new Thread(runnable,String.format("String_Node_Str",id.incrementAndGet()));
      t.start();
    }
  }
;
}
Program: 5157
Project: 5157
Buggy source:
@Override public void execute(Runnable runnable){
  Thread t=new Thread(runnable,String.format("String_Node_Str",id.incrementAndGet()));
  t.setUncaughtExceptionHandler(h);
  t.start();
}

Fixed version (ground truth):
@Override public void execute(Runnable runnable){
  Thread t=new Thread(runnable,String.format("String_Node_Str",id.incrementAndGet()));
  t.start();
}
Program: 5159
Project: 5159
Buggy source:
public void testMacroEvaluationActionPipeline(Engine engine) throws Exception {
  ETLStage action1=new ETLStage("String_Node_Str",MockAction.getPlugin("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  ETLStage action2=new ETLStage("String_Node_Str",MockAction.getPlugin("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  ETLBatchConfig etlConfig=co.cask.cdap.etl.proto.v2.ETLBatchConfig.builder("String_Node_Str").addStage(action1).addStage(action2).addConnection(new Connection(action1.getName(),action2.getName())).setEngine(engine).build();
  Map<String,String> runtimeArguments=ImmutableMap.of("String_Node_Str","String_Node_Str");
  AppRequest<co.cask.cdap.etl.proto.v2.ETLBatchConfig> appRequest=new AppRequest<>(APP_ARTIFACT,etlConfig);
  ApplicationId appId=NamespaceId.DEFAULT.app("String_Node_Str" + engine);
  ApplicationManager appManager=deployApplication(appId,appRequest);
  WorkflowManager manager=appManager.getWorkflowManager(SmartWorkflow.NAME);
  manager.setRuntimeArgs(runtimeArguments);
  manager.start(ImmutableMap.of("String_Node_Str","String_Node_Str"));
  manager.waitForRun(ProgramRunStatus.COMPLETED,3,TimeUnit.MINUTES);
  DataSetManager<Table> actionTableDS=getDataset("String_Node_Str");
  Assert.assertEquals("String_Node_Str",MockAction.readOutput(actionTableDS,"String_Node_Str","String_Node_Str"));
  appManager.getHistory(appId.workflow(SmartWorkflow.NAME).toId(),ProgramRunStatus.FAILED);
}

Fixed version (ground truth):
public void testMacroEvaluationActionPipeline(Engine engine) throws Exception {
  ETLStage action1=new ETLStage("String_Node_Str",MockAction.getPlugin("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  ETLBatchConfig etlConfig=co.cask.cdap.etl.proto.v2.ETLBatchConfig.builder("String_Node_Str").addStage(action1).setEngine(engine).build();
  Map<String,String> runtimeArguments=ImmutableMap.of("String_Node_Str","String_Node_Str");
  AppRequest<co.cask.cdap.etl.proto.v2.ETLBatchConfig> appRequest=new AppRequest<>(APP_ARTIFACT,etlConfig);
  ApplicationId appId=NamespaceId.DEFAULT.app("String_Node_Str" + engine);
  ApplicationManager appManager=deployApplication(appId,appRequest);
  WorkflowManager manager=appManager.getWorkflowManager(SmartWorkflow.NAME);
  manager.setRuntimeArgs(runtimeArguments);
  manager.start(ImmutableMap.of("String_Node_Str","String_Node_Str"));
  manager.waitForRun(ProgramRunStatus.COMPLETED,3,TimeUnit.MINUTES);
  DataSetManager<Table> actionTableDS=getDataset("String_Node_Str");
  Assert.assertEquals("String_Node_Str",MockAction.readOutput(actionTableDS,"String_Node_Str","String_Node_Str"));
  appManager.getHistory(appId.workflow(SmartWorkflow.NAME).toId(),ProgramRunStatus.FAILED);
}
Program: 5164
Project: 5164
Buggy source:
/** 
 * Adds a schedule for a particular program. If the schedule with the name already exists, the method will throw RuntimeException.
 * @param program defines program to which a schedule is being added
 * @param scheduleSpecification defines the schedule to be added for the program
 */
void addSchedule(ProgramId program,ScheduleSpecification scheduleSpecification);

Fixed version (ground truth):
/** 
 * Adds a schedule for a particular program. If the schedule with the name already exists, the method will throw AlreadyExistsException unless overwrite is true. If overwrite is true then the existing schedule is updated.
 * @param program defines program to which a schedule is being added
 * @param scheduleSpecification defines the schedule to be added for the program
 * @param allowOverwrite whether to overwrite an existing schedule
 * @throws AlreadyExistsException when schedule already exists and overwrite is false
 */
void addSchedule(ProgramId program,ScheduleSpecification scheduleSpecification,boolean allowOverwrite) throws AlreadyExistsException ;
Program: 5165
Project: 5165
Buggy source:
/** 
 * Creates a temporary directory through the   {@link LocationFactory} provided to this class.
 */
private Location createTempLocationDirectory() throws IOException {
  ProgramId programId=context.getProgram().getId();
  String tempLocationName=String.format("String_Node_Str",cConf.get(Constants.AppFabric.TEMP_DIR),programId.getType().name().toLowerCase(),programId.getNamespaceId().getEntityName(),programId.getApplication(),programId.getProgram(),context.getRunId().getId());
  Location location=locationFactory.get(programId.getNamespaceId()).append(tempLocationName);
  location.mkdirs();
  return location;
}

Fixed version (ground truth):
/** 
 * Creates a temporary directory through the   {@link LocationFactory} provided to this class.
 */
private Location createTempLocationDirectory() throws IOException {
  ProgramId programId=context.getProgram().getId();
  String tempLocationName=String.format("String_Node_Str",cConf.get(Constants.AppFabric.TEMP_DIR),programId.getType().name().toLowerCase(),programId.getNamespace(),programId.getApplication(),programId.getProgram(),context.getRunId().getId());
  Location location=locationFactory.get(programId.getNamespaceId()).append(tempLocationName);
  location.mkdirs();
  return location;
}
Program: 5166
Project: 5166
Buggy source:
/** 
 * Creates a temporary directory through the   {@link LocationFactory} provided to this class.
 */
private Location createTempLocationDirectory() throws IOException {
  ProgramId programId=context.getProgram().getId();
  String tempLocationName=String.format("String_Node_Str",cConf.get(Constants.AppFabric.TEMP_DIR),programId.getType().name().toLowerCase(),programId.getNamespaceId(),programId.getApplication(),programId.getProgram(),context.getRunId().getId());
  Location location=locationFactory.get(programId.getNamespaceId()).append(tempLocationName);
  location.mkdirs();
  return location;
}

Fixed version (ground truth):
/** 
 * Creates a temporary directory through the   {@link LocationFactory} provided to this class.
 */
private Location createTempLocationDirectory() throws IOException {
  ProgramId programId=context.getProgram().getId();
  String tempLocationName=String.format("String_Node_Str",cConf.get(Constants.AppFabric.TEMP_DIR),programId.getType().name().toLowerCase(),programId.getNamespaceId().getEntityName(),programId.getApplication(),programId.getProgram(),context.getRunId().getId());
  Location location=locationFactory.get(programId.getNamespaceId()).append(tempLocationName);
  location.mkdirs();
  return location;
}
Program: 5168
Project: 5168
Buggy source:
/** 
 * Get detail about the specified application
 * @param appId the id of the application to get
 * @return detail about the specified application
 * @throws ApplicationNotFoundException if the specified application does not exist
 */
public ApplicationDetail getAppDetail(ApplicationId appId) throws Exception {
  ApplicationSpecification appSpec=store.getApplication(appId);
  if (appSpec == null) {
    throw new ApplicationNotFoundException(appId);
  }
  ensureAccess(appId);
  String ownerPrincipal=ownerAdmin.getImpersonationPrincipal(appId);
  return ApplicationDetail.fromSpec(appSpec,ownerPrincipal);
}

Fixed version (ground truth):
/** 
 * Get detail about the specified application
 * @param appId the id of the application to get
 * @return detail about the specified application
 * @throws ApplicationNotFoundException if the specified application does not exist
 */
public ApplicationDetail getAppDetail(ApplicationId appId) throws Exception {
  ApplicationSpecification appSpec=store.getApplication(appId);
  if (appSpec == null) {
    throw new ApplicationNotFoundException(appId);
  }
  ensureAccess(appId);
  String ownerPrincipal=ownerAdmin.getOwnerPrincipal(appId);
  return ApplicationDetail.fromSpec(appSpec,ownerPrincipal);
}
Program: 5169
Project: 5169
Buggy source:
/** 
 * Read the dataset meta data (instance and type) from MDS.
 */
private DatasetMeta getFromMds(DatasetId instance) throws Exception {
  DatasetSpecification spec=instanceManager.get(instance);
  if (spec == null) {
    throw new NotFoundException(instance);
  }
  spec=DatasetsUtil.fixOriginalProperties(spec);
  DatasetTypeId datasetTypeId=instance.getParent().datasetType(spec.getType());
  DatasetTypeMeta typeMeta=getTypeInfo(instance.getParent(),spec.getType());
  if (typeMeta == null) {
    throw new NotFoundException(datasetTypeId);
  }
  String ownerPrincipal=null;
  if (!NamespaceId.SYSTEM.equals(instance.getNamespaceId())) {
    ownerPrincipal=ownerAdmin.getImpersonationPrincipal(instance);
  }
  return new DatasetMeta(spec,typeMeta,null,ownerPrincipal);
}

Fixed version (ground truth):
/** 
 * Read the dataset meta data (instance and type) from MDS.
 */
private DatasetMeta getFromMds(DatasetId instance) throws Exception {
  DatasetSpecification spec=instanceManager.get(instance);
  if (spec == null) {
    throw new NotFoundException(instance);
  }
  spec=DatasetsUtil.fixOriginalProperties(spec);
  DatasetTypeId datasetTypeId=instance.getParent().datasetType(spec.getType());
  DatasetTypeMeta typeMeta=getTypeInfo(instance.getParent(),spec.getType());
  if (typeMeta == null) {
    throw new NotFoundException(datasetTypeId);
  }
  String ownerPrincipal=null;
  if (!NamespaceId.SYSTEM.equals(instance.getNamespaceId())) {
    ownerPrincipal=ownerAdmin.getOwnerPrincipal(instance);
  }
  return new DatasetMeta(spec,typeMeta,null,ownerPrincipal);
}
Program: 5170
Project: 5170
Buggy source:
@Override public StreamProperties getProperties(StreamId streamId) throws Exception {
  ensureAccess(streamId);
  String ownerPrincipal=ownerAdmin.getImpersonationPrincipal(streamId);
  StreamConfig config=getConfig(streamId);
  StreamSpecification spec=streamMetaStore.getStream(streamId);
  return new StreamProperties(config.getTTL(),config.getFormat(),config.getNotificationThresholdMB(),spec.getDescription(),ownerPrincipal);
}

Fixed version (ground truth):
@Override public StreamProperties getProperties(StreamId streamId) throws Exception {
  ensureAccess(streamId);
  String ownerPrincipal=ownerAdmin.getOwnerPrincipal(streamId);
  StreamConfig config=getConfig(streamId);
  StreamSpecification spec=streamMetaStore.getStream(streamId);
  return new StreamProperties(config.getTTL(),config.getFormat(),config.getNotificationThresholdMB(),spec.getDescription(),ownerPrincipal);
}
Program: 5171
Project: 5171
Buggy source:
private void handleException(Exception ex){
  LOG.warn("String_Node_Str" + tableName.getNamespaceAsString() + "String_Node_Str"+ tableName.getNameAsString(),ex);
  if (ex instanceof IOException) {
    Thread.currentThread().interrupt();
  }
}

Fixed version (ground truth):
private void handleException(Exception ex){
  LOG.warn("String_Node_Str" + tableName.getNamespaceAsString() + "String_Node_Str"+ tableName.getNameAsString(),ex);
  if (ex instanceof InterruptedException) {
    Thread.currentThread().interrupt();
  }
}
Program: 5172
Project: 5172
Buggy source:
private void handleException(Exception ex){
  LOG.warn("String_Node_Str" + tableName.getNamespaceAsString() + "String_Node_Str"+ tableName.getNameAsString(),ex);
  if (ex instanceof IOException) {
    Thread.currentThread().interrupt();
  }
}

Fixed version (ground truth):
private void handleException(Exception ex){
  LOG.warn("String_Node_Str" + tableName.getNamespaceAsString() + "String_Node_Str"+ tableName.getNameAsString(),ex);
  if (ex instanceof InterruptedException) {
    Thread.currentThread().interrupt();
  }
}
Program: 5173
Project: 5173
Buggy source:
private void handleException(Exception ex){
  LOG.warn("String_Node_Str" + tableName.getNamespaceAsString() + "String_Node_Str"+ tableName.getNameAsString(),ex);
  if (ex instanceof IOException) {
    Thread.currentThread().interrupt();
  }
}

Fixed version (ground truth):
private void handleException(Exception ex){
  LOG.warn("String_Node_Str" + tableName.getNamespaceAsString() + "String_Node_Str"+ tableName.getNameAsString(),ex);
  if (ex instanceof InterruptedException) {
    Thread.currentThread().interrupt();
  }
}
Program: 5174
Project: 5174
Buggy source:
private void handleException(Exception ex){
  LOG.warn("String_Node_Str" + tableName.getNamespaceAsString() + "String_Node_Str"+ tableName.getNameAsString(),ex);
  if (ex instanceof IOException) {
    Thread.currentThread().interrupt();
  }
}

Fixed version (ground truth):
private void handleException(Exception ex){
  LOG.warn("String_Node_Str" + tableName.getNamespaceAsString() + "String_Node_Str"+ tableName.getNameAsString(),ex);
  if (ex instanceof InterruptedException) {
    Thread.currentThread().interrupt();
  }
}
Program: 5175
Project: 5175
Buggy source:
private void handleException(Exception ex){
  LOG.warn("String_Node_Str" + tableName.getNamespaceAsString() + "String_Node_Str"+ tableName.getNameAsString(),ex);
  if (ex instanceof IOException) {
    Thread.currentThread().interrupt();
  }
}

Fixed version (ground truth):
private void handleException(Exception ex){
  LOG.warn("String_Node_Str" + tableName.getNamespaceAsString() + "String_Node_Str"+ tableName.getNameAsString(),ex);
  if (ex instanceof InterruptedException) {
    Thread.currentThread().interrupt();
  }
}
Program: 5180
Project: 5180
Buggy source:
/** 
 * Return a list of RegionPruneInfo. These regions are the ones that have the lowest prune upper bounds. If -1 is passed in, all the regions and their prune upper bound will be returned.
 * @param numRegions number of regions
 * @return Map of region name and its prune upper bound
 */
public Queue<RegionPruneInfo> getIdleRegions(Integer numRegions) throws IOException {
  List<RegionPruneInfo> regionPruneInfos=dataJanitorState.getPruneInfoForRegions(null);
  if (regionPruneInfos.isEmpty()) {
    return new LinkedList<>();
  }
  if (numRegions < 0) {
    numRegions=regionPruneInfos.size();
  }
  Queue<RegionPruneInfo> lowestPrunes=MinMaxPriorityQueue.orderedBy(new Comparator<RegionPruneInfo>(){
    @Override public int compare(    RegionPruneInfo o1,    RegionPruneInfo o2){
      return (int)(o1.getPruneUpperBound() - o2.getPruneUpperBound());
    }
  }
).maximumSize(numRegions).create();
  for (  RegionPruneInfo pruneInfo : regionPruneInfos) {
    lowestPrunes.add(pruneInfo);
  }
  return lowestPrunes;
}

Fixed version (ground truth):
/** 
 * Return a list of RegionPruneInfo. These regions are the ones that have the lowest prune upper bounds. If -1 is passed in, all the regions and their prune upper bound will be returned. Note that only the regions that are known to be live will be returned.
 * @param numRegions number of regions
 * @return Map of region name and its prune upper bound
 */
public Queue<RegionPruneInfo> getIdleRegions(Integer numRegions) throws IOException {
  List<RegionPruneInfo> regionPruneInfos=dataJanitorState.getPruneInfoForRegions(null);
  if (regionPruneInfos.isEmpty()) {
    return new LinkedList<>();
  }
  Set<String> pruneRegionNameSet=new HashSet<>();
  for (  RegionPruneInfo regionPruneInfo : regionPruneInfos) {
    pruneRegionNameSet.add(regionPruneInfo.getRegionNameAsString());
  }
  Map<Long,SortedSet<String>> latestTimeRegion=getRegionsOnOrBeforeTime(System.currentTimeMillis());
  if (!latestTimeRegion.isEmpty()) {
    SortedSet<String> liveRegions=latestTimeRegion.values().iterator().next();
    Set<String> liveRegionsWithPruneInfo=Sets.intersection(liveRegions,pruneRegionNameSet);
    List<RegionPruneInfo> liveRegionWithPruneInfoList=new ArrayList<>();
    for (    RegionPruneInfo regionPruneInfo : regionPruneInfos) {
      if (liveRegionsWithPruneInfo.contains(regionPruneInfo.getRegionNameAsString())) {
        liveRegionWithPruneInfoList.add(regionPruneInfo);
      }
    }
    regionPruneInfos=liveRegionWithPruneInfoList;
  }
  if (numRegions < 0) {
    numRegions=regionPruneInfos.size();
  }
  Queue<RegionPruneInfo> lowestPrunes=MinMaxPriorityQueue.orderedBy(new Comparator<RegionPruneInfo>(){
    @Override public int compare(    RegionPruneInfo o1,    RegionPruneInfo o2){
      return (int)(o1.getPruneUpperBound() - o2.getPruneUpperBound());
    }
  }
).maximumSize(numRegions).create();
  for (  RegionPruneInfo pruneInfo : regionPruneInfos) {
    lowestPrunes.add(pruneInfo);
  }
  return lowestPrunes;
}
Program: 5181
Project: 5181
Buggy source:
/** 
 * Return a list of RegionPruneInfo. These regions are the ones that have the lowest prune upper bounds. If -1 is passed in, all the regions and their prune upper bound will be returned.
 * @param numRegions number of regions
 * @return Map of region name and its prune upper bound
 */
public Queue<RegionPruneInfo> getIdleRegions(Integer numRegions) throws IOException {
  List<RegionPruneInfo> regionPruneInfos=dataJanitorState.getPruneInfoForRegions(null);
  if (regionPruneInfos.isEmpty()) {
    return new LinkedList<>();
  }
  if (numRegions < 0) {
    numRegions=regionPruneInfos.size();
  }
  Queue<RegionPruneInfo> lowestPrunes=MinMaxPriorityQueue.orderedBy(new Comparator<RegionPruneInfo>(){
    @Override public int compare(    RegionPruneInfo o1,    RegionPruneInfo o2){
      return (int)(o1.getPruneUpperBound() - o2.getPruneUpperBound());
    }
  }
).maximumSize(numRegions).create();
  for (  RegionPruneInfo pruneInfo : regionPruneInfos) {
    lowestPrunes.add(pruneInfo);
  }
  return lowestPrunes;
}

Fixed version (ground truth):
/** 
 * Return a list of RegionPruneInfo. These regions are the ones that have the lowest prune upper bounds. If -1 is passed in, all the regions and their prune upper bound will be returned. Note that only the regions that are known to be live will be returned.
 * @param numRegions number of regions
 * @return Map of region name and its prune upper bound
 */
public Queue<RegionPruneInfo> getIdleRegions(Integer numRegions) throws IOException {
  List<RegionPruneInfo> regionPruneInfos=dataJanitorState.getPruneInfoForRegions(null);
  if (regionPruneInfos.isEmpty()) {
    return new LinkedList<>();
  }
  Set<String> pruneRegionNameSet=new HashSet<>();
  for (  RegionPruneInfo regionPruneInfo : regionPruneInfos) {
    pruneRegionNameSet.add(regionPruneInfo.getRegionNameAsString());
  }
  Map<Long,SortedSet<String>> latestTimeRegion=getRegionsOnOrBeforeTime(System.currentTimeMillis());
  if (!latestTimeRegion.isEmpty()) {
    SortedSet<String> liveRegions=latestTimeRegion.values().iterator().next();
    Set<String> liveRegionsWithPruneInfo=Sets.intersection(liveRegions,pruneRegionNameSet);
    List<RegionPruneInfo> liveRegionWithPruneInfoList=new ArrayList<>();
    for (    RegionPruneInfo regionPruneInfo : regionPruneInfos) {
      if (liveRegionsWithPruneInfo.contains(regionPruneInfo.getRegionNameAsString())) {
        liveRegionWithPruneInfoList.add(regionPruneInfo);
      }
    }
    regionPruneInfos=liveRegionWithPruneInfoList;
  }
  if (numRegions < 0) {
    numRegions=regionPruneInfos.size();
  }
  Queue<RegionPruneInfo> lowestPrunes=MinMaxPriorityQueue.orderedBy(new Comparator<RegionPruneInfo>(){
    @Override public int compare(    RegionPruneInfo o1,    RegionPruneInfo o2){
      return (int)(o1.getPruneUpperBound() - o2.getPruneUpperBound());
    }
  }
).maximumSize(numRegions).create();
  for (  RegionPruneInfo pruneInfo : regionPruneInfos) {
    lowestPrunes.add(pruneInfo);
  }
  return lowestPrunes;
}
Program: 5182
Project: 5182
Buggy source:
/** 
 * Return a list of RegionPruneInfo. These regions are the ones that have the lowest prune upper bounds. If -1 is passed in, all the regions and their prune upper bound will be returned.
 * @param numRegions number of regions
 * @return Map of region name and its prune upper bound
 */
public Queue<RegionPruneInfo> getIdleRegions(Integer numRegions) throws IOException {
  List<RegionPruneInfo> regionPruneInfos=dataJanitorState.getPruneInfoForRegions(null);
  if (regionPruneInfos.isEmpty()) {
    return new LinkedList<>();
  }
  if (numRegions < 0) {
    numRegions=regionPruneInfos.size();
  }
  Queue<RegionPruneInfo> lowestPrunes=MinMaxPriorityQueue.orderedBy(new Comparator<RegionPruneInfo>(){
    @Override public int compare(    RegionPruneInfo o1,    RegionPruneInfo o2){
      return (int)(o1.getPruneUpperBound() - o2.getPruneUpperBound());
    }
  }
).maximumSize(numRegions).create();
  for (  RegionPruneInfo pruneInfo : regionPruneInfos) {
    lowestPrunes.add(pruneInfo);
  }
  return lowestPrunes;
}

Fixed version (ground truth):
/** 
 * Return a list of RegionPruneInfo. These regions are the ones that have the lowest prune upper bounds. If -1 is passed in, all the regions and their prune upper bound will be returned. Note that only the regions that are known to be live will be returned.
 * @param numRegions number of regions
 * @return Map of region name and its prune upper bound
 */
public Queue<RegionPruneInfo> getIdleRegions(Integer numRegions) throws IOException {
  List<RegionPruneInfo> regionPruneInfos=dataJanitorState.getPruneInfoForRegions(null);
  if (regionPruneInfos.isEmpty()) {
    return new LinkedList<>();
  }
  Set<String> pruneRegionNameSet=new HashSet<>();
  for (  RegionPruneInfo regionPruneInfo : regionPruneInfos) {
    pruneRegionNameSet.add(regionPruneInfo.getRegionNameAsString());
  }
  Map<Long,SortedSet<String>> latestTimeRegion=getRegionsOnOrBeforeTime(System.currentTimeMillis());
  if (!latestTimeRegion.isEmpty()) {
    SortedSet<String> liveRegions=latestTimeRegion.values().iterator().next();
    Set<String> liveRegionsWithPruneInfo=Sets.intersection(liveRegions,pruneRegionNameSet);
    List<RegionPruneInfo> liveRegionWithPruneInfoList=new ArrayList<>();
    for (    RegionPruneInfo regionPruneInfo : regionPruneInfos) {
      if (liveRegionsWithPruneInfo.contains(regionPruneInfo.getRegionNameAsString())) {
        liveRegionWithPruneInfoList.add(regionPruneInfo);
      }
    }
    regionPruneInfos=liveRegionWithPruneInfoList;
  }
  if (numRegions < 0) {
    numRegions=regionPruneInfos.size();
  }
  Queue<RegionPruneInfo> lowestPrunes=MinMaxPriorityQueue.orderedBy(new Comparator<RegionPruneInfo>(){
    @Override public int compare(    RegionPruneInfo o1,    RegionPruneInfo o2){
      return (int)(o1.getPruneUpperBound() - o2.getPruneUpperBound());
    }
  }
).maximumSize(numRegions).create();
  for (  RegionPruneInfo pruneInfo : regionPruneInfos) {
    lowestPrunes.add(pruneInfo);
  }
  return lowestPrunes;
}
Program: 5183
Project: 5183
Buggy source:
@Override public void run(){
  LOG.info("String_Node_Str");
  try {
    new HBaseTableUtilFactory(cConf).get();
  }
 catch (  ProvisionException e) {
    throw new RuntimeException("String_Node_Str" + HBaseVersion.getVersionString());
  }
  LOG.info("String_Node_Str");
  LOG.info("String_Node_Str");
  try (HConnection hbaseConnection=HConnectionManager.createConnection(hConf)){
    hbaseConnection.listTables();
    LOG.info("String_Node_Str");
  }
 catch (  IOException e) {
    throw new RuntimeException("String_Node_Str" + "String_Node_Str" + "String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public void run(){
  LOG.info("String_Node_Str");
  HBaseTableUtil hBaseTableUtil;
  try {
    hBaseTableUtil=new HBaseTableUtilFactory(cConf).get();
  }
 catch (  ProvisionException e) {
    throw new RuntimeException("String_Node_Str" + HBaseVersion.getVersionString());
  }
  LOG.info("String_Node_Str");
  LOG.info("String_Node_Str");
  try (HConnection hbaseConnection=HConnectionManager.createConnection(hConf)){
    hbaseConnection.listTables();
    LOG.info("String_Node_Str");
  }
 catch (  IOException e) {
    throw new RuntimeException("String_Node_Str" + "String_Node_Str" + "String_Node_Str",e);
  }
  if (hConf.getBoolean("String_Node_Str",false)) {
    if (cConf.getBoolean(TxConstants.TransactionPruning.PRUNE_ENABLE)) {
      LOG.info("String_Node_Str");
      try {
        boolean isGlobalAdmin=hBaseTableUtil.isGlobalAdmin(hConf);
        LOG.info("String_Node_Str",isGlobalAdmin);
        if (isGlobalAdmin) {
          return;
        }
        if (cConf.getBoolean(Constants.Startup.TX_PRUNE_ACL_CHECK,false)) {
          LOG.info("String_Node_Str" + "String_Node_Str",Constants.Startup.TX_PRUNE_ACL_CHECK);
          return;
        }
        StringBuilder builder=new StringBuilder("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
        builder.append(Constants.Startup.TX_PRUNE_ACL_CHECK);
        builder.append("String_Node_Str");
        if (HBaseVersion.get().equals(HBaseVersion.Version.HBASE_96) || HBaseVersion.get().equals(HBaseVersion.Version.HBASE_98)) {
          builder.append("String_Node_Str");
          builder.append(HBaseVersion.get());
          builder.append("String_Node_Str");
          builder.append("String_Node_Str");
          builder.append(Constants.Startup.TX_PRUNE_ACL_CHECK);
        }
        throw new RuntimeException(builder.toString());
      }
 catch (      IOException e) {
        throw new RuntimeException("String_Node_Str");
      }
    }
  }
  LOG.info("String_Node_Str");
}
Program: 5185
Project: 5185
Buggy source:
/** 
 * Updates an existing application.
 */
@POST @Path("String_Node_Str") @AuditPolicy(AuditDetail.REQUEST_BODY) public void updateApp(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") final String namespaceId,@PathParam("String_Node_Str") final String appName) throws NotFoundException, BadRequestException, UnauthorizedException, IOException {
  ApplicationId appId=validateApplicationId(namespaceId,appName);
  AppRequest appRequest;
  try (Reader reader=new InputStreamReader(new ChannelBufferInputStream(request.getContent()),Charsets.UTF_8)){
    appRequest=GSON.fromJson(reader,AppRequest.class);
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str",appName,namespaceId,e);
    throw new IOException("String_Node_Str");
  }
catch (  JsonSyntaxException e) {
    throw new BadRequestException("String_Node_Str" + e.getMessage());
  }
  try {
    applicationLifecycleService.updateApp(appId,appRequest,createProgramTerminator());
    responder.sendString(HttpResponseStatus.OK,"String_Node_Str");
  }
 catch (  InvalidArtifactException e) {
    throw new BadRequestException(e.getMessage());
  }
catch (  NotFoundException|UnauthorizedException e) {
    throw e;
  }
catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    responder.sendString(HttpResponseStatus.BAD_REQUEST,e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Updates an existing application.
 */
@POST @Path("String_Node_Str") @AuditPolicy(AuditDetail.REQUEST_BODY) public void updateApp(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") final String namespaceId,@PathParam("String_Node_Str") final String appName) throws NotFoundException, BadRequestException, UnauthorizedException, IOException {
  ApplicationId appId=validateApplicationId(namespaceId,appName);
  AppRequest appRequest;
  try (Reader reader=new InputStreamReader(new ChannelBufferInputStream(request.getContent()),Charsets.UTF_8)){
    appRequest=GSON.fromJson(reader,AppRequest.class);
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str",appName,namespaceId,e);
    throw new IOException("String_Node_Str");
  }
catch (  JsonSyntaxException e) {
    throw new BadRequestException("String_Node_Str" + e.getMessage());
  }
  try {
    applicationLifecycleService.updateApp(appId,appRequest,createProgramTerminator());
    responder.sendString(HttpResponseStatus.OK,"String_Node_Str");
  }
 catch (  InvalidArtifactException e) {
    throw new BadRequestException(e.getMessage());
  }
catch (  ConflictException e) {
    responder.sendString(HttpResponseStatus.CONFLICT,e.getMessage());
  }
catch (  NotFoundException|UnauthorizedException e) {
    throw e;
  }
catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    responder.sendString(HttpResponseStatus.BAD_REQUEST,e.getMessage());
  }
}
Program: 5187
Project: 5187
Buggy source:
@Override protected void onFinish(HttpResponder responder,File uploadedFile){
  try {
    ApplicationWithPrograms app=applicationLifecycleService.deployAppAndArtifact(namespace,appId,artifactId,uploadedFile,configString,finalOwnerPrincipalId,createProgramTerminator());
    LOG.info("String_Node_Str" + "String_Node_Str",app.getApplicationId().getApplication(),namespace.getNamespace(),artifactId,configString,finalOwnerPrincipalId);
    responder.sendString(HttpResponseStatus.OK,String.format("String_Node_Str",app.getApplicationId().getApplication()));
  }
 catch (  InvalidArtifactException e) {
    responder.sendString(HttpResponseStatus.BAD_REQUEST,e.getMessage());
  }
catch (  ArtifactAlreadyExistsException e) {
    responder.sendString(HttpResponseStatus.CONFLICT,String.format("String_Node_Str" + "String_Node_Str",artifactId));
  }
catch (  WriteConflictException e) {
    LOG.warn("String_Node_Str",artifactId,e);
    responder.sendString(HttpResponseStatus.INTERNAL_SERVER_ERROR,"String_Node_Str" + "String_Node_Str");
  }
catch (  UnauthorizedException e) {
    responder.sendString(HttpResponseStatus.FORBIDDEN,e.getMessage());
  }
catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    responder.sendString(HttpResponseStatus.BAD_REQUEST,e.getMessage());
  }
}

Fixed version (ground truth):
@Override protected void onFinish(HttpResponder responder,File uploadedFile){
  try {
    ApplicationWithPrograms app=applicationLifecycleService.deployAppAndArtifact(namespace,appId,artifactId,uploadedFile,configString,finalOwnerPrincipalId,createProgramTerminator());
    LOG.info("String_Node_Str" + "String_Node_Str",app.getApplicationId().getApplication(),namespace.getNamespace(),artifactId,configString,finalOwnerPrincipalId);
    responder.sendString(HttpResponseStatus.OK,String.format("String_Node_Str",app.getApplicationId().getApplication()));
  }
 catch (  InvalidArtifactException e) {
    responder.sendString(HttpResponseStatus.BAD_REQUEST,e.getMessage());
  }
catch (  ArtifactAlreadyExistsException e) {
    responder.sendString(HttpResponseStatus.CONFLICT,String.format("String_Node_Str" + "String_Node_Str",artifactId));
  }
catch (  WriteConflictException e) {
    LOG.warn("String_Node_Str",artifactId,e);
    responder.sendString(HttpResponseStatus.INTERNAL_SERVER_ERROR,"String_Node_Str" + "String_Node_Str");
  }
catch (  UnauthorizedException e) {
    responder.sendString(HttpResponseStatus.FORBIDDEN,e.getMessage());
  }
catch (  ConflictException e) {
    responder.sendString(HttpResponseStatus.CONFLICT,e.getMessage());
  }
catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    responder.sendString(HttpResponseStatus.BAD_REQUEST,e.getMessage());
  }
}
Program: 5188
Project: 5188
Buggy source:
protected void verifyData(ApplicationId appId,ApplicationSpecification specification,@Nullable KerberosPrincipalId specifiedOwnerPrincipal) throws DatasetManagementException, ConflictException {
  VerifyResult result;
  for (  DatasetCreationSpec dataSetCreateSpec : specification.getDatasets().values()) {
    result=getVerifier(DatasetCreationSpec.class).verify(appId,dataSetCreateSpec);
    if (!result.isSuccess()) {
      throw new RuntimeException(result.getMessage());
    }
    String dsName=dataSetCreateSpec.getInstanceName();
    DatasetId datasetInstanceId=appId.getParent().dataset(dsName);
    DatasetSpecification existingSpec=dsFramework.getDatasetSpec(datasetInstanceId);
    if (existingSpec != null && !existingSpec.getType().equals(dataSetCreateSpec.getTypeName())) {
      throw new DataSetException(String.format("String_Node_Str",dsName,dataSetCreateSpec.getTypeName()));
    }
    if (existingSpec != null) {
      verifyOwner(datasetInstanceId,specifiedOwnerPrincipal);
    }
  }
  for (  StreamSpecification spec : specification.getStreams().values()) {
    result=getVerifier(StreamSpecification.class).verify(appId,spec);
    if (!result.isSuccess()) {
      throw new RuntimeException(result.getMessage());
    }
    if (store.getStream(appId.getNamespaceId(),spec.getName()) != null) {
      verifyOwner(appId.getParent().stream(spec.getName()),specifiedOwnerPrincipal);
    }
  }
}

Fixed version (ground truth):
protected void verifyData(ApplicationId appId,ApplicationSpecification specification,@Nullable KerberosPrincipalId specifiedOwnerPrincipal) throws DatasetManagementException, UnauthorizedException {
  VerifyResult result;
  for (  DatasetCreationSpec dataSetCreateSpec : specification.getDatasets().values()) {
    result=getVerifier(DatasetCreationSpec.class).verify(appId,dataSetCreateSpec);
    if (!result.isSuccess()) {
      throw new RuntimeException(result.getMessage());
    }
    String dsName=dataSetCreateSpec.getInstanceName();
    DatasetId datasetInstanceId=appId.getParent().dataset(dsName);
    DatasetSpecification existingSpec=dsFramework.getDatasetSpec(datasetInstanceId);
    if (existingSpec != null && !existingSpec.getType().equals(dataSetCreateSpec.getTypeName())) {
      throw new DataSetException(String.format("String_Node_Str",dsName,dataSetCreateSpec.getTypeName()));
    }
    if (existingSpec != null) {
      verifyOwner(datasetInstanceId,specifiedOwnerPrincipal);
    }
  }
  for (  StreamSpecification spec : specification.getStreams().values()) {
    result=getVerifier(StreamSpecification.class).verify(appId,spec);
    if (!result.isSuccess()) {
      throw new RuntimeException(result.getMessage());
    }
    if (store.getStream(appId.getNamespaceId(),spec.getName()) != null) {
      verifyOwner(appId.getParent().stream(spec.getName()),specifiedOwnerPrincipal);
    }
  }
}
Program: 5189
Project: 5189
Buggy source:
private void verifyOwner(NamespacedEntityId entityId,@Nullable KerberosPrincipalId specifiedOwnerPrincipal) throws DatasetManagementException, ConflictException {
  String ownerPrincipal;
  try {
    ownerPrincipal=ownerAdmin.getImpersonationPrincipal(entityId);
    if (!Objects.equals(ownerPrincipal,specifiedOwnerPrincipal == null ? null : specifiedOwnerPrincipal.getPrincipal())) {
      throw new ConflictException(String.format("String_Node_Str" + "String_Node_Str",entityId.getEntityType(),entityId.getEntityName(),Constants.Security.PRINCIPAL,specifiedOwnerPrincipal,Constants.Security.PRINCIPAL));
    }
  }
 catch (  IOException e) {
    throw new DatasetManagementException(e.getMessage(),e);
  }
}

Fixed version (ground truth):
private void verifyOwner(NamespacedEntityId entityId,@Nullable KerberosPrincipalId specifiedOwnerPrincipal) throws DatasetManagementException, UnauthorizedException {
  try {
    SecurityUtil.verifyOwnerPrincipal(entityId,specifiedOwnerPrincipal == null ? null : specifiedOwnerPrincipal.getPrincipal(),ownerAdmin);
  }
 catch (  IOException e) {
    throw new DatasetManagementException(e.getMessage(),e);
  }
}
Program: 5191
Project: 5191
Buggy source:
private ApplicationWithPrograms deployApp(NamespaceId namespaceId,@Nullable String appName,@Nullable String appVersion,@Nullable String configStr,ProgramTerminator programTerminator,ArtifactDetail artifactDetail,@Nullable KerberosPrincipalId ownerPrincipal) throws Exception {
  authorizationEnforcer.enforce(namespaceId,authenticationContext.getPrincipal(),Action.WRITE);
  ApplicationClass appClass=Iterables.getFirst(artifactDetail.getMeta().getClasses().getApps(),null);
  if (appClass == null) {
    throw new InvalidArtifactException(String.format("String_Node_Str",artifactDetail.getDescriptor().getArtifactId(),namespaceId));
  }
  AppDeploymentInfo deploymentInfo=new AppDeploymentInfo(artifactDetail.getDescriptor(),namespaceId,appClass.getClassName(),appName,appVersion,configStr,ownerPrincipal);
  Manager<AppDeploymentInfo,ApplicationWithPrograms> manager=managerFactory.create(programTerminator);
  ApplicationWithPrograms applicationWithPrograms=manager.deploy(deploymentInfo).get();
  privilegesManager.grant(applicationWithPrograms.getApplicationId(),authenticationContext.getPrincipal(),EnumSet.allOf(Action.class));
  return applicationWithPrograms;
}

Fixed version (ground truth):
private ApplicationWithPrograms deployApp(NamespaceId namespaceId,@Nullable String appName,@Nullable String appVersion,@Nullable String configStr,ProgramTerminator programTerminator,ArtifactDetail artifactDetail,@Nullable KerberosPrincipalId ownerPrincipal) throws Exception {
  authorizationEnforcer.enforce(namespaceId,authenticationContext.getPrincipal(),Action.WRITE);
  ApplicationClass appClass=Iterables.getFirst(artifactDetail.getMeta().getClasses().getApps(),null);
  if (appClass == null) {
    throw new InvalidArtifactException(String.format("String_Node_Str",artifactDetail.getDescriptor().getArtifactId(),namespaceId));
  }
  AppDeploymentInfo deploymentInfo=new AppDeploymentInfo(artifactDetail.getDescriptor(),namespaceId,appClass.getClassName(),appName,appVersion,configStr,ownerPrincipal);
  Manager<AppDeploymentInfo,ApplicationWithPrograms> manager=managerFactory.create(programTerminator);
  ApplicationWithPrograms applicationWithPrograms;
  try {
    applicationWithPrograms=manager.deploy(deploymentInfo).get();
  }
 catch (  ExecutionException e) {
    Throwables.propagateIfPossible(e.getCause(),Exception.class);
    throw Throwables.propagate(e.getCause());
  }
  privilegesManager.grant(applicationWithPrograms.getApplicationId(),authenticationContext.getPrincipal(),EnumSet.allOf(Action.class));
  return applicationWithPrograms;
}
Program: 5192
Project: 5192
Buggy source:
/** 
 * Some tests for owner information storage/propagation during app deployment. More tests at handler level   {@link co.cask.cdap.internal.app.services.http.handlers.AppLifecycleHttpHandlerTest}
 */
@Test public void testOwner() throws Exception {
  String ownerPrincipal="String_Node_Str";
  HttpResponse response=deploy(WordCountApp.class,Constants.Gateway.API_VERSION_3_TOKEN,TEST_NAMESPACE1,ownerPrincipal);
  Assert.assertEquals(HttpResponseStatus.OK.getCode(),response.getStatusLine().getStatusCode());
  response=deploy(WordCountApp.class,Constants.Gateway.API_VERSION_3_TOKEN,TEST_NAMESPACE1,"String_Node_Str");
  Assert.assertEquals(HttpResponseStatus.BAD_REQUEST.getCode(),response.getStatusLine().getStatusCode());
  response=deploy(WordCountApp.class,Constants.Gateway.API_VERSION_3_TOKEN,TEST_NAMESPACE1,ownerPrincipal);
  Assert.assertEquals(HttpResponseStatus.OK.getCode(),response.getStatusLine().getStatusCode());
}

Fixed version (ground truth):
/** 
 * Some tests for owner information storage/propagation during app deployment. More tests at handler level   {@link co.cask.cdap.internal.app.services.http.handlers.AppLifecycleHttpHandlerTest}
 */
@Test public void testOwner() throws Exception {
  String ownerPrincipal="String_Node_Str";
  HttpResponse response=deploy(WordCountApp.class,Constants.Gateway.API_VERSION_3_TOKEN,TEST_NAMESPACE1,ownerPrincipal);
  Assert.assertEquals(HttpResponseStatus.OK.getCode(),response.getStatusLine().getStatusCode());
  response=deploy(WordCountApp.class,Constants.Gateway.API_VERSION_3_TOKEN,TEST_NAMESPACE1,"String_Node_Str");
  Assert.assertEquals(HttpResponseStatus.FORBIDDEN.getCode(),response.getStatusLine().getStatusCode());
  response=deploy(WordCountApp.class,Constants.Gateway.API_VERSION_3_TOKEN,TEST_NAMESPACE1,ownerPrincipal);
  Assert.assertEquals(HttpResponseStatus.OK.getCode(),response.getStatusLine().getStatusCode());
}
Program: 5194
Project: 5194
Buggy source:
@Test public void testOwner() throws Exception {
  StreamAdmin streamAdmin=getStreamAdmin();
  OwnerAdmin ownerAdmin=getOwnerAdmin();
  grantAndAssertSuccess(FOO_NAMESPACE,USER,ImmutableSet.of(Action.WRITE));
  StreamId stream=FOO_NAMESPACE.stream("String_Node_Str");
  Properties properties=new Properties();
  String ownerPrincipal="String_Node_Str";
  properties.put(Constants.Security.PRINCIPAL,ownerPrincipal);
  streamAdmin.create(stream,properties);
  Assert.assertTrue(streamAdmin.exists(stream));
  Assert.assertTrue(ownerAdmin.exists(stream));
  Assert.assertEquals(ownerPrincipal,streamAdmin.getProperties(stream).getOwnerPrincipal());
  try {
    streamAdmin.updateConfig(stream,new StreamProperties(1L,null,null,null,"String_Node_Str"));
    Assert.fail();
  }
 catch (  ConflictException e) {
  }
  properties.put(Constants.Security.PRINCIPAL,"String_Node_Str");
  try {
    streamAdmin.create(stream,properties);
    Assert.fail("String_Node_Str");
  }
 catch (  ConflictException e) {
  }
  Assert.assertEquals(ownerPrincipal,streamAdmin.getProperties(stream).getOwnerPrincipal());
  streamAdmin.drop(stream);
  Assert.assertFalse(ownerAdmin.exists(stream));
}

Fixed version (ground truth):
@Test public void testOwner() throws Exception {
  StreamAdmin streamAdmin=getStreamAdmin();
  OwnerAdmin ownerAdmin=getOwnerAdmin();
  grantAndAssertSuccess(FOO_NAMESPACE,USER,ImmutableSet.of(Action.WRITE));
  StreamId stream=FOO_NAMESPACE.stream("String_Node_Str");
  Properties properties=new Properties();
  String ownerPrincipal="String_Node_Str";
  properties.put(Constants.Security.PRINCIPAL,ownerPrincipal);
  streamAdmin.create(stream,properties);
  Assert.assertTrue(streamAdmin.exists(stream));
  Assert.assertTrue(ownerAdmin.exists(stream));
  Assert.assertEquals(ownerPrincipal,streamAdmin.getProperties(stream).getOwnerPrincipal());
  try {
    streamAdmin.updateConfig(stream,new StreamProperties(1L,null,null,null,"String_Node_Str"));
    Assert.fail();
  }
 catch (  UnauthorizedException e) {
  }
  properties.put(Constants.Security.PRINCIPAL,"String_Node_Str");
  try {
    streamAdmin.create(stream,properties);
    Assert.fail("String_Node_Str");
  }
 catch (  UnauthorizedException e) {
  }
  Assert.assertEquals(ownerPrincipal,streamAdmin.getProperties(stream).getOwnerPrincipal());
  streamAdmin.drop(stream);
  Assert.assertFalse(ownerAdmin.exists(stream));
}
Program: 5196
Project: 5196
Buggy source:
public DefaultStreamingContext(StageInfo stageInfo,JavaSparkExecutionContext sec,JavaStreamingContext jsc){
  super(sec.getPluginContext(),sec.getMetrics(),stageInfo);
  this.sec=sec;
  this.jsc=jsc;
}

Fixed version (ground truth):
public DefaultStreamingContext(StageInfo stageInfo,JavaSparkExecutionContext sec,JavaStreamingContext jsc){
  super(sec.getPluginContext(),sec.getMetrics(),stageInfo);
  this.sec=sec;
  this.jsc=jsc;
  this.admin=sec.getAdmin();
}