nus-yam/ex-repair huggingface dataset:
Program: 5968
Project: 5968
Buggy source:
@Override public synchronized void updateProperties(Id.Namespace namespaceId,NamespaceMeta namespaceMeta) throws Exception {
  if (!exists(namespaceId)) {
    throw new NamespaceNotFoundException(namespaceId);
  }
  authorizationEnforcer.enforce(namespaceId.toEntityId(),authenticationContext.getPrincipal(),Action.ADMIN);
  NamespaceMeta existingMeta=nsStore.get(namespaceId);
  Preconditions.checkNotNull(existingMeta);
  NamespaceMeta.Builder builder=new NamespaceMeta.Builder(existingMeta);
  if (namespaceMeta.getDescription() != null) {
    builder.setDescription(namespaceMeta.getDescription());
  }
  NamespaceConfig config=namespaceMeta.getConfig();
  if (config != null && !Strings.isNullOrEmpty(config.getSchedulerQueueName())) {
    builder.setSchedulerQueueName(config.getSchedulerQueueName());
  }
  if (config != null && config.getRootDirectory() != null) {
    if (!config.getRootDirectory().equals(existingMeta.getConfig().getRootDirectory())) {
      throw new BadRequestException(String.format("String_Node_Str",NamespaceConfig.ROOT_DIRECTORY,existingMeta.getConfig().getRootDirectory(),config.getRootDirectory()));
    }
    if (config.getHbaseNamespace() != null && (!config.getHbaseNamespace().equals(existingMeta.getConfig().getHbaseNamespace()))) {
      throw new BadRequestException(String.format("String_Node_Str",NamespaceConfig.HBASE_NAMESPACE,existingMeta.getConfig().getHbaseNamespace(),config.getHbaseNamespace()));
    }
  }
  if (config != null && config.getHiveDatabase() != null) {
    if (!config.getHiveDatabase().equals(existingMeta.getConfig().getHiveDatabase())) {
      throw new BadRequestException(String.format("String_Node_Str",NamespaceConfig.HIVE_DATABASE,existingMeta.getConfig().getHiveDatabase(),config.getHiveDatabase()));
    }
  }
  nsStore.update(builder.build());
}

Fixed version (ground truth):
@Override public synchronized void updateProperties(Id.Namespace namespaceId,NamespaceMeta namespaceMeta) throws Exception {
  if (!exists(namespaceId)) {
    throw new NamespaceNotFoundException(namespaceId);
  }
  authorizationEnforcer.enforce(namespaceId.toEntityId(),authenticationContext.getPrincipal(),Action.ADMIN);
  NamespaceMeta existingMeta=nsStore.get(namespaceId);
  Preconditions.checkNotNull(existingMeta);
  NamespaceMeta.Builder builder=new NamespaceMeta.Builder(existingMeta);
  if (namespaceMeta.getDescription() != null) {
    builder.setDescription(namespaceMeta.getDescription());
  }
  NamespaceConfig config=namespaceMeta.getConfig();
  if (config != null && !Strings.isNullOrEmpty(config.getSchedulerQueueName())) {
    builder.setSchedulerQueueName(config.getSchedulerQueueName());
  }
  Set<String> difference=existingMeta.getConfig().getDifference(config);
  if (!difference.isEmpty()) {
    throw new BadRequestException(String.format("String_Node_Str" + "String_Node_Str",difference,namespaceId));
  }
  nsStore.update(builder.build());
}
Program: 5969
Project: 5969
Buggy source:
/** 
 * Creates a new namespace
 * @param metadata the {@link NamespaceMeta} for the new namespace to be created
 * @throws NamespaceAlreadyExistsException if the specified namespace already exists
 */
@Override public synchronized void create(final NamespaceMeta metadata) throws Exception {
  Preconditions.checkArgument(metadata != null,"String_Node_Str");
  NamespaceId namespace=new NamespaceId(metadata.getName());
  if (exists(namespace.toId())) {
    throw new NamespaceAlreadyExistsException(namespace.toId());
  }
  if (hasCustomMapping(metadata)) {
    validateCustomMapping(metadata);
  }
  Principal principal=authenticationContext.getPrincipal();
  authorizationEnforcer.enforce(instanceId,principal,Action.ADMIN);
  authorizer.grant(namespace,principal,ImmutableSet.of(Action.ALL));
  nsStore.create(metadata);
  try {
    impersonator.doAs(metadata,new Callable<Void>(){
      @Override public Void call() throws Exception {
        storageProviderNamespaceAdmin.create(metadata);
        return null;
      }
    }
);
  }
 catch (  IOException|ExploreException|SQLException e) {
    nsStore.delete(metadata.getNamespaceId().toId());
    authorizer.revoke(namespace);
    throw new NamespaceCannotBeCreatedException(namespace.toId(),e);
  }
}

Fixed version (ground truth):
/** 
 * Creates a new namespace
 * @param metadata the {@link NamespaceMeta} for the new namespace to be created
 * @throws NamespaceAlreadyExistsException if the specified namespace already exists
 */
@Override public synchronized void create(final NamespaceMeta metadata) throws Exception {
  Preconditions.checkArgument(metadata != null,"String_Node_Str");
  NamespaceId namespace=new NamespaceId(metadata.getName());
  if (exists(namespace.toId())) {
    throw new NamespaceAlreadyExistsException(namespace.toId());
  }
  if (hasCustomMapping(metadata)) {
    validateCustomMapping(metadata);
  }
  Principal principal=authenticationContext.getPrincipal();
  authorizationEnforcer.enforce(instanceId,principal,Action.ADMIN);
  authorizer.grant(namespace,principal,ImmutableSet.of(Action.ALL));
  if (SecurityUtil.isKerberosEnabled(cConf)) {
    ImpersonationInfo impersonationInfo=new ImpersonationInfo(metadata,cConf);
    String namespacePrincipal=impersonationInfo.getPrincipal();
    String namespaceUserName=new KerberosName(namespacePrincipal).getShortName();
    Principal namespaceUser=new Principal(namespaceUserName,Principal.PrincipalType.USER);
    authorizer.grant(namespace,namespaceUser,EnumSet.allOf(Action.class));
  }
  nsStore.create(metadata);
  try {
    impersonator.doAs(metadata,new Callable<Void>(){
      @Override public Void call() throws Exception {
        storageProviderNamespaceAdmin.create(metadata);
        return null;
      }
    }
);
  }
 catch (  IOException|ExploreException|SQLException e) {
    nsStore.delete(metadata.getNamespaceId().toId());
    authorizer.revoke(namespace);
    throw new NamespaceCannotBeCreatedException(namespace.toId(),e);
  }
}
Program: 5970
Project: 5970
Buggy source:
/** 
 * Checks if the specified namespace exists
 * @param namespaceId the {@link Id.Namespace} to check for existence
 * @return true, if the specifed namespace exists, false otherwise
 */
@Override public boolean exists(Id.Namespace namespaceId) throws Exception {
  try {
    get(namespaceId);
  }
 catch (  NotFoundException e) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Checks if the specified namespace exists
 * @param namespaceId the {@link Id.Namespace} to check for existence
 * @return true, if the specifed namespace exists, false otherwise
 */
@Override public boolean exists(Id.Namespace namespaceId) throws Exception {
  return nsStore.get(namespaceId) != null;
}
Program: 5971
Project: 5971
Buggy source:
@Override public void create(NamespaceMeta namespaceMeta) throws IOException, ExploreException, SQLException {
  super.create(namespaceMeta);
  String hbaseNamespace=tableUtil.getHBaseNamespace(namespaceMeta);
  try (HBaseAdmin admin=new HBaseAdmin(hConf)){
    if (Strings.isNullOrEmpty(namespaceMeta.getConfig().getHbaseNamespace())) {
      try {
        tableUtil.createNamespaceIfNotExists(admin,hbaseNamespace);
      }
 catch (      IOException e) {
        super.delete(namespaceMeta.getNamespaceId());
        throw e;
      }
    }
    if (!tableUtil.hasNamespace(admin,hbaseNamespace)) {
      throw new IOException(String.format("String_Node_Str",hbaseNamespace,namespaceMeta.getName()));
    }
  }
 }

Fixed version (ground truth):
@Override public void create(NamespaceMeta namespaceMeta) throws IOException, ExploreException, SQLException {
  super.create(namespaceMeta);
  if (NamespaceId.DEFAULT.equals(namespaceMeta.getNamespaceId())) {
    return;
  }
  String hbaseNamespace=tableUtil.getHBaseNamespace(namespaceMeta);
  try (HBaseAdmin admin=new HBaseAdmin(hConf)){
    if (Strings.isNullOrEmpty(namespaceMeta.getConfig().getHbaseNamespace())) {
      try {
        tableUtil.createNamespaceIfNotExists(admin,hbaseNamespace);
      }
 catch (      IOException e) {
        super.delete(namespaceMeta.getNamespaceId());
        throw e;
      }
    }
    if (!tableUtil.hasNamespace(admin,hbaseNamespace)) {
      throw new IOException(String.format("String_Node_Str",hbaseNamespace,namespaceMeta.getName()));
    }
  }
 }
Program: 5972
Project: 5972
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public void delete(NamespaceId namespaceId) throws IOException, ExploreException, SQLException {
  super.delete(namespaceId);
  NamespaceConfig namespaceConfig;
  try {
    namespaceConfig=namespaceQueryAdmin.get(namespaceId.toId()).getConfig();
  }
 catch (  Exception ex) {
    throw new IOException("String_Node_Str",ex);
  }
  if (Strings.isNullOrEmpty(namespaceConfig.getHbaseNamespace())) {
    String namespace=tableUtil.getHBaseNamespace(namespaceId);
    try (HBaseAdmin admin=new HBaseAdmin(hConf)){
      tableUtil.deleteNamespaceIfExists(admin,namespace);
    }
   }
 else {
    LOG.debug("String_Node_Str",namespaceConfig.getHbaseNamespace(),namespaceId);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public void delete(NamespaceId namespaceId) throws IOException, ExploreException, SQLException {
  super.delete(namespaceId);
  if (NamespaceId.DEFAULT.equals(namespaceId)) {
    return;
  }
  NamespaceConfig namespaceConfig;
  try {
    namespaceConfig=namespaceQueryAdmin.get(namespaceId.toId()).getConfig();
  }
 catch (  Exception ex) {
    throw new IOException("String_Node_Str",ex);
  }
  if (!Strings.isNullOrEmpty(namespaceConfig.getHbaseNamespace())) {
    LOG.debug("String_Node_Str",namespaceConfig.getHbaseNamespace(),namespaceId);
    return;
  }
  String namespace=tableUtil.getHBaseNamespace(namespaceId);
  try (HBaseAdmin admin=new HBaseAdmin(hConf)){
    tableUtil.deleteNamespaceIfExists(admin,namespace);
  }
 }
Program: 5974
Project: 5974
Buggy source:
@Override public boolean exists(Id.Namespace namespaceId) throws Exception {
  try {
    get(namespaceId);
  }
 catch (  NamespaceNotFoundException e) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean exists(Id.Namespace namespaceId) throws Exception {
  try {
    get(namespaceId);
  }
 catch (  NamespaceNotFoundException e) {
    return false;
  }
catch (  UnauthorizedException e) {
  }
  return true;
}
Program: 5975
Project: 5975
Buggy source:
public ImpersonationInfo(String principal,String keytabURI){
  this.principal=principal;
  this.keytabURI=keytabURI;
}

Fixed version (ground truth):
/** 
 * Creates   {@link ImpersonationInfo} for the specified namespace. If the info is not configured at the namespacelevel is empty, returns the info configured at the cdap level.
 */
public ImpersonationInfo(NamespaceMeta namespaceMeta,CConfiguration cConf){
  NamespaceConfig namespaceConfig=namespaceMeta.getConfig();
  String configuredPrincipal=namespaceConfig.getPrincipal();
  String configuredKeytabURI=namespaceConfig.getKeytabURI();
  if (configuredPrincipal != null && configuredKeytabURI != null) {
    this.principal=configuredPrincipal;
    this.keytabURI=configuredKeytabURI;
  }
 else   if (configuredPrincipal == null && configuredKeytabURI == null) {
    this.principal=cConf.get(Constants.Security.CFG_CDAP_MASTER_KRB_PRINCIPAL);
    this.keytabURI=cConf.get(Constants.Security.CFG_CDAP_MASTER_KRB_KEYTAB_PATH);
  }
  throw new IllegalStateException(String.format("String_Node_Str" + "String_Node_Str",configuredPrincipal,configuredKeytabURI));
}
Program: 5976
Project: 5976
Buggy source:
@Inject ImpersonationUserResolver(NamespaceQueryAdmin namespaceQueryAdmin,CConfiguration cConf){
  this.namespaceQueryAdmin=namespaceQueryAdmin;
  this.defaultPrincipal=cConf.get(Constants.Security.CFG_CDAP_MASTER_KRB_PRINCIPAL);
  this.defaultKeytabPath=cConf.get(Constants.Security.CFG_CDAP_MASTER_KRB_KEYTAB_PATH);
}

Fixed version (ground truth):
@Inject ImpersonationUserResolver(NamespaceQueryAdmin namespaceQueryAdmin,CConfiguration cConf){
  this.namespaceQueryAdmin=namespaceQueryAdmin;
  this.cConf=cConf;
}
Program: 5977
Project: 5977
Buggy source:
/** 
 * Get impersonation info for a given namespace. If the info configured at the namespace level is empty, returns the info configured at the cdap level.
 * @return configured {@link ImpersonationInfo}.
 */
public ImpersonationInfo getImpersonationInfo(NamespaceMeta meta){
  NamespaceConfig namespaceConfig=meta.getConfig();
  String configuredPrincipal=namespaceConfig.getPrincipal();
  String configuredKeytabURI=namespaceConfig.getKeytabURI();
  if (configuredPrincipal != null && configuredKeytabURI != null) {
    return new ImpersonationInfo(configuredPrincipal,configuredKeytabURI);
  }
  if (configuredPrincipal == null && configuredKeytabURI == null) {
    return new ImpersonationInfo(defaultPrincipal,defaultKeytabPath);
  }
  throw new IllegalStateException(String.format("String_Node_Str" + "String_Node_Str",configuredPrincipal,configuredKeytabURI));
}

Fixed version (ground truth):
/** 
 * Get impersonation info for a given namespace. If the info configured at the namespace level is empty, returns the info configured at the cdap level.
 * @return configured {@link ImpersonationInfo}.
 */
public ImpersonationInfo getImpersonationInfo(NamespaceMeta meta){
  return new ImpersonationInfo(meta,cConf);
}
Program: 5978
Project: 5978
Buggy source:
private UserGroupInformation getUGI(ImpersonationInfo impersonationInfo) throws IOException {
  if (UserGroupInformation.getCurrentUser().getUserName().equals(impersonationInfo.getPrincipal())) {
    LOG.debug("String_Node_Str",UserGroupInformation.getCurrentUser());
    return UserGroupInformation.getCurrentUser();
  }
  return ugiProvider.getConfiguredUGI(impersonationInfo);
}

Fixed version (ground truth):
private UserGroupInformation getUGI(ImpersonationInfo impersonationInfo) throws IOException {
  String configuredPrincipalShortName=new KerberosName(impersonationInfo.getPrincipal()).getShortName();
  if (UserGroupInformation.getCurrentUser().getShortUserName().equals(configuredPrincipalShortName)) {
    LOG.debug("String_Node_Str",impersonationInfo.getPrincipal(),UserGroupInformation.getCurrentUser());
    return UserGroupInformation.getCurrentUser();
  }
  return ugiProvider.getConfiguredUGI(impersonationInfo);
}
Program: 5979
Project: 5979
Buggy source:
/** 
 * Returns the data stored in the secure store. Makes two calls to the provider, one to get the metadata and another to get the data.
 * @param namespace The namespace this key belongs to.
 * @param name Name of the key.
 * @return An object representing the securely stored data associated with the name.
 * @throws NamespaceNotFoundException If the specified namespace does not exist.
 * @throws IOException If there was a problem getting the key or the metadata from the underlying key provider.
 */
@Override public SecureStoreData getSecureData(String namespace,String name) throws Exception {
  checkNamespaceExists(namespace);
  String keyName=getKeyName(namespace,name);
  KeyProvider.Metadata metadata=provider.getMetadata(keyName);
  SecureStoreMetadata meta=SecureStoreMetadata.of(name,metadata.getDescription(),metadata.getAttributes());
  KeyProvider.KeyVersion keyVersion=provider.getCurrentKey(keyName);
  return new SecureStoreData(meta,keyVersion.getMaterial());
}

Fixed version (ground truth):
/** 
 * Returns the data stored in the secure store. Makes two calls to the provider, one to get the metadata and another to get the data.
 * @param namespace The namespace this key belongs to.
 * @param name Name of the key.
 * @return An object representing the securely stored data associated with the name.
 * @throws NamespaceNotFoundException If the specified namespace does not exist.
 * @throws IOException If there was a problem getting the key or the metadata from the underlying key provider.
 */
@Override public SecureStoreData getSecureData(String namespace,String name) throws Exception {
  checkNamespaceExists(namespace);
  String keyName=getKeyName(namespace,name);
  KeyProvider.Metadata metadata=provider.getMetadata(keyName);
  if (metadata == null) {
    throw new NotFoundException(new SecureKeyId(namespace,name));
  }
  SecureStoreMetadata meta=SecureStoreMetadata.of(name,metadata.getDescription(),metadata.getAttributes());
  KeyProvider.KeyVersion keyVersion=provider.getCurrentKey(keyName);
  return new SecureStoreData(meta,keyVersion.getMaterial());
}
Program: 5980
Project: 5980
Buggy source:
private void revokeAndAssertSuccess(EntityId entityId,Principal principal,Set<Action> actions) throws Exception {
  Set<Privilege> existingPrivileges=authorizer.listPrivileges(principal);
  authorizer.revoke(entityId,principal,actions);
  for (  Action action : actions) {
    existingPrivileges.remove(new Privilege(entityId,action));
  }
  Assert.assertEquals(existingPrivileges,authorizer.listPrivileges(principal));
}

Fixed version (ground truth):
private void revokeAndAssertSuccess(EntityId entityId,Principal principal,Set<Action> actions) throws Exception {
  Set<Privilege> existingPrivileges=authorizer.listPrivileges(principal);
  authorizer.revoke(entityId,principal,actions);
  Set<Privilege> revokedPrivileges=new HashSet<>();
  for (  Action action : actions) {
    revokedPrivileges.add(new Privilege(entityId,action));
  }
  Assert.assertEquals(Sets.difference(existingPrivileges,revokedPrivileges),authorizer.listPrivileges(principal));
}
Program: 5981
Project: 5981
Buggy source:
private void revokeAndAssertSuccess(EntityId entityId,Principal principal,Set<Action> actions) throws Exception {
  Authorizer authorizer=getAuthorizer();
  Set<Privilege> existingPrivileges=authorizer.listPrivileges(principal);
  authorizer.revoke(entityId,principal,actions);
  for (  Action action : actions) {
    existingPrivileges.remove(new Privilege(entityId,action));
  }
  Assert.assertEquals(existingPrivileges,authorizer.listPrivileges(principal));
}

Fixed version (ground truth):
private void revokeAndAssertSuccess(EntityId entityId,Principal principal,Set<Action> actions) throws Exception {
  Authorizer authorizer=getAuthorizer();
  Set<Privilege> existingPrivileges=authorizer.listPrivileges(principal);
  authorizer.revoke(entityId,principal,actions);
  Set<Privilege> revokedPrivileges=new HashSet<>();
  for (  Action action : actions) {
    revokedPrivileges.add(new Privilege(entityId,action));
  }
  Assert.assertEquals(Sets.difference(existingPrivileges,revokedPrivileges),authorizer.listPrivileges(principal));
}
Program: 5983
Project: 5983
Buggy source:
@Test public void testHierarchy() throws Exception {
  Authorizer authorizer=get();
  DatasetId dataset=namespace.dataset("String_Node_Str");
  verifyAuthFailure(namespace,user,Action.READ);
  authorizer.grant(namespace,user,Collections.singleton(Action.READ));
  authorizer.enforce(dataset,user,Action.READ);
  authorizer.grant(dataset,user,Collections.singleton(Action.WRITE));
  verifyAuthFailure(namespace,user,Action.WRITE);
  authorizer.revoke(namespace,user,Collections.singleton(Action.READ));
  authorizer.revoke(dataset);
  verifyAuthFailure(namespace,user,Action.READ);
}

Fixed version (ground truth):
@Test @Ignore public void testHierarchy() throws Exception {
  Authorizer authorizer=get();
  DatasetId dataset=namespace.dataset("String_Node_Str");
  verifyAuthFailure(namespace,user,Action.READ);
  authorizer.grant(namespace,user,Collections.singleton(Action.READ));
  authorizer.enforce(dataset,user,Action.READ);
  authorizer.grant(dataset,user,Collections.singleton(Action.WRITE));
  verifyAuthFailure(namespace,user,Action.WRITE);
  authorizer.revoke(namespace,user,Collections.singleton(Action.READ));
  authorizer.revoke(dataset);
  verifyAuthFailure(namespace,user,Action.READ);
}
Program: 5984
Project: 5984
Buggy source:
@AfterClass public static void cleanup(){
  appFabricServer.stopAndWait();
  remoteSystemOperationsService.stopAndWait();
  authorizationEnforcementService.stopAndWait();
}

Fixed version (ground truth):
@AfterClass public static void cleanup(){
  appFabricServer.stopAndWait();
  authorizationEnforcementService.stopAndWait();
}
Program: 5985
Project: 5985
Buggy source:
@BeforeClass public static void setup() throws Exception {
  CConfiguration cConf=createCConf();
  SConfiguration sConf=SConfiguration.create();
  sConf.set(Constants.Security.Store.FILE_PASSWORD,"String_Node_Str");
  final Injector injector=Guice.createInjector(new AppFabricTestModule(cConf,sConf));
  injector.getInstance(TransactionManager.class).startAndWait();
  injector.getInstance(DatasetOpExecutor.class).startAndWait();
  injector.getInstance(DatasetService.class).startAndWait();
  appFabricServer=injector.getInstance(AppFabricServer.class);
  appFabricServer.startAndWait();
  authorizationEnforcementService=injector.getInstance(AuthorizationEnforcementService.class);
  authorizationEnforcementService.startAndWait();
  remoteSystemOperationsService=injector.getInstance(RemoteSystemOperationsService.class);
  remoteSystemOperationsService.startAndWait();
  secureStoreService=injector.getInstance(SecureStoreService.class);
  authorizer=injector.getInstance(AuthorizerInstantiator.class).get();
  SecurityRequestContext.setUserId(ALICE.getName());
  secureStoreService=injector.getInstance(SecureStoreService.class);
  authorizer.grant(NamespaceId.DEFAULT,ALICE,Collections.singleton(Action.READ));
  Tasks.waitFor(true,new Callable<Boolean>(){
    @Override public Boolean call() throws Exception {
      return injector.getInstance(NamespaceAdmin.class).exists(Id.Namespace.DEFAULT);
    }
  }
,5,TimeUnit.SECONDS);
  authorizer.revoke(NamespaceId.DEFAULT,ALICE,Collections.singleton(Action.READ));
}

Fixed version (ground truth):
@BeforeClass public static void setup() throws Exception {
  SConfiguration sConf=SConfiguration.create();
  sConf.set(Constants.Security.Store.FILE_PASSWORD,"String_Node_Str");
  final Injector injector=Guice.createInjector(new AppFabricTestModule(createCConf(),sConf));
  injector.getInstance(TransactionManager.class).startAndWait();
  injector.getInstance(DatasetOpExecutor.class).startAndWait();
  discoveryServiceClient=injector.getInstance(DiscoveryServiceClient.class);
  DatasetService datasetService=injector.getInstance(DatasetService.class);
  datasetService.startAndWait();
  waitForService(Constants.Service.DATASET_EXECUTOR);
  appFabricServer=injector.getInstance(AppFabricServer.class);
  appFabricServer.startAndWait();
  authorizationEnforcementService=injector.getInstance(AuthorizationEnforcementService.class);
  authorizationEnforcementService.startAndWait();
  secureStoreService=injector.getInstance(SecureStoreService.class);
  authorizer=injector.getInstance(AuthorizerInstantiator.class).get();
  SecurityRequestContext.setUserId(ALICE.getName());
  secureStoreService=injector.getInstance(SecureStoreService.class);
  authorizer.grant(NamespaceId.DEFAULT,ALICE,Collections.singleton(Action.READ));
  Tasks.waitFor(true,new Callable<Boolean>(){
    @Override public Boolean call() throws Exception {
      return injector.getInstance(NamespaceAdmin.class).exists(Id.Namespace.DEFAULT);
    }
  }
,5,TimeUnit.SECONDS);
  authorizer.revoke(NamespaceId.DEFAULT,ALICE,Collections.singleton(Action.READ));
}
Program: 5986
Project: 5986
Buggy source:
/** 
 * Filter a list of   {@link ArtifactSummary} that ensures the logged-in user has a {@link Action privilege} on
 * @param artifacts the {@link List<ArtifactSummary>} to filter with
 * @param namespace namespace of the artifacts
 * @return filtered list of {@link ArtifactSummary}
 */
private List<ArtifactSummary> filterAuthorizedArtifacts(List<ArtifactSummary> artifacts,final NamespaceId namespace) throws Exception {
  final Predicate<EntityId> filter=authorizationEnforcer.createFilter(authenticationContext.getPrincipal());
  return Lists.newArrayList(Iterables.filter(artifacts,new com.google.common.base.Predicate<ArtifactSummary>(){
    @Override public boolean apply(    ArtifactSummary artifactSummary){
      return filter.apply(namespace.artifact(artifactSummary.getName(),artifactSummary.getVersion()));
    }
  }
));
}

Fixed version (ground truth):
/** 
 * Filter a list of   {@link ArtifactSummary} that ensures the logged-in user has a {@link Action privilege} on
 * @param artifacts the {@link List<ArtifactSummary>} to filter with
 * @param namespace namespace of the artifacts
 * @return filtered list of {@link ArtifactSummary}
 */
private List<ArtifactSummary> filterAuthorizedArtifacts(List<ArtifactSummary> artifacts,final NamespaceId namespace) throws Exception {
  final Predicate<EntityId> filter=authorizationEnforcer.createFilter(authenticationContext.getPrincipal());
  return Lists.newArrayList(Iterables.filter(artifacts,new com.google.common.base.Predicate<ArtifactSummary>(){
    @Override public boolean apply(    ArtifactSummary artifactSummary){
      return ArtifactScope.SYSTEM.equals(artifactSummary.getScope()) || filter.apply(namespace.artifact(artifactSummary.getName(),artifactSummary.getVersion()));
    }
  }
));
}
Program: 5987
Project: 5987
Buggy source:
@Override public boolean apply(ArtifactSummary artifactSummary){
  return filter.apply(namespace.artifact(artifactSummary.getName(),artifactSummary.getVersion()));
}

Fixed version (ground truth):
@Override public boolean apply(ArtifactSummary artifactSummary){
  return ArtifactScope.SYSTEM.equals(artifactSummary.getScope()) || filter.apply(namespace.artifact(artifactSummary.getName(),artifactSummary.getVersion()));
}
Program: 5988
Project: 5988
Buggy source:
@AfterClass public static void cleanup() throws Exception {
  authorizer.revoke(instance);
  authEnforcerService.stopAndWait();
  Assert.assertEquals(ImmutableSet.<Privilege>of(),authorizer.listPrivileges(ALICE));
  SecurityRequestContext.setUserId(OLD_USER_ID);
}

Fixed version (ground truth):
@AfterClass public static void cleanup() throws Exception {
  authorizer.revoke(instance);
  authEnforcerService.stopAndWait();
  Assert.assertEquals(Collections.emptySet(),authorizer.listPrivileges(ALICE));
  SecurityRequestContext.setUserId(OLD_USER_ID);
}
Program: 5989
Project: 5989
Buggy source:
@BeforeClass public static void setup() throws Exception {
  CConfiguration cConf=CConfiguration.create();
  cConf.set(Constants.CFG_LOCAL_DATA_DIR,TMP_FOLDER.newFolder().getAbsolutePath());
  cConf.setBoolean(Constants.Security.ENABLED,true);
  cConf.setBoolean(Constants.Security.Authorization.ENABLED,true);
  cConf.setBoolean(Constants.Security.KERBEROS_ENABLED,false);
  cConf.setBoolean(Constants.Security.Authorization.CACHE_ENABLED,false);
  Location deploymentJar=AppJarHelper.createDeploymentJar(new LocalLocationFactory(TMP_FOLDER.newFolder()),InMemoryAuthorizer.class);
  cConf.set(Constants.Security.Authorization.EXTENSION_JAR_PATH,deploymentJar.toURI().getPath());
  cConf.set(Constants.Security.Authorization.SUPERUSERS,"String_Node_Str");
  Injector injector=AppFabricTestHelper.getInjector(cConf);
  artifactRepository=injector.getInstance(ArtifactRepository.class);
  AuthorizerInstantiator instantiatorService=injector.getInstance(AuthorizerInstantiator.class);
  authorizer=instantiatorService.get();
  authEnforcerService=injector.getInstance(AuthorizationEnforcementService.class);
  authEnforcerService.startAndWait();
  instance=new InstanceId(cConf.get(Constants.INSTANCE_NAME));
}

Fixed version (ground truth):
@BeforeClass public static void setup() throws Exception {
  CConfiguration cConf=CConfiguration.create();
  cConf.set(Constants.CFG_LOCAL_DATA_DIR,TMP_FOLDER.newFolder().getAbsolutePath());
  cConf.setBoolean(Constants.Security.ENABLED,true);
  cConf.setBoolean(Constants.Security.Authorization.ENABLED,true);
  cConf.setBoolean(Constants.Security.KERBEROS_ENABLED,false);
  cConf.setBoolean(Constants.Security.Authorization.CACHE_ENABLED,false);
  Location deploymentJar=AppJarHelper.createDeploymentJar(new LocalLocationFactory(TMP_FOLDER.newFolder()),InMemoryAuthorizer.class);
  cConf.set(Constants.Security.Authorization.EXTENSION_JAR_PATH,deploymentJar.toURI().getPath());
  cConf.set(Constants.Security.Authorization.SUPERUSERS,"String_Node_Str");
  File systemArtifactsDir=TMP_FOLDER.newFolder();
  cConf.set(Constants.AppFabric.SYSTEM_ARTIFACTS_DIR,systemArtifactsDir.getAbsolutePath());
  createSystemArtifact(systemArtifactsDir);
  Injector injector=AppFabricTestHelper.getInjector(cConf);
  artifactRepository=injector.getInstance(ArtifactRepository.class);
  AuthorizerInstantiator instantiatorService=injector.getInstance(AuthorizerInstantiator.class);
  authorizer=instantiatorService.get();
  authEnforcerService=injector.getInstance(AuthorizationEnforcementService.class);
  authEnforcerService.startAndWait();
  instance=new InstanceId(cConf.get(Constants.INSTANCE_NAME));
  namespaceAdmin=injector.getInstance(NamespaceAdmin.class);
}
Program: 5990
Project: 5990
Buggy source:
@Test public void testAuthorizationForSystemArtifacts() throws Exception {
  SecurityRequestContext.setUserId(Principal.SYSTEM.getName());
  artifactRepository.addSystemArtifacts();
  SecurityRequestContext.setUserId(ALICE.getName());
  try {
    artifactRepository.addSystemArtifacts();
    Assert.fail("String_Node_Str" + "String_Node_Str");
  }
 catch (  UnauthorizedException expected) {
  }
  authorizer.grant(instance,ALICE,Collections.singleton(Action.WRITE));
  Assert.assertEquals(Collections.singleton(new Privilege(instance,Action.WRITE)),authorizer.listPrivileges(ALICE));
  artifactRepository.addSystemArtifacts();
  ArtifactId systemArtifact=NamespaceId.SYSTEM.artifact("String_Node_Str","String_Node_Str");
  try {
    artifactRepository.deleteArtifact(systemArtifact.toId());
    Assert.fail("String_Node_Str" + "String_Node_Str");
  }
 catch (  UnauthorizedException expected) {
  }
  authorizer.grant(instance,ALICE,Collections.singleton(Action.ADMIN));
  Assert.assertEquals(ImmutableSet.of(new Privilege(instance,Action.WRITE),new Privilege(instance,Action.ADMIN)),authorizer.listPrivileges(ALICE));
  artifactRepository.deleteArtifact(systemArtifact.toId());
}

Fixed version (ground truth):
@Test public void testAuthorizationForSystemArtifacts() throws Exception {
  SecurityRequestContext.setUserId(Principal.SYSTEM.getName());
  artifactRepository.addSystemArtifacts();
  SecurityRequestContext.setUserId(ALICE.getName());
  try {
    artifactRepository.addSystemArtifacts();
    Assert.fail("String_Node_Str" + "String_Node_Str");
  }
 catch (  UnauthorizedException expected) {
  }
  authorizer.grant(instance,ALICE,Collections.singleton(Action.WRITE));
  Assert.assertEquals(Collections.singleton(new Privilege(instance,Action.WRITE)),authorizer.listPrivileges(ALICE));
  artifactRepository.addSystemArtifacts();
  try {
    artifactRepository.deleteArtifact(SYSTEM_ARTIFACT.toId());
    Assert.fail("String_Node_Str" + "String_Node_Str");
  }
 catch (  UnauthorizedException expected) {
  }
  authorizer.grant(instance,ALICE,Collections.singleton(Action.ADMIN));
  NamespaceId namespaceId=new NamespaceId("String_Node_Str");
  namespaceAdmin.create(new NamespaceMeta.Builder().setName(namespaceId.getNamespace()).build());
  authorizer.revoke(instance);
  List<ArtifactSummary> artifacts=artifactRepository.getArtifacts(namespaceId,true);
  Assert.assertEquals(1,artifacts.size());
  ArtifactSummary artifactSummary=artifacts.get(0);
  Assert.assertTrue(SYSTEM_ARTIFACT.getArtifact().equals(artifactSummary.getName()));
  Assert.assertTrue(SYSTEM_ARTIFACT.getVersion().equals(artifactSummary.getVersion()));
  Assert.assertTrue(SYSTEM_ARTIFACT.getNamespace().equals(artifactSummary.getScope().name().toLowerCase()));
  namespaceAdmin.delete(namespaceId.toId());
  Assert.assertEquals(Collections.emptySet(),authorizer.listPrivileges(ALICE));
  authorizer.grant(instance,ALICE,Collections.singleton(Action.ADMIN));
  artifactRepository.deleteArtifact(SYSTEM_ARTIFACT.toId());
}
Program: 5991
Project: 5991
Buggy source:
protected void assertProgramStatus(ProgramClient programClient,Id.Program programId,String programStatus) throws IOException, ProgramNotFoundException, UnauthenticatedException {
  assertProgramStatus(programClient,programId,programStatus,180);
}

Fixed version (ground truth):
protected void assertProgramStatus(ProgramClient programClient,Id.Program programId,String programStatus) throws IOException, ProgramNotFoundException, UnauthenticatedException, UnauthorizedException {
  assertProgramStatus(programClient,programId,programStatus,180);
}
Program: 5992
Project: 5992
Buggy source:
private void checkConnection(ClientConfig baseClientConfig,ConnectionConfig connectionInfo,AccessToken accessToken) throws IOException, UnauthenticatedException {
  ClientConfig clientConfig=new ClientConfig.Builder(baseClientConfig).setConnectionConfig(connectionInfo).setAccessToken(accessToken).build();
  MetaClient metaClient=new MetaClient(clientConfig);
  try {
    metaClient.ping();
  }
 catch (  IOException e) {
    throw new IOException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private void checkConnection(ClientConfig baseClientConfig,ConnectionConfig connectionInfo,AccessToken accessToken) throws IOException, UnauthenticatedException, UnauthorizedException {
  ClientConfig clientConfig=new ClientConfig.Builder(baseClientConfig).setConnectionConfig(connectionInfo).setAccessToken(accessToken).build();
  MetaClient metaClient=new MetaClient(clientConfig);
  try {
    metaClient.ping();
  }
 catch (  IOException e) {
    throw new IOException("String_Node_Str",e);
  }
}
Program: 5993
Project: 5993
Buggy source:
@Nullable private UserAccessToken acquireAccessToken(ClientConfig clientConfig,ConnectionConfig connectionInfo,PrintStream output,boolean debug) throws IOException {
  if (!isAuthenticationEnabled(connectionInfo)) {
    return null;
  }
  try {
    UserAccessToken savedToken=getSavedAccessToken(connectionInfo.getHostname());
    if (savedToken == null) {
      throw new UnauthenticatedException();
    }
    checkConnection(clientConfig,connectionInfo,savedToken.getAccessToken());
    return savedToken;
  }
 catch (  UnauthenticatedException ignored) {
  }
  return getNewAccessToken(connectionInfo,output,debug);
}

Fixed version (ground truth):
@Nullable private UserAccessToken acquireAccessToken(ClientConfig clientConfig,ConnectionConfig connectionInfo,PrintStream output,boolean debug) throws IOException, UnauthorizedException {
  if (!isAuthenticationEnabled(connectionInfo)) {
    return null;
  }
  try {
    UserAccessToken savedToken=getSavedAccessToken(connectionInfo.getHostname());
    if (savedToken == null) {
      throw new UnauthenticatedException();
    }
    checkConnection(clientConfig,connectionInfo,savedToken.getAccessToken());
    return savedToken;
  }
 catch (  UnauthenticatedException ignored) {
  }
  return getNewAccessToken(connectionInfo,output,debug);
}
Program: 5994
Project: 5994
Buggy source:
private Map<String,String> parsePreferences(String[] programIdParts) throws IOException, UnauthenticatedException, NotFoundException {
switch (type) {
case INSTANCE:
    checkInputLength(programIdParts,0);
  return client.getInstancePreferences();
case NAMESPACE:
checkInputLength(programIdParts,0);
return client.getNamespacePreferences(cliConfig.getCurrentNamespace(),resolved);
case APP:
return client.getApplicationPreferences(parseAppId(programIdParts),resolved);
case FLOW:
case MAPREDUCE:
case WORKFLOW:
case SERVICE:
case SPARK:
return client.getProgramPreferences(parseProgramId(programIdParts,type.getProgramType()),resolved);
default :
throw new IllegalArgumentException("String_Node_Str" + type.getShortName());
}
}

Fixed version (ground truth):
private Map<String,String> parsePreferences(String[] programIdParts) throws IOException, UnauthenticatedException, NotFoundException, UnauthorizedException {
switch (type) {
case INSTANCE:
    checkInputLength(programIdParts,0);
  return client.getInstancePreferences();
case NAMESPACE:
checkInputLength(programIdParts,0);
return client.getNamespacePreferences(cliConfig.getCurrentNamespace(),resolved);
case APP:
return client.getApplicationPreferences(parseAppId(programIdParts),resolved);
case FLOW:
case MAPREDUCE:
case WORKFLOW:
case SERVICE:
case SPARK:
return client.getProgramPreferences(parseProgramId(programIdParts,type.getProgramType()),resolved);
default :
throw new IllegalArgumentException("String_Node_Str" + type.getShortName());
}
}
Program: 5995
Project: 5995
Buggy source:
private Table getWorkflowLocalDatasets(ProgramRunId programRunId) throws UnauthenticatedException, IOException, NotFoundException {
  Map<String,DatasetSpecificationSummary> workflowLocalDatasets=workflowClient.getWorkflowLocalDatasets(programRunId);
  List<Map.Entry<String,DatasetSpecificationSummary>> localDatasetSummaries=new ArrayList<>();
  localDatasetSummaries.addAll(workflowLocalDatasets.entrySet());
  return Table.builder().setHeader("String_Node_Str","String_Node_Str","String_Node_Str").setRows(localDatasetSummaries,new RowMaker<Map.Entry<String,DatasetSpecificationSummary>>(){
    @Override public List<?> makeRow(    Map.Entry<String,DatasetSpecificationSummary> object){
      return Lists.newArrayList(object.getKey(),object.getValue().getName(),object.getValue().getType());
    }
  }
).build();
}

Fixed version (ground truth):
private Table getWorkflowLocalDatasets(ProgramRunId programRunId) throws UnauthenticatedException, IOException, NotFoundException, UnauthorizedException {
  Map<String,DatasetSpecificationSummary> workflowLocalDatasets=workflowClient.getWorkflowLocalDatasets(programRunId);
  List<Map.Entry<String,DatasetSpecificationSummary>> localDatasetSummaries=new ArrayList<>();
  localDatasetSummaries.addAll(workflowLocalDatasets.entrySet());
  return Table.builder().setHeader("String_Node_Str","String_Node_Str","String_Node_Str").setRows(localDatasetSummaries,new RowMaker<Map.Entry<String,DatasetSpecificationSummary>>(){
    @Override public List<?> makeRow(    Map.Entry<String,DatasetSpecificationSummary> object){
      return Lists.newArrayList(object.getKey(),object.getValue().getName(),object.getValue().getType());
    }
  }
).build();
}
Program: 5996
Project: 5996
Buggy source:
private Table getWorkflowNodeStates(ProgramRunId programRunId) throws UnauthenticatedException, IOException, NotFoundException {
  Map<String,WorkflowNodeStateDetail> workflowNodeStates=workflowClient.getWorkflowNodeStates(programRunId);
  List<Map.Entry<String,WorkflowNodeStateDetail>> nodeStates=new ArrayList<>();
  nodeStates.addAll(workflowNodeStates.entrySet());
  return Table.builder().setHeader("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str").setRows(nodeStates,new RowMaker<Map.Entry<String,WorkflowNodeStateDetail>>(){
    @Override public List<?> makeRow(    Map.Entry<String,WorkflowNodeStateDetail> object){
      return Lists.newArrayList(object.getValue().getNodeId(),object.getValue().getNodeStatus(),object.getValue().getRunId(),object.getValue().getFailureCause());
    }
  }
).build();
}

Fixed version (ground truth):
private Table getWorkflowNodeStates(ProgramRunId programRunId) throws UnauthenticatedException, IOException, NotFoundException, UnauthorizedException {
  Map<String,WorkflowNodeStateDetail> workflowNodeStates=workflowClient.getWorkflowNodeStates(programRunId);
  List<Map.Entry<String,WorkflowNodeStateDetail>> nodeStates=new ArrayList<>();
  nodeStates.addAll(workflowNodeStates.entrySet());
  return Table.builder().setHeader("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str").setRows(nodeStates,new RowMaker<Map.Entry<String,WorkflowNodeStateDetail>>(){
    @Override public List<?> makeRow(    Map.Entry<String,WorkflowNodeStateDetail> object){
      return Lists.newArrayList(object.getValue().getNodeId(),object.getValue().getNodeStatus(),object.getValue().getRunId(),object.getValue().getFailureCause());
    }
  }
).build();
}
Program: 5997
Project: 5997
Buggy source:
private Table getWorkflowToken(Id.Run runId,WorkflowToken.Scope workflowTokenScope,String key,String nodeName) throws UnauthenticatedException, IOException, NotFoundException {
  WorkflowTokenNodeDetail workflowToken=workflowClient.getWorkflowTokenAtNode(runId,nodeName,workflowTokenScope,key);
  List<Map.Entry<String,String>> tokenKeys=new ArrayList<>();
  tokenKeys.addAll(workflowToken.getTokenDataAtNode().entrySet());
  return Table.builder().setHeader("String_Node_Str","String_Node_Str").setRows(tokenKeys,new RowMaker<Map.Entry<String,String>>(){
    @Override public List<?> makeRow(    Map.Entry<String,String> object){
      return Lists.newArrayList(object.getKey(),object.getValue());
    }
  }
).build();
}

Fixed version (ground truth):
private Table getWorkflowToken(Id.Run runId,WorkflowToken.Scope workflowTokenScope,String key,String nodeName) throws UnauthenticatedException, IOException, NotFoundException, UnauthorizedException {
  WorkflowTokenNodeDetail workflowToken=workflowClient.getWorkflowTokenAtNode(runId,nodeName,workflowTokenScope,key);
  List<Map.Entry<String,String>> tokenKeys=new ArrayList<>();
  tokenKeys.addAll(workflowToken.getTokenDataAtNode().entrySet());
  return Table.builder().setHeader("String_Node_Str","String_Node_Str").setRows(tokenKeys,new RowMaker<Map.Entry<String,String>>(){
    @Override public List<?> makeRow(    Map.Entry<String,String> object){
      return Lists.newArrayList(object.getKey(),object.getValue());
    }
  }
).build();
}
Program: 5998
Project: 5998
Buggy source:
/** 
 * Reads arguments to get app id, program types, and list of input programs.
 */
protected Args<T> readArgs(Arguments arguments) throws ApplicationNotFoundException, UnauthenticatedException, IOException {
  String appName=arguments.get(ArgumentName.APP.getName());
  Id.Application appId=Id.Application.from(cliConfig.getCurrentNamespace(),appName);
  Set<ProgramType> programTypes=getDefaultProgramTypes();
  if (arguments.hasArgument(ArgumentName.PROGRAM_TYPES.getName())) {
    programTypes.clear();
    String programTypesStr=arguments.get(ArgumentName.PROGRAM_TYPES.getName());
    for (    String programTypeStr : Splitter.on(',').trimResults().split(programTypesStr)) {
      ProgramType programType=ProgramType.valueOf(programTypeStr.toUpperCase());
      programTypes.add(programType);
    }
  }
  List<T> programs=new ArrayList<>();
  Map<ProgramType,List<ProgramRecord>> appPrograms=appClient.listProgramsByType(appId);
  for (  ProgramType programType : programTypes) {
    List<ProgramRecord> programRecords=appPrograms.get(programType);
    if (programRecords != null) {
      for (      ProgramRecord programRecord : programRecords) {
        programs.add(createProgram(programRecord));
      }
    }
  }
  return new Args<>(appId,programTypes,programs);
}

Fixed version (ground truth):
/** 
 * Reads arguments to get app id, program types, and list of input programs.
 */
protected Args<T> readArgs(Arguments arguments) throws ApplicationNotFoundException, UnauthenticatedException, IOException, UnauthorizedException {
  String appName=arguments.get(ArgumentName.APP.getName());
  Id.Application appId=Id.Application.from(cliConfig.getCurrentNamespace(),appName);
  Set<ProgramType> programTypes=getDefaultProgramTypes();
  if (arguments.hasArgument(ArgumentName.PROGRAM_TYPES.getName())) {
    programTypes.clear();
    String programTypesStr=arguments.get(ArgumentName.PROGRAM_TYPES.getName());
    for (    String programTypeStr : Splitter.on(',').trimResults().split(programTypesStr)) {
      ProgramType programType=ProgramType.valueOf(programTypeStr.toUpperCase());
      programTypes.add(programType);
    }
  }
  List<T> programs=new ArrayList<>();
  Map<ProgramType,List<ProgramRecord>> appPrograms=appClient.listProgramsByType(appId);
  for (  ProgramType programType : programTypes) {
    List<ProgramRecord> programRecords=appPrograms.get(programType);
    if (programRecords != null) {
      for (      ProgramRecord programRecord : programRecords) {
        programs.add(createProgram(programRecord));
      }
    }
  }
  return new Args<>(appId,programTypes,programs);
}
Program: 5999
Project: 5999
Buggy source:
@Override public Collection<String> get(){
  try {
    List<ApplicationRecord> appsList=applicationClient.list(cliConfig.getCurrentNamespace());
    List<String> appIds=Lists.newArrayList();
    for (    ApplicationRecord item : appsList) {
      appIds.add(item.getName());
    }
    return appIds;
  }
 catch (  IOException e) {
    return Lists.newArrayList();
  }
catch (  UnauthenticatedException e) {
    return Lists.newArrayList();
  }
}

Fixed version (ground truth):
@Override public Collection<String> get(){
  try {
    List<ApplicationRecord> appsList=applicationClient.list(cliConfig.getCurrentNamespace());
    List<String> appIds=new ArrayList<>();
    for (    ApplicationRecord item : appsList) {
      appIds.add(item.getName());
    }
    return appIds;
  }
 catch (  IOException|UnauthenticatedException|UnauthorizedException e) {
    return new ArrayList<>();
  }
}
Program: 6000
Project: 6000
Buggy source:
@Inject public AppIdCompleter(final ApplicationClient applicationClient,final CLIConfig cliConfig){
  super(new Supplier<Collection<String>>(){
    @Override public Collection<String> get(){
      try {
        List<ApplicationRecord> appsList=applicationClient.list(cliConfig.getCurrentNamespace());
        List<String> appIds=Lists.newArrayList();
        for (        ApplicationRecord item : appsList) {
          appIds.add(item.getName());
        }
        return appIds;
      }
 catch (      IOException e) {
        return Lists.newArrayList();
      }
catch (      UnauthenticatedException e) {
        return Lists.newArrayList();
      }
    }
  }
);
}

Fixed version (ground truth):
@Inject public AppIdCompleter(final ApplicationClient applicationClient,final CLIConfig cliConfig){
  super(new Supplier<Collection<String>>(){
    @Override public Collection<String> get(){
      try {
        List<ApplicationRecord> appsList=applicationClient.list(cliConfig.getCurrentNamespace());
        List<String> appIds=new ArrayList<>();
        for (        ApplicationRecord item : appsList) {
          appIds.add(item.getName());
        }
        return appIds;
      }
 catch (      IOException|UnauthenticatedException|UnauthorizedException e) {
        return new ArrayList<>();
      }
    }
  }
);
}
Program: 6001
Project: 6001
Buggy source:
@Override public Collection<String> get(){
  try {
    List<DatasetModuleMeta> list=datasetModuleClient.list(cliConfig.getCurrentNamespace());
    return Lists.newArrayList(Iterables.transform(list,new Function<DatasetModuleMeta,String>(){
      @Override public String apply(      DatasetModuleMeta input){
        return input.getName();
      }
    }
));
  }
 catch (  IOException e) {
    return Lists.newArrayList();
  }
catch (  UnauthenticatedException e) {
    return Lists.newArrayList();
  }
}

Fixed version (ground truth):
@Override public Collection<String> get(){
  try {
    List<DatasetModuleMeta> list=datasetModuleClient.list(cliConfig.getCurrentNamespace());
    return Lists.newArrayList(Iterables.transform(list,new Function<DatasetModuleMeta,String>(){
      @Override public String apply(      DatasetModuleMeta input){
        return input.getName();
      }
    }
));
  }
 catch (  IOException|UnauthenticatedException|UnauthorizedException e) {
    return new ArrayList<>();
  }
}