nus-yam/ex-repair huggingface dataset:
Program: 5198
Project: 5198
Buggy source:
@Override protected void startUp() throws Exception {
  LoggingContextAccessor.setLoggingContext(context.getLoggingContext());
  Class<?> workerClass=program.getClassLoader().loadClass(spec.getClassName());
  @SuppressWarnings("String_Node_Str") TypeToken<Worker> workerType=(TypeToken<Worker>)TypeToken.of(workerClass);
  worker=new InstantiatorFactory(false).get(workerType).create();
  Reflections.visit(worker,workerType.getType(),new MetricsFieldSetter(context.getMetrics()),new PropertyFieldSetter(spec.getProperties()));
  LOG.debug("String_Node_Str",program.getId());
  TransactionControl txControl=Transactions.getTransactionControl(TransactionControl.EXPLICIT,Worker.class,worker,"String_Node_Str",WorkerContext.class);
  context.initializeProgram(worker,context,txControl,false);
}

Fixed version (ground truth):
@Override protected void startUp() throws Exception {
  LoggingContextAccessor.setLoggingContext(context.getLoggingContext());
  Class<?> workerClass=program.getClassLoader().loadClass(spec.getClassName());
  @SuppressWarnings("String_Node_Str") TypeToken<Worker> workerType=(TypeToken<Worker>)TypeToken.of(workerClass);
  worker=new InstantiatorFactory(false).get(workerType).create();
  Reflections.visit(worker,workerType.getType(),new MetricsFieldSetter(context.getMetrics()),new PropertyFieldSetter(spec.getProperties()));
  LOG.debug("String_Node_Str",program.getId());
  TransactionControl txControl=Transactions.getTransactionControl(TransactionControl.EXPLICIT,Worker.class,worker,"String_Node_Str",WorkerContext.class);
  try {
    context.initializeProgram(worker,context,txControl,false);
  }
 catch (  LinkageError e) {
    throw new Exception(e.getMessage(),e);
  }
}
Program: 5200
Project: 5200
Buggy source:
private void doGetLogs(HttpResponder responder,LoggingContext loggingContext,long fromTimeSecsParam,long toTimeSecsParam,boolean escape,String filterStr,@Nullable RunRecordMeta runRecord,String format,List<String> fieldsToSuppress){
  try {
    TimeRange timeRange=parseTime(fromTimeSecsParam,toTimeSecsParam,responder);
    if (timeRange == null) {
      return;
    }
    Filter filter=FilterParser.parse(filterStr);
    ReadRange readRange=new ReadRange(timeRange.getFromMillis(),timeRange.getToMillis(),LogOffset.INVALID_KAFKA_OFFSET);
    readRange=adjustReadRange(readRange,runRecord,fromTimeSecsParam != -1);
    try {
      CloseableIterator<LogEvent> logIter=logReader.getLog(loggingContext,readRange.getFromMillis(),readRange.getToMillis(),filter);
      AbstractChunkedLogProducer logsProducer=getFullLogsProducer(format,logIter,fieldsToSuppress,escape);
      responder.sendContent(HttpResponseStatus.OK,logsProducer,logsProducer.getResponseHeaders());
    }
 catch (    Exception ex) {
      LOG.debug("String_Node_Str",loggingContext,ex);
    }
  }
 catch (  SecurityException e) {
    responder.sendStatus(HttpResponseStatus.UNAUTHORIZED);
  }
catch (  IllegalArgumentException e) {
    responder.sendString(HttpResponseStatus.BAD_REQUEST,e.getMessage());
  }
}

Fixed version (ground truth):
private void doGetLogs(HttpResponder responder,LoggingContext loggingContext,long fromTimeSecsParam,long toTimeSecsParam,boolean escape,String filterStr,@Nullable RunRecordMeta runRecord,String format,List<String> fieldsToSuppress){
  try {
    TimeRange timeRange=parseTime(fromTimeSecsParam,toTimeSecsParam,responder);
    if (timeRange == null) {
      return;
    }
    Filter filter=FilterParser.parse(filterStr);
    ReadRange readRange=new ReadRange(timeRange.getFromMillis(),timeRange.getToMillis(),LogOffset.INVALID_KAFKA_OFFSET);
    readRange=adjustReadRange(readRange,runRecord,fromTimeSecsParam != -1);
    AbstractChunkedLogProducer logsProducer=null;
    try {
      CloseableIterator<LogEvent> logIter=logReader.getLog(loggingContext,readRange.getFromMillis(),readRange.getToMillis(),filter);
      logsProducer=getFullLogsProducer(format,logIter,fieldsToSuppress,escape);
    }
 catch (    Exception ex) {
      LOG.debug("String_Node_Str",loggingContext,ex);
      if (logsProducer != null) {
        logsProducer.close();
      }
      responder.sendStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);
      return;
    }
    responder.sendContent(HttpResponseStatus.OK,logsProducer,logsProducer.getResponseHeaders());
  }
 catch (  SecurityException e) {
    responder.sendStatus(HttpResponseStatus.UNAUTHORIZED);
  }
catch (  IllegalArgumentException e) {
    responder.sendString(HttpResponseStatus.BAD_REQUEST,e.getMessage());
  }
}
Program: 5201
Project: 5201
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",Constants.Security.PRINCIPAL,specifiedOwnerPrincipal,Constants.Security.PRINCIPAL,entityId.getEntityType()));
    }
  }
 catch (  IOException e) {
    throw new DatasetManagementException(e.getMessage(),e);
  }
}

Fixed version (ground truth):
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);
  }
}
Program: 5203
Project: 5203
Buggy source:
private void verifyOwner(StreamId streamId,@Nullable String specifiedOwnerPrincipal) throws IOException, ConflictException {
  if (!Objects.equals(specifiedOwnerPrincipal,ownerAdmin.getImpersonationPrincipal(streamId))) {
    throw new ConflictException(String.format("String_Node_Str" + "String_Node_Str",Constants.Security.PRINCIPAL,specifiedOwnerPrincipal,Constants.Security.PRINCIPAL,streamId.getEntityType()));
  }
}

Fixed version (ground truth):
private void verifyOwner(StreamId streamId,@Nullable String specifiedOwnerPrincipal) throws IOException, ConflictException {
  if (!Objects.equals(specifiedOwnerPrincipal,ownerAdmin.getImpersonationPrincipal(streamId))) {
    throw new ConflictException(String.format("String_Node_Str" + "String_Node_Str",streamId.getEntityType(),streamId.getStream(),Constants.Security.PRINCIPAL,specifiedOwnerPrincipal,Constants.Security.PRINCIPAL));
  }
}
Program: 5204
Project: 5204
Buggy source:
/** 
 * Collects stats from all   {@link OperationalStats}.
 */
private void collectOperationalStats() throws InterruptedException {
  LOG.debug("String_Node_Str");
  for (  Map.Entry<OperationalExtensionId,OperationalStats> entry : operationalStatsLoader.getAll().entrySet()) {
    if (!isRunning()) {
      return;
    }
    OperationalStats stats=entry.getValue();
    LOG.debug("String_Node_Str",stats.getServiceName(),stats.getStatType());
    try {
      stats.collect();
    }
 catch (    Throwable t) {
      Throwables.propagateIfInstanceOf(t,InterruptedException.class);
      Throwable rootCause=Throwables.getRootCause(t);
      if (rootCause instanceof ServiceUnavailableException || rootCause instanceof TException) {
        return;
      }
      if (rootCause instanceof InterruptedException) {
        throw (InterruptedException)rootCause;
      }
      LOG.warn("String_Node_Str",stats.getServiceName(),stats.getStatType(),rootCause.getMessage());
    }
  }
}

Fixed version (ground truth):
/** 
 * Collects stats from all   {@link OperationalStats}.
 */
private void collectOperationalStats() throws InterruptedException {
  LOG.trace("String_Node_Str");
  for (  Map.Entry<OperationalExtensionId,OperationalStats> entry : operationalStatsLoader.getAll().entrySet()) {
    if (!isRunning()) {
      return;
    }
    OperationalStats stats=entry.getValue();
    LOG.trace("String_Node_Str",stats.getServiceName(),stats.getStatType());
    try {
      stats.collect();
    }
 catch (    Throwable t) {
      Throwables.propagateIfInstanceOf(t,InterruptedException.class);
      Throwable rootCause=Throwables.getRootCause(t);
      if (rootCause instanceof ServiceUnavailableException || rootCause instanceof TException) {
        return;
      }
      if (rootCause instanceof InterruptedException) {
        throw (InterruptedException)rootCause;
      }
      LOG.warn("String_Node_Str",stats.getServiceName(),stats.getStatType(),rootCause.getMessage());
    }
  }
}
Program: 5205
Project: 5205
Buggy source:
@Override protected void shutDown() throws Exception {
  MBeanServer mbs=ManagementFactory.getPlatformMBeanServer();
  for (  Map.Entry<OperationalExtensionId,OperationalStats> entry : operationalStatsLoader.getAll().entrySet()) {
    OperationalStats operationalStats=entry.getValue();
    ObjectName objectName=getObjectName(operationalStats);
    if (objectName == null) {
      LOG.warn("String_Node_Str" + "String_Node_Str",operationalStats.getClass().getName());
      continue;
    }
    try {
      mbs.unregisterMBean(objectName);
    }
 catch (    InstanceNotFoundException e) {
      LOG.debug("String_Node_Str",objectName);
    }
catch (    MBeanRegistrationException e) {
      LOG.warn("String_Node_Str",e);
    }
    operationalStats.destroy();
  }
  LOG.info("String_Node_Str");
}

Fixed version (ground truth):
@Override protected void shutDown() throws Exception {
  MBeanServer mbs=ManagementFactory.getPlatformMBeanServer();
  for (  Map.Entry<OperationalExtensionId,OperationalStats> entry : operationalStatsLoader.getAll().entrySet()) {
    OperationalStats operationalStats=entry.getValue();
    ObjectName objectName=getObjectName(operationalStats);
    if (objectName == null) {
      LOG.warn("String_Node_Str" + "String_Node_Str",operationalStats.getClass().getName());
      continue;
    }
    try {
      mbs.unregisterMBean(objectName);
    }
 catch (    InstanceNotFoundException e) {
      LOG.warn("String_Node_Str",objectName);
    }
catch (    MBeanRegistrationException e) {
      LOG.warn("String_Node_Str",e);
    }
    operationalStats.destroy();
  }
  LOG.info("String_Node_Str");
}
Program: 5207
Project: 5207
Buggy source:
@Override protected void onFinish(HttpResponder responder,File uploadedFile){
  try {
    ApplicationWithPrograms app=applicationLifecycleService.deployAppAndArtifact(namespace,appId,artifactId,uploadedFile,configString,finalOwnerPrincipalId,createProgramTerminator());
    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 (  Exception e) {
    LOG.error("String_Node_Str",e);
    responder.sendString(HttpResponseStatus.BAD_REQUEST,e.getMessage());
  }
}
Program: 5208
Project: 5208
Buggy source:
protected void verifyData(ApplicationId appId,ApplicationSpecification specification,@Nullable KerberosPrincipalId specifiedOwnerPrincipal) throws DatasetManagementException {
  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, 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);
    }
  }
}
Program: 5209
Project: 5209
Buggy source:
private void verifyOwner(NamespacedEntityId entityId,@Nullable KerberosPrincipalId specifiedOwnerPrincipal) throws DatasetManagementException {
  KerberosPrincipalId existingOwnerPrincipal;
  try {
    existingOwnerPrincipal=ownerAdmin.getOwner(entityId);
    boolean equals=Objects.equals(existingOwnerPrincipal,specifiedOwnerPrincipal);
    Preconditions.checkArgument(equals,String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str",entityId,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, 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",Constants.Security.PRINCIPAL,specifiedOwnerPrincipal,Constants.Security.PRINCIPAL,entityId.getEntityType()));
    }
  }
 catch (  IOException e) {
    throw new DatasetManagementException(e.getMessage(),e);
  }
}
Program: 5211
Project: 5211
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.getOwnerPrincipal(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.getImpersonationPrincipal(appId);
  return ApplicationDetail.fromSpec(appSpec,ownerPrincipal);
}
Program: 5212
Project: 5212
Buggy source:
@Nullable @Override public ImpersonationInfo getImpersonationInfo(NamespacedEntityId entityId) throws IOException {
  if (entityId.getEntityType().equals(EntityType.PROGRAM)) {
    entityId=((ProgramId)entityId).getParent();
  }
  if (!entityId.getEntityType().equals(EntityType.NAMESPACE)) {
    KerberosPrincipalId effectiveOwner=ownerStore.getOwner(entityId);
    if (effectiveOwner != null) {
      return new ImpersonationInfo(effectiveOwner.getPrincipal(),SecurityUtil.getKeytabURIforPrincipal(effectiveOwner.getPrincipal(),cConf));
    }
  }
  try {
    NamespaceConfig nsConfig=namespaceQueryAdmin.get(entityId.getNamespaceId()).getConfig();
    String nsPrincipal=nsConfig.getPrincipal();
    return nsPrincipal == null ? null : new ImpersonationInfo(nsPrincipal,nsConfig.getKeytabURI());
  }
 catch (  IOException e) {
    throw e;
  }
catch (  Exception e) {
    throw new IOException(e);
  }
}

Fixed version (ground truth):
@Nullable @Override public ImpersonationInfo getImpersonationInfo(NamespacedEntityId entityId) throws IOException {
  entityId=getEffectiveEntity(entityId);
  if (!entityId.getEntityType().equals(EntityType.NAMESPACE)) {
    KerberosPrincipalId effectiveOwner=ownerStore.getOwner(entityId);
    if (effectiveOwner != null) {
      return new ImpersonationInfo(effectiveOwner.getPrincipal(),SecurityUtil.getKeytabURIforPrincipal(effectiveOwner.getPrincipal(),cConf));
    }
  }
  NamespaceConfig nsConfig=getNamespaceConfig(entityId.getNamespaceId());
  return nsConfig.getPrincipal() == null ? null : new ImpersonationInfo(nsConfig.getPrincipal(),nsConfig.getKeytabURI());
}
Program: 5214
Project: 5214
Buggy source:
@Override protected void configure(){
  bind(StreamMetaStore.class).to(InMemoryStreamMetaStore.class);
  bind(UGIProvider.class).to(UnsupportedUGIProvider.class);
  bind(OwnerAdmin.class).to(DefaultOwnerAdmin.class);
}

Fixed version (ground truth):
@Override protected void configure(){
  bind(StreamMetaStore.class).to(InMemoryStreamMetaStore.class);
  bind(UGIProvider.class).to(UnsupportedUGIProvider.class);
  bind(OwnerAdmin.class).to(DefaultOwnerAdmin.class);
  bind(NamespaceQueryAdmin.class).to(SimpleNamespaceQueryAdmin.class);
}
Program: 5215
Project: 5215
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 (  IllegalArgumentException e) {
  }
  properties.put(Constants.Security.PRINCIPAL,"String_Node_Str");
  try {
    streamAdmin.create(stream,properties);
    Assert.fail("String_Node_Str");
  }
 catch (  IllegalArgumentException 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 (  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));
}
Program: 5217
Project: 5217
Buggy source:
@Override protected void configure(){
  bind(StreamMetaStore.class).to(InMemoryStreamMetaStore.class);
  bind(NotificationFeedManager.class).to(NoOpNotificationFeedManager.class);
  bind(UGIProvider.class).to(UnsupportedUGIProvider.class);
  bind(OwnerAdmin.class).to(DefaultOwnerAdmin.class);
}

Fixed version (ground truth):
@Override protected void configure(){
  bind(StreamMetaStore.class).to(InMemoryStreamMetaStore.class);
  bind(NotificationFeedManager.class).to(NoOpNotificationFeedManager.class);
  bind(UGIProvider.class).to(UnsupportedUGIProvider.class);
  bind(OwnerAdmin.class).to(DefaultOwnerAdmin.class);
  bind(NamespaceQueryAdmin.class).to(SimpleNamespaceQueryAdmin.class);
}
Program: 5218
Project: 5218
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.getOwnerPrincipal(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.getImpersonationPrincipal(instance);
  }
  return new DatasetMeta(spec,typeMeta,null,ownerPrincipal);
}
Program: 5219
Project: 5219
Buggy source:
private void verifyOwner(StreamId streamId,@Nullable String specifiedOwnerPrincipal) throws IOException {
  boolean equals=Objects.equals(specifiedOwnerPrincipal,ownerAdmin.getOwnerPrincipal(streamId));
  Preconditions.checkArgument(equals,String.format("String_Node_Str",Constants.Security.PRINCIPAL));
}

Fixed version (ground truth):
private void verifyOwner(StreamId streamId,@Nullable String specifiedOwnerPrincipal) throws IOException, ConflictException {
  if (!Objects.equals(specifiedOwnerPrincipal,ownerAdmin.getImpersonationPrincipal(streamId))) {
    throw new ConflictException(String.format("String_Node_Str" + "String_Node_Str",Constants.Security.PRINCIPAL,specifiedOwnerPrincipal,Constants.Security.PRINCIPAL,streamId.getEntityType()));
  }
}
Program: 5220
Project: 5220
Buggy source:
@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);
}

Fixed version (ground truth):
@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);
}
Program: 5221
Project: 5221
Buggy source:
private void verifyUpdateOwnerFailure(String streamName,@Nullable String ownerPrincipal) throws IOException, URISyntaxException {
  StreamProperties newProps=new StreamProperties(1L,null,null,null,ownerPrincipal);
  HttpURLConnection urlConn=openURL(createPropertiesURL(streamName),HttpMethod.PUT);
  urlConn.setDoOutput(true);
  urlConn.getOutputStream().write(GSON.toJson(newProps).getBytes(Charsets.UTF_8));
  Assert.assertEquals(HttpResponseStatus.INTERNAL_SERVER_ERROR.getCode(),urlConn.getResponseCode());
  urlConn.disconnect();
}

Fixed version (ground truth):
private void verifyUpdateOwnerFailure(String streamName,@Nullable String ownerPrincipal) throws IOException, URISyntaxException {
  StreamProperties newProps=new StreamProperties(1L,null,null,null,ownerPrincipal);
  HttpURLConnection urlConn=openURL(createPropertiesURL(streamName),HttpMethod.PUT);
  urlConn.setDoOutput(true);
  urlConn.getOutputStream().write(GSON.toJson(newProps).getBytes(Charsets.UTF_8));
  Assert.assertEquals(HttpResponseStatus.CONFLICT.getCode(),urlConn.getResponseCode());
  urlConn.disconnect();
}
Program: 5222
Project: 5222
Buggy source:
@Override public StreamConfig create(StreamId streamId,@Nullable Properties props) throws Exception {
  return null;
}

Fixed version (ground truth):
@Override @Nullable public StreamConfig create(StreamId streamId,@Nullable Properties props) throws Exception {
  return null;
}
Program: 5223
Project: 5223
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 (  IllegalArgumentException e) {
  }
  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 (  IllegalArgumentException e) {
  }
  properties.put(Constants.Security.PRINCIPAL,"String_Node_Str");
  try {
    streamAdmin.create(stream,properties);
    Assert.fail("String_Node_Str");
  }
 catch (  IllegalArgumentException e) {
  }
  Assert.assertEquals(ownerPrincipal,streamAdmin.getProperties(stream).getOwnerPrincipal());
  streamAdmin.drop(stream);
  Assert.assertFalse(ownerAdmin.exists(stream));
}
Program: 5224
Project: 5224
Buggy source:
@Override public StreamConfig create(StreamId streamId,@Nullable Properties props) throws Exception {
  create(QueueName.fromStream(streamId),props);
  String description=(props != null) ? props.getProperty(Constants.Stream.DESCRIPTION) : null;
  streamMetaStore.addStream(streamId,description);
  publishAudit(streamId,AuditType.CREATE);
  return null;
}

Fixed version (ground truth):
@Override @Nullable public StreamConfig create(StreamId streamId,@Nullable Properties props) throws Exception {
  create(QueueName.fromStream(streamId),props);
  String description=(props != null) ? props.getProperty(Constants.Stream.DESCRIPTION) : null;
  streamMetaStore.addStream(streamId,description);
  publishAudit(streamId,AuditType.CREATE);
  return null;
}
Program: 5226
Project: 5226
Buggy source:
/** 
 * Creates stream if doesn't exist. If stream exists, does nothing.
 * @param streamId Id of the stream to create
 * @param props additional properties
 * @return The {@link StreamConfig} associated with the new stream
 * @throws Exception if creation fails
 */
StreamConfig create(StreamId streamId,@Nullable Properties props) throws Exception ;

Fixed version (ground truth):
/** 
 * Creates stream if doesn't exist. If stream exists, does nothing.
 * @param streamId Id of the stream to create
 * @param props additional properties
 * @return The {@link StreamConfig} associated with the new stream or null if the stream already exists
 * @throws Exception if creation fails
 */
@Nullable StreamConfig create(StreamId streamId,@Nullable Properties props) throws Exception ;
Program: 5227
Project: 5227
Buggy source:
private void assertNoAccess(final EntityId entityId) throws Exception {
  Authorizer authorizer=getAuthorizer();
  Predicate<Privilege> entityFilter=new Predicate<Privilege>(){
    @Override public boolean apply(    Privilege input){
      return entityId.equals(input.getEntity());
    }
  }
;
  Assert.assertTrue(Sets.filter(authorizer.listPrivileges(ALICE),entityFilter).isEmpty());
  Assert.assertTrue(Sets.filter(authorizer.listPrivileges(BOB),entityFilter).isEmpty());
}

Fixed version (ground truth):
private void assertNoAccess(final EntityId entityId) throws Exception {
  assertNoAccess(ALICE,entityId);
  assertNoAccess(BOB,entityId);
}
Program: 5230
Project: 5230
Buggy source:
@Override public void process(ApplicationWithPrograms input) throws Exception {
  Collection<ApplicationId> allAppVersionsAppIds=store.getAllAppVersionsAppIds(input.getApplicationId());
  if (allAppVersionsAppIds.isEmpty() && input.getOwnerPrincipal() != null) {
    addOwner(input.getApplicationId(),input.getOwnerPrincipal());
  }
  store.addApplication(input.getApplicationId(),input.getSpecification());
  registerDatasets(input);
  emit(input);
}

Fixed version (ground truth):
@Override public void process(ApplicationWithPrograms input) throws Exception {
  Collection<ApplicationId> allAppVersionsAppIds=store.getAllAppVersionsAppIds(input.getApplicationId());
  boolean ownerAdded=addOwnerIfRequired(input,allAppVersionsAppIds);
  try {
    store.addApplication(input.getApplicationId(),input.getSpecification());
  }
 catch (  Exception e) {
    if (ownerAdded) {
      ownerAdmin.delete(input.getApplicationId());
    }
    throw e;
  }
  registerDatasets(input);
  emit(input);
}
Program: 5232
Project: 5232
Buggy source:
SearchResults(List<MetadataEntry> results,List<String> cursors,List<MetadataEntry> allResults){
  this.results=results;
  this.cursors=cursors;
  this.allResults=allResults;
}

Fixed version (ground truth):
SearchResults(List<MetadataEntry> results,List<String> cursors,List<MetadataEntry> allResults){
  this.resultsFromOffset=results;
  this.cursors=cursors;
  this.resultsFromBeginning=allResults;
}
Program: 5235
Project: 5235
Buggy source:
private List<MetadataEntry> searchByDefaultIndex(MetadataDataset dataset,String namespaceId,String searchQuery,Set<EntityTypeSimpleName> types) throws BadRequestException {
  return dataset.search(namespaceId,searchQuery,types,SortInfo.DEFAULT,0,Integer.MAX_VALUE,1,null,false,EnumSet.allOf(EntityScope.class)).getResults();
}

Fixed version (ground truth):
private List<MetadataEntry> searchByDefaultIndex(MetadataDataset dataset,String namespaceId,String searchQuery,Set<EntityTypeSimpleName> types) throws BadRequestException {
  return dataset.search(namespaceId,searchQuery,types,SortInfo.DEFAULT,0,Integer.MAX_VALUE,1,null,false,EnumSet.allOf(EntityScope.class)).getResultsFromOffset();
}
Program: 5237
Project: 5237
Buggy source:
@Override public void alive(){
  executor.execute(new Runnable(){
    @Override public void run(){
      listener.alive();
    }
  }
);
}

Fixed version (ground truth):
@Override public void alive(){
  execute(new Runnable(){
    @Override public void run(){
      listener.alive();
    }
  }
,"String_Node_Str");
}
Program: 5238
Project: 5238
Buggy source:
@Override public void error(final Throwable cause){
  executor.execute(new Runnable(){
    @Override public void run(){
      listener.error(cause);
    }
  }
);
}

Fixed version (ground truth):
@Override public void error(final Throwable cause){
  execute(new Runnable(){
    @Override public void run(){
      listener.error(cause);
    }
  }
,"String_Node_Str");
}
Program: 5239
Project: 5239
Buggy source:
@Override public void resuming(){
  executor.execute(new Runnable(){
    @Override public void run(){
      listener.resuming();
    }
  }
);
}

Fixed version (ground truth):
@Override public void resuming(){
  execute(new Runnable(){
    @Override public void run(){
      listener.resuming();
    }
  }
,"String_Node_Str");
}
Program: 5240
Project: 5240
Buggy source:
@Override public void suspending(){
  executor.execute(new Runnable(){
    @Override public void run(){
      listener.suspending();
    }
  }
);
}

Fixed version (ground truth):
@Override public void suspending(){
  execute(new Runnable(){
    @Override public void run(){
      listener.suspending();
    }
  }
,"String_Node_Str");
}
Program: 5241
Project: 5241
Buggy source:
@Override public void init(final State currentState,@Nullable final Throwable cause){
  executor.execute(new Runnable(){
    @Override public void run(){
      listener.init(currentState,cause);
    }
  }
);
}

Fixed version (ground truth):
@Override public void init(final State currentState,@Nullable final Throwable cause){
  execute(new Runnable(){
    @Override public void run(){
      listener.init(currentState,cause);
    }
  }
,"String_Node_Str");
}
Program: 5242
Project: 5242
Buggy source:
@Override public void completed(){
  executor.execute(new Runnable(){
    @Override public void run(){
      listener.completed();
    }
  }
);
}

Fixed version (ground truth):
@Override public void completed(){
  execute(new Runnable(){
    @Override public void run(){
      listener.completed();
    }
  }
,"String_Node_Str");
}
Program: 5243
Project: 5243
Buggy source:
@Override public void killed(){
  executor.execute(new Runnable(){
    @Override public void run(){
      listener.killed();
    }
  }
);
}

Fixed version (ground truth):
@Override public void killed(){
  execute(new Runnable(){
    @Override public void run(){
      listener.killed();
    }
  }
,"String_Node_Str");
}
Program: 5244
Project: 5244
Buggy source:
@Override public void suspended(){
  executor.execute(new Runnable(){
    @Override public void run(){
      listener.suspended();
    }
  }
);
}

Fixed version (ground truth):
@Override public void suspended(){
  execute(new Runnable(){
    @Override public void run(){
      listener.suspended();
    }
  }
,"String_Node_Str");
}
Program: 5245
Project: 5245
Buggy source:
@Override public void stopping(){
  executor.execute(new Runnable(){
    @Override public void run(){
      listener.stopping();
    }
  }
);
}

Fixed version (ground truth):
@Override public void stopping(){
  execute(new Runnable(){
    @Override public void run(){
      listener.stopping();
    }
  }
,"String_Node_Str");
}
Program: 5246
Project: 5246
Buggy source:
/** 
 * Collects stats from all   {@link OperationalStats}.
 */
private void collectOperationalStats() throws InterruptedException {
  LOG.debug("String_Node_Str");
  for (  Map.Entry<OperationalExtensionId,OperationalStats> entry : operationalStatsLoader.getAll().entrySet()) {
    if (!isRunning()) {
      return;
    }
    OperationalStats stats=entry.getValue();
    LOG.debug("String_Node_Str",stats.getServiceName(),stats.getStatType());
    try {
      stats.collect();
    }
 catch (    InterruptedException e) {
      throw e;
    }
catch (    Throwable t) {
      Throwable rootCause=Throwables.getRootCause(t);
      if (rootCause instanceof InterruptedException) {
        throw (InterruptedException)rootCause;
      }
      LOG.warn("String_Node_Str",stats.getServiceName(),stats.getStatType(),rootCause.getMessage());
    }
  }
}

Fixed version (ground truth):
/** 
 * Collects stats from all   {@link OperationalStats}.
 */
private void collectOperationalStats() throws InterruptedException {
  LOG.debug("String_Node_Str");
  for (  Map.Entry<OperationalExtensionId,OperationalStats> entry : operationalStatsLoader.getAll().entrySet()) {
    if (!isRunning()) {
      return;
    }
    OperationalStats stats=entry.getValue();
    LOG.debug("String_Node_Str",stats.getServiceName(),stats.getStatType());
    try {
      stats.collect();
    }
 catch (    Throwable t) {
      Throwables.propagateIfInstanceOf(t,InterruptedException.class);
      Throwable rootCause=Throwables.getRootCause(t);
      if (rootCause instanceof ServiceUnavailableException || rootCause instanceof TException) {
        return;
      }
      if (rootCause instanceof InterruptedException) {
        throw (InterruptedException)rootCause;
      }
      LOG.warn("String_Node_Str",stats.getServiceName(),stats.getStatType(),rootCause.getMessage());
    }
  }
}
Program: 5247
Project: 5247
Buggy source:
private MetricsConsumerMetaTable getMetaTable(){
  while (metaTable == null) {
    if (stopping) {
      LOG.info("String_Node_Str");
      break;
    }
    try {
      metaTable=metricDatasetFactory.createConsumerMeta();
    }
 catch (    Exception e) {
      LOG.warn("String_Node_Str");
      try {
        TimeUnit.SECONDS.sleep(1);
      }
 catch (      InterruptedException ie) {
        Thread.currentThread().interrupt();
        break;
      }
    }
  }
  return metaTable;
}

Fixed version (ground truth):
private MetricsConsumerMetaTable getMetaTable(){
  while (metaTable == null) {
    if (stopping) {
      LOG.info("String_Node_Str");
      break;
    }
    try {
      metaTable=metricDatasetFactory.createConsumerMeta();
    }
 catch (    ServiceUnavailableException e) {
    }
catch (    Exception e) {
      LOG.warn("String_Node_Str");
      try {
        TimeUnit.SECONDS.sleep(1);
      }
 catch (      InterruptedException ie) {
        Thread.currentThread().interrupt();
        break;
      }
    }
  }
  return metaTable;
}
Program: 5248
Project: 5248
Buggy source:
private MetricsConsumerMetaTable getMetaTable(){
  while (metaTable == null) {
    if (stopping) {
      LOG.info("String_Node_Str");
      break;
    }
    try {
      metaTable=metricDatasetFactory.createConsumerMeta();
    }
 catch (    Exception e) {
      LOG.warn("String_Node_Str");
      try {
        TimeUnit.SECONDS.sleep(1);
      }
 catch (      InterruptedException ie) {
        Thread.currentThread().interrupt();
        break;
      }
    }
  }
  return metaTable;
}

Fixed version (ground truth):
private MetricsConsumerMetaTable getMetaTable(){
  while (metaTable == null) {
    if (stopping) {
      LOG.info("String_Node_Str");
      break;
    }
    try {
      metaTable=metricDatasetFactory.createConsumerMeta();
    }
 catch (    ServiceUnavailableException e) {
    }
catch (    Exception e) {
      LOG.warn("String_Node_Str");
      try {
        TimeUnit.SECONDS.sleep(1);
      }
 catch (      InterruptedException ie) {
        Thread.currentThread().interrupt();
        break;
      }
    }
  }
  return metaTable;
}
Program: 5249
Project: 5249
Buggy source:
private DefaultMetricDatasetFactory(DatasetFramework namespacedDsFramework,final CConfiguration cConf){
  this.cConf=cConf;
  this.dsFramework=namespacedDsFramework;
  this.entityTable=Suppliers.memoize(new Supplier<EntityTable>(){
    @Override public EntityTable get(){
      String tableName=cConf.get(Constants.Metrics.ENTITY_TABLE_NAME,Constants.Metrics.DEFAULT_ENTITY_TABLE_NAME);
      return new EntityTable(getOrCreateMetricsTable(tableName,DatasetProperties.EMPTY));
    }
  }
);
}

Fixed version (ground truth):
@Inject public DefaultMetricDatasetFactory(final CConfiguration cConf,DatasetFramework dsFramework){
  this.cConf=cConf;
  this.dsFramework=dsFramework;
  this.entityTable=Suppliers.memoize(new Supplier<EntityTable>(){
    @Override public EntityTable get(){
      String tableName=cConf.get(Constants.Metrics.ENTITY_TABLE_NAME,Constants.Metrics.DEFAULT_ENTITY_TABLE_NAME);
      return new EntityTable(getOrCreateMetricsTable(tableName,DatasetProperties.EMPTY));
    }
  }
);
}
Program: 5250
Project: 5250
Buggy source:
@Override public FactTable getOrCreateFactTable(int resolution){
  String tableName=cConf.get(Constants.Metrics.METRICS_TABLE_PREFIX,Constants.Metrics.DEFAULT_METRIC_TABLE_PREFIX) + "String_Node_Str" + resolution;
  int ttl=cConf.getInt(Constants.Metrics.RETENTION_SECONDS + "String_Node_Str" + resolution+ "String_Node_Str",-1);
  TableProperties.Builder props=TableProperties.builder();
  if (ttl > 0 && resolution != Integer.MAX_VALUE) {
    props.setTTL(ttl);
  }
  props.setReadlessIncrementSupport(true);
  props.add(HBaseTableAdmin.PROPERTY_SPLITS,GSON.toJson(FactTable.getSplits(DefaultMetricStore.AGGREGATIONS.size())));
  MetricsTable table=getOrCreateMetricsTable(tableName,props.build());
  LOG.info("String_Node_Str",tableName);
  return new FactTable(table,entityTable.get(),resolution,getRollTime(resolution));
}

Fixed version (ground truth):
@Override public FactTable getOrCreateFactTable(int resolution){
  String tableName=cConf.get(Constants.Metrics.METRICS_TABLE_PREFIX,Constants.Metrics.DEFAULT_METRIC_TABLE_PREFIX) + "String_Node_Str" + resolution;
  int ttl=cConf.getInt(Constants.Metrics.RETENTION_SECONDS + "String_Node_Str" + resolution+ "String_Node_Str",-1);
  TableProperties.Builder props=TableProperties.builder();
  if (ttl > 0 && resolution != Integer.MAX_VALUE) {
    props.setTTL(ttl);
  }
  props.setReadlessIncrementSupport(true);
  props.add(HBaseTableAdmin.PROPERTY_SPLITS,GSON.toJson(FactTable.getSplits(DefaultMetricStore.AGGREGATIONS.size())));
  MetricsTable table=getOrCreateMetricsTable(tableName,props.build());
  LOG.debug("String_Node_Str",tableName);
  return new FactTable(table,entityTable.get(),resolution,getRollTime(resolution));
}
Program: 5251
Project: 5251
Buggy source:
private MetricsTable getOrCreateMetricsTable(String tableName,DatasetProperties props){
  MetricsTable table=null;
  DatasetId metricsDatasetInstanceId=NamespaceId.SYSTEM.dataset(tableName);
  while (table == null) {
    try {
      table=DatasetsUtil.getOrCreateDataset(dsFramework,metricsDatasetInstanceId,MetricsTable.class.getName(),props,null,null);
    }
 catch (    DatasetManagementException|ServiceUnavailableException e) {
      LOG.warn("String_Node_Str",tableName);
      try {
        TimeUnit.SECONDS.sleep(1);
      }
 catch (      InterruptedException ie) {
        Thread.currentThread().interrupt();
        break;
      }
    }
catch (    IOException e) {
      LOG.error("String_Node_Str",tableName,e);
      throw Throwables.propagate(e);
    }
  }
  return table;
}

Fixed version (ground truth):
private MetricsTable getOrCreateMetricsTable(String tableName,DatasetProperties props){
  DatasetId metricsDatasetInstanceId=NamespaceId.SYSTEM.dataset(tableName);
  MetricsTable table=null;
  try {
    table=DatasetsUtil.getOrCreateDataset(dsFramework,metricsDatasetInstanceId,MetricsTable.class.getName(),props,null,null);
  }
 catch (  Exception e) {
    Throwables.propagate(e);
  }
  return table;
}
Program: 5252
Project: 5252
Buggy source:
@Override public MetricsConsumerMetaTable createConsumerMeta(){
  String tableName=cConf.get(Constants.Metrics.KAFKA_META_TABLE);
  try {
    MetricsTable table=getOrCreateMetricsTable(tableName,DatasetProperties.EMPTY);
    LOG.info("String_Node_Str",tableName);
    return new MetricsConsumerMetaTable(table);
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    throw Throwables.propagate(e);
  }
}

Fixed version (ground truth):
@Override public MetricsConsumerMetaTable createConsumerMeta(){
  String tableName=cConf.get(Constants.Metrics.KAFKA_META_TABLE);
  MetricsTable table=getOrCreateMetricsTable(tableName,DatasetProperties.EMPTY);
  LOG.debug("String_Node_Str",tableName);
  return new MetricsConsumerMetaTable(table);
}