nus-yam/ex-repair huggingface dataset:
Program: 6039
Project: 6039
Buggy source:
@VisibleForTesting static Injector createInjector(CConfiguration cConf,Configuration hConf){
  return Guice.createInjector(new ConfigModule(cConf,hConf),new IOModule(),new ZKClientModule(),new KafkaClientModule(),new MetricsClientRuntimeModule().getDistributedModules(),new DiscoveryRuntimeModule().getDistributedModules(),new LocationRuntimeModule().getDistributedModules(),new NamespaceClientRuntimeModule().getDistributedModules(),new DataFabricModules().getDistributedModules(),new DataSetsModules().getDistributedModules(),new LoggingModules().getDistributedModules(),new ExploreRuntimeModule().getDistributedModules(),new ExploreClientModule(),new ViewAdminModules().getDistributedModules(),new StreamAdminModules().getDistributedModules(),new NotificationFeedClientModule(),new AuditModule().getDistributedModules(),new AuthorizationEnforcementModule().getDistributedModules(),new AuthenticationContextModules().getMasterModule(),new SecureStoreModules().getDistributedModules(),new AuthorizationEnforcementModule().getDistributedModules(),new AuthorizationModule(),new AbstractModule(){
    @Override protected void configure(){
      bind(Store.class).to(DefaultStore.class);
      bind(NamespaceStore.class).to(DefaultNamespaceStore.class);
      bind(UGIProvider.class).to(RemoteUGIProvider.class).in(Scopes.SINGLETON);
    }
  }
);
}

Fixed version (ground truth):
@VisibleForTesting static Injector createInjector(CConfiguration cConf,Configuration hConf){
  return Guice.createInjector(new ConfigModule(cConf,hConf),new IOModule(),new ZKClientModule(),new KafkaClientModule(),new MetricsClientRuntimeModule().getDistributedModules(),new DiscoveryRuntimeModule().getDistributedModules(),new LocationRuntimeModule().getDistributedModules(),new NamespaceClientRuntimeModule().getDistributedModules(),new DataFabricModules().getDistributedModules(),new DataSetsModules().getDistributedModules(),new LoggingModules().getDistributedModules(),new ExploreRuntimeModule().getDistributedModules(),new ExploreClientModule(),new ViewAdminModules().getDistributedModules(),new StreamAdminModules().getDistributedModules(),new NotificationFeedClientModule(),new AuditModule().getDistributedModules(),new AuthenticationContextModules().getMasterModule(),new SecureStoreModules().getDistributedModules(),new AuthorizationEnforcementModule().getDistributedModules(),new AbstractModule(){
    @Override protected void configure(){
      bind(Store.class).to(DefaultStore.class);
      bind(NamespaceStore.class).to(DefaultNamespaceStore.class);
      bind(UGIProvider.class).to(RemoteUGIProvider.class).in(Scopes.SINGLETON);
      bind(PrivilegesManager.class).to(RemotePrivilegesManager.class);
    }
  }
);
}
Program: 6040
Project: 6040
Buggy source:
@Override protected void doInit(TwillContext context){
  CConfiguration cConf=getCConfiguration();
  Configuration hConf=getConfiguration();
  URL hiveSiteURL=getClass().getClassLoader().getResource("String_Node_Str");
  if (hiveSiteURL == null) {
    LOG.warn("String_Node_Str");
  }
 else {
    hConf.addResource(hiveSiteURL);
  }
  injector=createInjector(cConf,hConf);
  injector.getInstance(LogAppenderInitializer.class).initialize();
  LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(Id.Namespace.SYSTEM.getId(),Constants.Logging.COMPONENT_NAME,Constants.Service.EXPLORE_HTTP_USER_SERVICE));
  LOG.info("String_Node_Str",name);
  cConf.set(Constants.Explore.SERVER_ADDRESS,context.getHost().getHostName());
}

Fixed version (ground truth):
@Override protected void doInit(TwillContext context){
  CConfiguration cConf=getCConfiguration();
  Configuration hConf=getConfiguration();
  URL hiveSiteURL=getClass().getClassLoader().getResource("String_Node_Str");
  if (hiveSiteURL == null) {
    LOG.warn("String_Node_Str");
  }
 else {
    hConf.addResource(hiveSiteURL);
  }
  injector=createInjector(cConf,hConf);
  injector.getInstance(LogAppenderInitializer.class).initialize();
  LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(NamespaceId.SYSTEM.getNamespace(),Constants.Logging.COMPONENT_NAME,Constants.Service.EXPLORE_HTTP_USER_SERVICE));
  LOG.info("String_Node_Str",name);
  cConf.set(Constants.Explore.SERVER_ADDRESS,context.getHost().getHostName());
}
Program: 6041
Project: 6041
Buggy source:
@Override protected void configure(){
  bind(Store.class).to(DefaultStore.class);
  bind(NamespaceStore.class).to(DefaultNamespaceStore.class);
  bind(UGIProvider.class).to(RemoteUGIProvider.class).in(Scopes.SINGLETON);
}

Fixed version (ground truth):
@Override protected void configure(){
  bind(Store.class).to(DefaultStore.class);
  bind(NamespaceStore.class).to(DefaultNamespaceStore.class);
  bind(UGIProvider.class).to(RemoteUGIProvider.class).in(Scopes.SINGLETON);
  bind(PrivilegesManager.class).to(RemotePrivilegesManager.class);
}
Program: 6042
Project: 6042
Buggy source:
/** 
 * Stores an element in the secure store.
 * @param namespace The namespace that this key belongs to.
 * @param name This is the identifier that will be used to retrieve this element.
 * @param data The sensitive data that has to be securely stored. Passed in as utf-8 formatted byte array.
 * @param description User provided description of the entry.
 * @param properties associated with this element.
 * @throws IOException If the attempt to store the element failed.
 * @throws Exception If the specified namespace does not exist or the name already exists. Updating is not supported.
 */
void putSecureData(String namespace,String name,byte[] data,String description,Map<String,String> properties) throws Exception ;

Fixed version (ground truth):
/** 
 * Stores an element in the secure store.
 * @param namespace The namespace that this key belongs to.
 * @param name This is the identifier that will be used to retrieve this element.
 * @param data The sensitive data that has to be securely stored
 * @param description User provided description of the entry.
 * @param properties associated with this element.
 * @throws IOException If the attempt to store the element failed.
 * @throws Exception If the specified namespace does not exist or the name already exists. Updating is not supported.
 */
void putSecureData(String namespace,String name,String data,String description,Map<String,String> properties) throws Exception ;
Program: 6043
Project: 6043
Buggy source:
@Override public void putSecureData(String namespace,String name,byte[] data,String description,Map<String,String> properties) throws Exception {
  secureStoreManager.putSecureData(namespace,name,data,description,properties);
}

Fixed version (ground truth):
@Override public void putSecureData(String namespace,String name,String data,String description,Map<String,String> properties) throws Exception {
  secureStoreManager.putSecureData(namespace,name,data,description,properties);
}
Program: 6045
Project: 6045
Buggy source:
@Override public void run(JavaSparkExecutionContext sec) throws Exception {
  final SecureStore secureStore=sec.getSecureStore();
  sec.getAdmin().putSecureData(NAMESPACE,KEY,VALUE.getBytes(),"String_Node_Str",new HashMap<String,String>());
  Assert.assertEquals(new String(sec.getSecureData(NAMESPACE,KEY).get()),VALUE);
  Assert.assertEquals(new String(secureStore.getSecureData(NAMESPACE,KEY).get()),VALUE);
  sec.listSecureData(NAMESPACE);
  JavaSparkContext jsc=new JavaSparkContext();
  JavaPairRDD<Long,String> rdd=sec.fromStream(STREAM_NAME,String.class);
  JavaPairRDD<byte[],byte[]> resultRDD=rdd.mapToPair(new PairFunction<Tuple2<Long,String>,byte[],byte[]>(){
    @Override public Tuple2<byte[],byte[]> call(    Tuple2<Long,String> tuple2) throws Exception {
      return new Tuple2<>(Bytes.toBytes(tuple2._2()),secureStore.getSecureData(NAMESPACE,KEY).get());
    }
  }
);
  sec.saveAsDataset(resultRDD,"String_Node_Str");
  sec.getAdmin().deleteSecureData(NAMESPACE,KEY);
}

Fixed version (ground truth):
@Override public void run(JavaSparkExecutionContext sec) throws Exception {
  final SecureStore secureStore=sec.getSecureStore();
  sec.getAdmin().putSecureData(NAMESPACE,KEY,VALUE,"String_Node_Str",new HashMap<String,String>());
  Assert.assertEquals(new String(sec.getSecureData(NAMESPACE,KEY).get()),VALUE);
  Assert.assertEquals(new String(secureStore.getSecureData(NAMESPACE,KEY).get()),VALUE);
  sec.listSecureData(NAMESPACE);
  JavaSparkContext jsc=new JavaSparkContext();
  JavaPairRDD<Long,String> rdd=sec.fromStream(STREAM_NAME,String.class);
  JavaPairRDD<byte[],byte[]> resultRDD=rdd.mapToPair(new PairFunction<Tuple2<Long,String>,byte[],byte[]>(){
    @Override public Tuple2<byte[],byte[]> call(    Tuple2<Long,String> tuple2) throws Exception {
      return new Tuple2<>(Bytes.toBytes(tuple2._2()),secureStore.getSecureData(NAMESPACE,KEY).get());
    }
  }
);
  sec.saveAsDataset(resultRDD,"String_Node_Str");
  sec.getAdmin().deleteSecureData(NAMESPACE,KEY);
}
Program: 6046
Project: 6046
Buggy source:
@Path("String_Node_Str") @PUT public void put(HttpServiceRequest request,HttpServiceResponder responder) throws Exception {
  byte[] value=new byte[request.getContent().remaining()];
  request.getContent().get(value);
  getContext().getAdmin().putSecureData(namespace,KEY,value,"String_Node_Str",new HashMap<String,String>());
  responder.sendStatus(200);
}

Fixed version (ground truth):
@Path("String_Node_Str") @PUT public void put(HttpServiceRequest request,HttpServiceResponder responder) throws Exception {
  byte[] value=new byte[request.getContent().remaining()];
  request.getContent().get(value);
  getContext().getAdmin().putSecureData(namespace,KEY,new String(value),"String_Node_Str",new HashMap<String,String>());
  responder.sendStatus(200);
}
Program: 6047
Project: 6047
Buggy source:
@Override public Admin getAdmin(){
  return new Admin(){
    @Override public boolean datasetExists(    String name){
      return false;
    }
    @Nullable @Override public String getDatasetType(    String name) throws InstanceNotFoundException {
      throw new InstanceNotFoundException(name);
    }
    @Nullable @Override public DatasetProperties getDatasetProperties(    String name) throws InstanceNotFoundException {
      throw new InstanceNotFoundException(name);
    }
    @Override public void createDataset(    String name,    String type,    DatasetProperties properties){
    }
    @Override public void updateDataset(    String name,    DatasetProperties properties){
    }
    @Override public void dropDataset(    String name){
    }
    @Override public void truncateDataset(    String name){
    }
    @Override public void putSecureData(    String namespace,    String name,    byte[] data,    String description,    Map<String,String> properties) throws Exception {
    }
    @Override public void deleteSecureData(    String namespace,    String name) throws Exception {
    }
  }
;
}

Fixed version (ground truth):
@Override public Admin getAdmin(){
  return new Admin(){
    @Override public boolean datasetExists(    String name){
      return false;
    }
    @Nullable @Override public String getDatasetType(    String name) throws InstanceNotFoundException {
      throw new InstanceNotFoundException(name);
    }
    @Nullable @Override public DatasetProperties getDatasetProperties(    String name) throws InstanceNotFoundException {
      throw new InstanceNotFoundException(name);
    }
    @Override public void createDataset(    String name,    String type,    DatasetProperties properties){
    }
    @Override public void updateDataset(    String name,    DatasetProperties properties){
    }
    @Override public void dropDataset(    String name){
    }
    @Override public void truncateDataset(    String name){
    }
    @Override public void putSecureData(    String namespace,    String name,    String data,    String description,    Map<String,String> properties) throws Exception {
    }
    @Override public void deleteSecureData(    String namespace,    String name) throws Exception {
    }
  }
;
}
Program: 6048
Project: 6048
Buggy source:
@Override public void putSecureData(String namespace,String name,byte[] data,String description,Map<String,String> properties) throws Exception {
}

Fixed version (ground truth):
@Override public void putSecureData(String namespace,String name,String data,String description,Map<String,String> properties) throws Exception {
}
Program: 6050
Project: 6050
Buggy source:
@Override public void putSecureData(String namespace,String name,byte[] data,String description,Map<String,String> properties) throws Exception {
  context.getAdmin().putSecureData(namespace,name,data,description,properties);
}

Fixed version (ground truth):
@Override public void putSecureData(String namespace,String name,String data,String description,Map<String,String> properties) throws Exception {
  context.getAdmin().putSecureData(namespace,name,data,description,properties);
}
Program: 6051
Project: 6051
Buggy source:
/** 
 * Stores an element in the secure store. The key is stored as namespace:name in the backing store, assuming ":" is the name separator.
 * @param namespace The namespace this key belongs to.
 * @param name Name of the element to store.
 * @param data The data that needs to be securely stored.
 * @param description User provided description of the entry.
 * @param properties Metadata associated with the data
 * @throws NamespaceNotFoundException If the specified namespace does not exist.
 * @throws IOException If it failed to store the key in the store.
 */
@Override public void putSecureData(String namespace,String name,byte[] data,String description,Map<String,String> properties) throws Exception {
  checkNamespaceExists(namespace);
  KeyProvider.Options options=new KeyProvider.Options(conf);
  options.setDescription(description);
  options.setAttributes(properties);
  options.setBitLength(data.length * Byte.SIZE);
  String keyName=getKeyName(namespace,name);
  try {
    provider.createKey(keyName,data,options);
  }
 catch (  IOException e) {
    throw new IOException("String_Node_Str" + name + "String_Node_Str"+ namespace,e);
  }
}

Fixed version (ground truth):
/** 
 * Stores an element in the secure store. The key is stored as namespace:name in the backing store, assuming ":" is the name separator.
 * @param namespace The namespace this key belongs to.
 * @param name Name of the element to store.
 * @param data The data that needs to be securely stored.
 * @param description User provided description of the entry.
 * @param properties Metadata associated with the data
 * @throws NamespaceNotFoundException If the specified namespace does not exist.
 * @throws IOException If it failed to store the key in the store.
 */
@Override public void putSecureData(String namespace,String name,String data,String description,Map<String,String> properties) throws Exception {
  checkNamespaceExists(namespace);
  KeyProvider.Options options=new KeyProvider.Options(conf);
  options.setDescription(description);
  options.setAttributes(properties);
  byte[] buff=data.getBytes(Charsets.UTF_8);
  options.setBitLength(buff.length * Byte.SIZE);
  String keyName=getKeyName(namespace,name);
  try {
    provider.createKey(keyName,buff,options);
  }
 catch (  IOException e) {
    throw new IOException("String_Node_Str" + name + "String_Node_Str"+ namespace,e);
  }
}
Program: 6052
Project: 6052
Buggy source:
@Override public void putSecureData(String namespace,String name,byte[] data,String description,Map<String,String> properties) throws Exception {
  delegateAdmin.putSecureData(namespace,name,data,description,properties);
}

Fixed version (ground truth):
@Override public void putSecureData(String namespace,String name,String data,String description,Map<String,String> properties) throws Exception {
  delegateAdmin.putSecureData(namespace,name,data,description,properties);
}
Program: 6053
Project: 6053
Buggy source:
@Override public void putSecureData(String namespace,String name,byte[] data,String description,Map<String,String> properties) throws IOException {
  throw new UnsupportedOperationException(UNSUPPORTED_ERROR_MSG);
}

Fixed version (ground truth):
@Override public void putSecureData(String namespace,String name,String data,String description,Map<String,String> properties) throws IOException {
  throw new UnsupportedOperationException(UNSUPPORTED_ERROR_MSG);
}
Program: 6055
Project: 6055
Buggy source:
@Override public void putSecureData(String namespace,String name,byte[] data,String description,Map<String,String> properties) throws Exception {
}

Fixed version (ground truth):
@Override public void putSecureData(String namespace,String name,String data,String description,Map<String,String> properties) throws Exception {
}
Program: 6056
Project: 6056
Buggy source:
@Test(expected=Exception.class) public void testOverwrite() throws Exception {
  secureStoreManager.putSecureData(NAMESPACE1,KEY1,VALUE1.getBytes(Charsets.UTF_8),DESCRIPTION1,PROPERTIES_1);
  SecureStoreData oldData=secureStore.getSecureData(NAMESPACE1,KEY1);
  Assert.assertArrayEquals(VALUE1.getBytes(Charsets.UTF_8),oldData.get());
  String newVal="String_Node_Str";
  secureStoreManager.putSecureData(NAMESPACE1,KEY1,newVal.getBytes(Charsets.UTF_8),DESCRIPTION1,PROPERTIES_1);
}

Fixed version (ground truth):
@Test(expected=Exception.class) public void testOverwrite() throws Exception {
  secureStoreManager.putSecureData(NAMESPACE1,KEY1,VALUE1,DESCRIPTION1,PROPERTIES_1);
  SecureStoreData oldData=secureStore.getSecureData(NAMESPACE1,KEY1);
  Assert.assertArrayEquals(VALUE1.getBytes(Charsets.UTF_8),oldData.get());
  String newVal="String_Node_Str";
  secureStoreManager.putSecureData(NAMESPACE1,KEY1,newVal,DESCRIPTION1,PROPERTIES_1);
}
Program: 6057
Project: 6057
Buggy source:
@Test public void testMultipleNamespaces() throws Exception {
  populateStore();
  secureStoreManager.putSecureData(NAMESPACE2,KEY1,VALUE1.getBytes(Charsets.UTF_8),DESCRIPTION1,PROPERTIES_1);
  List<SecureStoreMetadata> expectedList=ImmutableList.of(secureStore.getSecureData(NAMESPACE1,KEY2).getMetadata(),secureStore.getSecureData(NAMESPACE1,KEY1).getMetadata());
  Assert.assertEquals(expectedList,secureStore.listSecureData(NAMESPACE1));
  Assert.assertNotEquals(expectedList,secureStore.listSecureData(NAMESPACE2));
  List<SecureStoreMetadata> expectedList2=ImmutableList.of(secureStore.getSecureData(NAMESPACE2,KEY1).getMetadata());
  Assert.assertEquals(expectedList2,secureStore.listSecureData(NAMESPACE2));
  Assert.assertNotEquals(expectedList2,secureStore.listSecureData(NAMESPACE1));
}

Fixed version (ground truth):
@Test public void testMultipleNamespaces() throws Exception {
  populateStore();
  String ns="String_Node_Str";
  secureStoreManager.putSecureData(ns,KEY1,VALUE1,DESCRIPTION1,PROPERTIES_1);
  List<SecureStoreMetadata> expectedList=ImmutableList.of(secureStore.getSecureData(NAMESPACE1,KEY2).getMetadata(),secureStore.getSecureData(NAMESPACE1,KEY1).getMetadata());
  Assert.assertEquals(expectedList,secureStore.listSecureData(NAMESPACE1));
  Assert.assertNotEquals(expectedList,secureStore.listSecureData(NAMESPACE2));
  List<SecureStoreMetadata> expectedList2=ImmutableList.of(secureStore.getSecureData(NAMESPACE2,KEY1).getMetadata());
  Assert.assertEquals(expectedList2,secureStore.listSecureData(NAMESPACE2));
  Assert.assertNotEquals(expectedList2,secureStore.listSecureData(NAMESPACE1));
}
Program: 6058
Project: 6058
Buggy source:
private void populateStore() throws Exception {
  secureStoreManager.putSecureData(NAMESPACE1,KEY1,VALUE1.getBytes(Charsets.UTF_8),DESCRIPTION1,PROPERTIES_1);
  secureStoreManager.putSecureData(NAMESPACE1,KEY2,VALUE2.getBytes(Charsets.UTF_8),DESCRIPTION2,PROPERTIES_2);
}

Fixed version (ground truth):
private void populateStore() throws Exception {
  secureStoreManager.putSecureData(NAMESPACE1,KEY1,VALUE1,DESCRIPTION1,PROPERTIES_1);
  secureStoreManager.putSecureData(NAMESPACE1,KEY2,VALUE2,DESCRIPTION2,PROPERTIES_2);
}
Program: 6059
Project: 6059
Buggy source:
/** 
 * @param namespace The namespace that this key belongs to.
 * @param name Name of the data element.
 * @return An object representing the securely stored data associated with the name.
 */
SecureStoreData getSecureData(String namespace,String name) throws IOException ;

Fixed version (ground truth):
/** 
 * Returns the data stored in the secure store.
 * @param namespace The namespace that this key belongs to.
 * @param name Name of the data element.
 * @return An object representing the securely stored data associated with the name.
 * @throws IOException If there was a problem reading from the store.
 * @throws Exception if the specified namespace or name does not exist.
 */
SecureStoreData getSecureData(String namespace,String name) throws Exception ;
Program: 6060
Project: 6060
Buggy source:
/** 
 * @param namespace The namespace that this key belongs to.
 * @return A list of {@link SecureStoreMetadata} objects representing the data stored in the store.
 */
List<SecureStoreMetadata> listSecureData(String namespace) throws IOException ;

Fixed version (ground truth):
/** 
 * List of all the entries in the secure store.
 * @param namespace The namespace that this key belongs to.
 * @return A list of {@link SecureStoreMetadata} objects representing the data stored in the store.
 * @throws IOException If there was a problem reading from the keystore.
 * @throws Exception If the specified namespace does not exist.
 */
List<SecureStoreMetadata> listSecureData(String namespace) throws Exception ;
Program: 6061
Project: 6061
Buggy source:
/** 
 * @param namespace The namespace that this key belongs to.
 * @param name of the element to delete.
 * @throws IOException If the store is not initialized or if the key could not be removed.
 */
void deleteSecureData(String namespace,String name) throws IOException ;

Fixed version (ground truth):
/** 
 * Deletes the element with the given name.
 * @param namespace The namespace that this key belongs to.
 * @param name of the element to delete.
 * @throws IOException If the store is not initialized or if the key could not be removed.
 * @throws Exception If the specified namespace or name does not exist.
 */
void deleteSecureData(String namespace,String name) throws Exception ;
Program: 6062
Project: 6062
Buggy source:
/** 
 * @param namespace The namespace that this key belongs to.
 * @param name This is the identifier that will be used to retrieve this element.
 * @param data The sensitive data that has to be securely stored. Passed in as utf-8 formatted byte array.
 * @param description User provided description of the entry.
 * @param properties associated with this element.
 * @throws IOException If the attempt to store the element failed.
 */
void putSecureData(String namespace,String name,byte[] data,String description,Map<String,String> properties) throws IOException ;

Fixed version (ground truth):
/** 
 * Stores an element in the secure store.
 * @param namespace The namespace that this key belongs to.
 * @param name This is the identifier that will be used to retrieve this element.
 * @param data The sensitive data that has to be securely stored. Passed in as utf-8 formatted byte array.
 * @param description User provided description of the entry.
 * @param properties associated with this element.
 * @throws IOException If the attempt to store the element failed.
 * @throws Exception If the specified namespace does not exist or the name already exists. Updating is not supported.
 */
void putSecureData(String namespace,String name,byte[] data,String description,Map<String,String> properties) throws Exception ;
Program: 6063
Project: 6063
Buggy source:
@Override public List<SecureStoreMetadata> listSecureData(String namespace) throws IOException {
  return secureStore.listSecureData(namespace);
}

Fixed version (ground truth):
@Override public List<SecureStoreMetadata> listSecureData(String namespace) throws Exception {
  return secureStore.listSecureData(namespace);
}
Program: 6064
Project: 6064
Buggy source:
@Override public SecureStoreData getSecureData(String namespace,String name) throws IOException {
  return secureStore.getSecureData(namespace,name);
}

Fixed version (ground truth):
@Override public SecureStoreData getSecureData(String namespace,String name) throws Exception {
  return secureStore.getSecureData(namespace,name);
}
Program: 6065
Project: 6065
Buggy source:
@Override public void deleteSecureData(String namespace,String name) throws IOException {
  secureStoreManager.deleteSecureData(namespace,name);
}

Fixed version (ground truth):
@Override public void deleteSecureData(String namespace,String name) throws Exception {
  secureStoreManager.deleteSecureData(namespace,name);
}
Program: 6066
Project: 6066
Buggy source:
@Override public void putSecureData(String namespace,String name,byte[] data,String description,Map<String,String> properties) throws IOException {
  secureStoreManager.putSecureData(namespace,name,data,description,properties);
}

Fixed version (ground truth):
@Override public void putSecureData(String namespace,String name,byte[] data,String description,Map<String,String> properties) throws Exception {
  secureStoreManager.putSecureData(namespace,name,data,description,properties);
}
Program: 6067
Project: 6067
Buggy source:
@Override public List<SecureStoreMetadata> listSecureData(String namespace) throws IOException {
  return delegate.listSecureData(namespace);
}

Fixed version (ground truth):
@Override public List<SecureStoreMetadata> listSecureData(String namespace) throws Exception {
  return delegate.listSecureData(namespace);
}
Program: 6068
Project: 6068
Buggy source:
@Override public SecureStoreData getSecureData(String namespace,String name) throws IOException {
  return delegate.getSecureData(namespace,name);
}

Fixed version (ground truth):
@Override public SecureStoreData getSecureData(String namespace,String name) throws Exception {
  return delegate.getSecureData(namespace,name);
}
Program: 6069
Project: 6069
Buggy source:
/** 
 * Checks if the user has access to read the secure key and returns the data associated with the key if they do.
 * @param secureKeyId Id of the key that the user is trying to read.
 * @return Data associated with the key if the user has read access.
 * @throws Exception If we fail to create a filter for the current principalor the user does not have READ permissions on the secure key. or if there was a problem getting the data from the underlying provider.
 */
@Override public SecureStoreData get(SecureKeyId secureKeyId) throws Exception {
  Principal principal=authenticationContext.getPrincipal();
  final Predicate<EntityId> filter;
  filter=authorizer.createFilter(principal);
  if (filter.apply(secureKeyId)) {
    return secureStore.getSecureData(secureKeyId.getNamespace(),secureKeyId.getName());
  }
  throw new UnauthorizedException(principal,Action.READ,secureKeyId);
}

Fixed version (ground truth):
/** 
 * Checks if the user has access to read the secure key and returns the   {@link SecureStoreData} associatedwith the key if they do.
 * @param secureKeyId Id of the key that the user is trying to read.
 * @return Data associated with the key if the user has read access.
 * @throws NamespaceNotFoundException If the specified namespace does not exist.
 * @throws NotFoundException If the key is not found in the store.
 * @throws IOException If there was a problem reading from the store.
 * @throws UnauthorizedException If the user does not have READ permissions on the secure key.
 */
@Override public SecureStoreData get(SecureKeyId secureKeyId) throws Exception {
  Principal principal=authenticationContext.getPrincipal();
  final Predicate<EntityId> filter;
  filter=authorizer.createFilter(principal);
  if (filter.apply(secureKeyId)) {
    return secureStore.getSecureData(secureKeyId.getNamespace(),secureKeyId.getName());
  }
  throw new UnauthorizedException(principal,Action.READ,secureKeyId);
}
Program: 6070
Project: 6070
Buggy source:
/** 
 * Lists all the secure keys in the given namespace that the user has access to.
 * @param namespaceId Id of the namespace we want the key list for.
 * @return A list of {@link SecureKeyListEntry} of all the keys visible to the user under the given namespace.
 * @throws Exception If there was a problem getting the list from the underlying provider.or if we fail to create a filter for the current principal.
 */
@Override public List<SecureKeyListEntry> list(NamespaceId namespaceId) throws Exception {
  Principal principal=authenticationContext.getPrincipal();
  final Predicate<EntityId> filter;
  filter=authorizer.createFilter(principal);
  List<SecureStoreMetadata> metadatas=secureStore.listSecureData(namespaceId.getNamespace());
  List<SecureKeyListEntry> result=new ArrayList<>(metadatas.size());
  String namespace=namespaceId.getNamespace();
  for (  SecureStoreMetadata metadata : metadatas) {
    String name=metadata.getName();
    if (filter.apply(new SecureKeyId(namespace,name))) {
      result.add(new SecureKeyListEntry(name,metadata.getDescription()));
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Lists all the secure keys in the given namespace that the user has access to. Returns an empty list if the user does not have access to the namespace or any of the keys in the namespace.
 * @param namespaceId Id of the namespace we want the key list for.
 * @return A list of {@link SecureKeyListEntry} for all the keys visible to the user under the given namespace.
 * @throws NamespaceNotFoundException If the specified namespace does not exist.
 * @throws IOException If there was a problem reading from the store.
 */
@Override public List<SecureKeyListEntry> list(NamespaceId namespaceId) throws Exception {
  Principal principal=authenticationContext.getPrincipal();
  final Predicate<EntityId> filter;
  filter=authorizer.createFilter(principal);
  List<SecureStoreMetadata> metadatas=secureStore.listSecureData(namespaceId.getNamespace());
  List<SecureKeyListEntry> result=new ArrayList<>(metadatas.size());
  String namespace=namespaceId.getNamespace();
  for (  SecureStoreMetadata metadata : metadatas) {
    String name=metadata.getName();
    if (filter.apply(new SecureKeyId(namespace,name))) {
      result.add(new SecureKeyListEntry(name,metadata.getDescription()));
    }
  }
  return result;
}
Program: 6071
Project: 6071
Buggy source:
/** 
 * Deletes the key if the user has ADMIN privileges to the key.
 * @param secureKeyId Id of the key to be deleted.
 * @throws UnauthorizedException If the user does not have admin privilages required to delete the secure key.
 * @throws IOException If there was a problem deleting it from the underlying provider.
 */
@Override public void delete(SecureKeyId secureKeyId) throws Exception {
  Principal principal=authenticationContext.getPrincipal();
  authorizer.enforce(secureKeyId,principal,Action.ADMIN);
  secureStoreManager.deleteSecureData(secureKeyId.getNamespace(),secureKeyId.getName());
  authorizer.revoke(secureKeyId);
}

Fixed version (ground truth):
/** 
 * Deletes the key if the user has ADMIN privileges to the key. Clears all the privileges associated with the key.
 * @param secureKeyId Id of the key to be deleted.
 * @throws UnauthorizedException If the user does not have admin privileges required to delete the secure key.
 * @throws NamespaceNotFoundException If the specified namespace does not exist.
 * @throws NotFoundException If the key to be deleted is not found.
 * @throws IOException If there was a problem deleting it from the underlying provider.
 */
@Override public void delete(SecureKeyId secureKeyId) throws Exception {
  Principal principal=authenticationContext.getPrincipal();
  authorizer.enforce(secureKeyId,principal,Action.ADMIN);
  secureStoreManager.deleteSecureData(secureKeyId.getNamespace(),secureKeyId.getName());
  authorizer.revoke(secureKeyId);
}
Program: 6072
Project: 6072
Buggy source:
/** 
 * Puts the user provided data in the secure store, if the user has write access to the namespace.
 * @param secureKeyId The Id for the key that needs to be stored.
 * @param secureKeyCreateRequest The request containing the data to be stored in the secure store.
 * @throws BadRequestException If the request does not contain the value to be stored.
 * @throws UnauthorizedException If the user does not have write permissions on the namespace.
 * @throws IOException If there was a problem storing the data to the underlying provider.
 */
@Override public synchronized void put(SecureKeyId secureKeyId,SecureKeyCreateRequest secureKeyCreateRequest) throws Exception {
  Principal principal=authenticationContext.getPrincipal();
  NamespaceId namespaceId=new NamespaceId(secureKeyId.getNamespace());
  authorizer.enforce(namespaceId,principal,Action.WRITE);
  String description=secureKeyCreateRequest.getDescription();
  String value=secureKeyCreateRequest.getData();
  if (Strings.isNullOrEmpty(value)) {
    throw new BadRequestException("String_Node_Str" + "String_Node_Str");
  }
  byte[] data=value.getBytes(StandardCharsets.UTF_8);
  secureStoreManager.putSecureData(secureKeyId.getNamespace(),secureKeyId.getName(),data,description,secureKeyCreateRequest.getProperties());
  try {
    authorizer.grant(secureKeyId,principal,ImmutableSet.of(Action.ALL));
  }
 catch (  Exception e) {
    throw new UnauthorizedException(principal,Action.ADMIN,secureKeyId);
  }
}

Fixed version (ground truth):
/** 
 * Puts the user provided data in the secure store, if the user has write access to the namespace. Grants the user all access to the newly created entity.
 * @param secureKeyId The Id for the key that needs to be stored.
 * @param secureKeyCreateRequest The request containing the data to be stored in the secure store.
 * @throws BadRequestException If the request does not contain the value to be stored.
 * @throws UnauthorizedException If the user does not have write permissions on the namespace.
 * @throws NamespaceNotFoundException If the specified namespace does not exist.
 * @throws AlreadyExistsException If the key already exists in the namespace. Updating is not supported.
 * @throws IOException If there was a problem storing the key to underlying provider.
 */
@Override public synchronized void put(SecureKeyId secureKeyId,SecureKeyCreateRequest secureKeyCreateRequest) throws Exception {
  Principal principal=authenticationContext.getPrincipal();
  NamespaceId namespaceId=new NamespaceId(secureKeyId.getNamespace());
  authorizer.enforce(namespaceId,principal,Action.WRITE);
  String description=secureKeyCreateRequest.getDescription();
  String value=secureKeyCreateRequest.getData();
  if (Strings.isNullOrEmpty(value)) {
    throw new BadRequestException("String_Node_Str" + "String_Node_Str");
  }
  byte[] data=value.getBytes(StandardCharsets.UTF_8);
  secureStoreManager.putSecureData(secureKeyId.getNamespace(),secureKeyId.getName(),data,description,secureKeyCreateRequest.getProperties());
  authorizer.grant(secureKeyId,principal,ImmutableSet.of(Action.ALL));
}
Program: 6073
Project: 6073
Buggy source:
@Path("String_Node_Str") @GET public void get(HttpServiceRequest request,HttpServiceResponder responder) throws IOException {
  try {
    byte[] bytes=getContext().getSecureData(namespace,KEY).get();
    responder.sendString(new String(bytes));
  }
 catch (  IOException e) {
    responder.sendError(500,e.getMessage());
  }
}

Fixed version (ground truth):
@Path("String_Node_Str") @GET public void get(HttpServiceRequest request,HttpServiceResponder responder){
  try {
    byte[] bytes=getContext().getSecureData(namespace,KEY).get();
    responder.sendString(new String(bytes));
  }
 catch (  Exception e) {
    responder.sendError(500,e.getMessage());
  }
}
Program: 6074
Project: 6074
Buggy source:
@Path("String_Node_Str") @GET public void list(HttpServiceRequest request,HttpServiceResponder responder) throws IOException {
  String name=getContext().listSecureData(namespace).get(0).getName();
  responder.sendString(name);
}

Fixed version (ground truth):
@Path("String_Node_Str") @GET public void list(HttpServiceRequest request,HttpServiceResponder responder) throws Exception {
  String name=getContext().listSecureData(namespace).get(0).getName();
  responder.sendString(name);
}
Program: 6075
Project: 6075
Buggy source:
@Path("String_Node_Str") @GET public void delete(HttpServiceRequest request,HttpServiceResponder responder) throws IOException {
  getContext().getAdmin().deleteSecureData(namespace,KEY);
  responder.sendStatus(200);
}

Fixed version (ground truth):
@Path("String_Node_Str") @GET public void delete(HttpServiceRequest request,HttpServiceResponder responder) throws Exception {
  getContext().getAdmin().deleteSecureData(namespace,KEY);
  responder.sendStatus(200);
}
Program: 6076
Project: 6076
Buggy source:
@Path("String_Node_Str") @PUT public void put(HttpServiceRequest request,HttpServiceResponder responder) throws IOException {
  byte[] value=new byte[request.getContent().remaining()];
  request.getContent().get(value);
  getContext().getAdmin().putSecureData(namespace,KEY,value,"String_Node_Str",new HashMap<String,String>());
  responder.sendStatus(200);
}

Fixed version (ground truth):
@Path("String_Node_Str") @PUT public void put(HttpServiceRequest request,HttpServiceResponder responder) throws Exception {
  byte[] value=new byte[request.getContent().remaining()];
  request.getContent().get(value);
  getContext().getAdmin().putSecureData(namespace,KEY,value,"String_Node_Str",new HashMap<String,String>());
  responder.sendStatus(200);
}
Program: 6077
Project: 6077
Buggy source:
@Override public void deleteSecureData(String namespace,String name) throws IOException {
}

Fixed version (ground truth):
@Override public void deleteSecureData(String namespace,String name) throws Exception {
}
Program: 6078
Project: 6078
Buggy source:
@Override public Admin getAdmin(){
  return new Admin(){
    @Override public boolean datasetExists(    String name){
      return false;
    }
    @Nullable @Override public String getDatasetType(    String name) throws InstanceNotFoundException {
      throw new InstanceNotFoundException(name);
    }
    @Nullable @Override public DatasetProperties getDatasetProperties(    String name) throws InstanceNotFoundException {
      throw new InstanceNotFoundException(name);
    }
    @Override public void createDataset(    String name,    String type,    DatasetProperties properties){
    }
    @Override public void updateDataset(    String name,    DatasetProperties properties){
    }
    @Override public void dropDataset(    String name){
    }
    @Override public void truncateDataset(    String name){
    }
    @Override public void putSecureData(    String namespace,    String name,    byte[] data,    String description,    Map<String,String> properties) throws IOException {
    }
    @Override public void deleteSecureData(    String namespace,    String name) throws IOException {
    }
  }
;
}

Fixed version (ground truth):
@Override public Admin getAdmin(){
  return new Admin(){
    @Override public boolean datasetExists(    String name){
      return false;
    }
    @Nullable @Override public String getDatasetType(    String name) throws InstanceNotFoundException {
      throw new InstanceNotFoundException(name);
    }
    @Nullable @Override public DatasetProperties getDatasetProperties(    String name) throws InstanceNotFoundException {
      throw new InstanceNotFoundException(name);
    }
    @Override public void createDataset(    String name,    String type,    DatasetProperties properties){
    }
    @Override public void updateDataset(    String name,    DatasetProperties properties){
    }
    @Override public void dropDataset(    String name){
    }
    @Override public void truncateDataset(    String name){
    }
    @Override public void putSecureData(    String namespace,    String name,    byte[] data,    String description,    Map<String,String> properties) throws Exception {
    }
    @Override public void deleteSecureData(    String namespace,    String name) throws Exception {
    }
  }
;
}
Program: 6079
Project: 6079
Buggy source:
@Override public void putSecureData(String namespace,String name,byte[] data,String description,Map<String,String> properties) throws IOException {
}

Fixed version (ground truth):
@Override public void putSecureData(String namespace,String name,byte[] data,String description,Map<String,String> properties) throws Exception {
}
Program: 6080
Project: 6080
Buggy source:
@Override public List<SecureStoreMetadata> listSecureData(String namespace) throws IOException {
  return null;
}

Fixed version (ground truth):
@Override public List<SecureStoreMetadata> listSecureData(String namespace) throws Exception {
  return null;
}
Program: 6081
Project: 6081
Buggy source:
@Override public SecureStoreData getSecureData(String namespace,String name) throws IOException {
  return null;
}

Fixed version (ground truth):
@Override public SecureStoreData getSecureData(String namespace,String name) throws Exception {
  return null;
}
Program: 6082
Project: 6082
Buggy source:
private static CConfiguration createCConf() throws IOException {
  File rootLocationFactoryPath=TEMPORARY_FOLDER.newFolder();
  String secureStoreLocation=TEMPORARY_FOLDER.newFolder().getAbsolutePath();
  CConfiguration cConf=CConfiguration.create();
  cConf.setStrings(Constants.Security.Store.FILE_PATH,secureStoreLocation);
  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);
  cConf.set(Constants.Security.Authorization.SUPERUSERS,"String_Node_Str");
  LocationFactory locationFactory=new LocalLocationFactory(rootLocationFactoryPath);
  Location authorizerJar=AppJarHelper.createDeploymentJar(locationFactory,InMemoryAuthorizer.class);
  cConf.set(Constants.Security.Authorization.EXTENSION_JAR_PATH,authorizerJar.toURI().getPath());
  return cConf;
}

Fixed version (ground truth):
private static CConfiguration createCConf() throws Exception {
  LocationFactory locationFactory=new LocalLocationFactory(TEMPORARY_FOLDER.newFolder());
  String secureStoreLocation=locationFactory.create("String_Node_Str").toURI().getPath();
  CConfiguration cConf=CConfiguration.create();
  cConf.set(Constants.Security.Store.FILE_PATH,secureStoreLocation);
  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);
  cConf.set(Constants.Security.Authorization.SUPERUSERS,"String_Node_Str");
  Location authorizerJar=AppJarHelper.createDeploymentJar(locationFactory,InMemoryAuthorizer.class);
  cConf.set(Constants.Security.Authorization.EXTENSION_JAR_PATH,authorizerJar.toURI().getPath());
  return cConf;
}
Program: 6084
Project: 6084
Buggy source:
@BeforeClass public static void setup() throws Exception {
  Injector injector=Guice.createInjector(new AppFabricTestModule(createCConf()));
  secureStoreService=injector.getInstance(SecureStoreService.class);
  authorizer=injector.getInstance(AuthorizerInstantiator.class).get();
}

Fixed version (ground truth):
@BeforeClass public static void setup() throws Exception {
  CConfiguration cConf=createCConf();
  final Injector injector=AppFabricTestHelper.getInjector(cConf);
  appFabricServer=injector.getInstance(AppFabricServer.class);
  appFabricServer.startAndWait();
  authorizationEnforcementService=injector.getInstance(AuthorizationEnforcementService.class);
  authorizationEnforcementService.startAndWait();
  remoteSystemOperationsService=injector.getInstance(RemoteSystemOperationsService.class);
  remoteSystemOperationsService.startAndWait();
  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: 6085
Project: 6085
Buggy source:
@Override public void deleteSecureData(String namespace,String name) throws Exception {
  context.getAdmin().deleteSecureData(namespace,name);
}

Fixed version (ground truth):
@Override public void deleteSecureData(String namespace,String name) throws IOException {
  context.getAdmin().deleteSecureData(namespace,name);
}
Program: 6086
Project: 6086
Buggy source:
@Override public SecureStoreData getSecureData(String namespace,String name) throws Exception {
  return context.getSecureData(namespace,name);
}

Fixed version (ground truth):
@Override public SecureStoreData getSecureData(String namespace,String name) throws IOException {
  return context.getSecureData(namespace,name);
}
Program: 6087
Project: 6087
Buggy source:
@Override public void putSecureData(String namespace,String name,byte[] data,String description,Map<String,String> properties) throws Exception {
  context.getAdmin().putSecureData(namespace,name,data,description,properties);
}

Fixed version (ground truth):
@Override public void putSecureData(String namespace,String name,byte[] data,String description,Map<String,String> properties) throws IOException {
  context.getAdmin().putSecureData(namespace,name,data,description,properties);
}
Program: 6088
Project: 6088
Buggy source:
@Override public List<SecureStoreMetadata> listSecureData(String namespace) throws Exception {
  return context.listSecureData(namespace);
}

Fixed version (ground truth):
@Override public List<SecureStoreMetadata> listSecureData(String namespace) throws IOException {
  return context.listSecureData(namespace);
}
Program: 6089
Project: 6089
Buggy source:
private void revoke(RevokeRequest revokeRequest) throws IOException, UnauthenticatedException, FeatureDisabledException, UnauthorizedException, NotFoundException {
  URL url=config.resolveURLV3(AUTHORIZATION_BASE + "String_Node_Str");
  HttpRequest request=HttpRequest.post(url).withBody(GSON.toJson(revokeRequest)).build();
  executePrivilegeRequest(revokeRequest.getEntity(),request);
}

Fixed version (ground truth):
private void revoke(RevokeRequest revokeRequest) throws IOException, UnauthenticatedException, FeatureDisabledException, UnauthorizedException, NotFoundException {
  URL url=config.resolveURLV3(AUTHORIZATION_BASE + "String_Node_Str");
  HttpRequest request=HttpRequest.post(url).withBody(GSON.toJson(revokeRequest)).build();
  executePrivilegeRequest(request);
}
Program: 6090
Project: 6090
Buggy source:
@Override public void grant(EntityId entity,Principal principal,Set<Action> actions) throws IOException, UnauthenticatedException, FeatureDisabledException, UnauthorizedException, NotFoundException {
  GrantRequest grantRequest=new GrantRequest(entity,principal,actions);
  URL url=config.resolveURLV3(AUTHORIZATION_BASE + "String_Node_Str");
  HttpRequest request=HttpRequest.post(url).withBody(GSON.toJson(grantRequest)).build();
  executePrivilegeRequest(entity,request);
}

Fixed version (ground truth):
@Override public void grant(EntityId entity,Principal principal,Set<Action> actions) throws IOException, UnauthenticatedException, FeatureDisabledException, UnauthorizedException, NotFoundException {
  GrantRequest grantRequest=new GrantRequest(entity,principal,actions);
  URL url=config.resolveURLV3(AUTHORIZATION_BASE + "String_Node_Str");
  HttpRequest request=HttpRequest.post(url).withBody(GSON.toJson(grantRequest)).build();
  executePrivilegeRequest(request);
}
Program: 6091
Project: 6091
Buggy source:
private HttpResponse executePrivilegeRequest(EntityId entityId,HttpRequest request) throws FeatureDisabledException, UnauthenticatedException, IOException, NotFoundException, UnauthorizedException {
  HttpResponse httpResponse=doExecuteRequest(request,HttpURLConnection.HTTP_NOT_FOUND);
  if (HttpURLConnection.HTTP_NOT_FOUND == httpResponse.getResponseCode()) {
    throw new NotFoundException(entityId);
  }
  return httpResponse;
}

Fixed version (ground truth):
private HttpResponse executePrivilegeRequest(HttpRequest request) throws FeatureDisabledException, UnauthenticatedException, IOException, NotFoundException, UnauthorizedException {
  HttpResponse httpResponse=doExecuteRequest(request,HttpURLConnection.HTTP_NOT_FOUND);
  if (HttpURLConnection.HTTP_NOT_FOUND == httpResponse.getResponseCode()) {
    throw new NotFoundException(httpResponse.getResponseBodyAsString());
  }
  return httpResponse;
}