nus-yam/ex-repair huggingface dataset:
Program: 49603
Project: 49603
Buggy source:
@Override public void configure(){
  bind(JPAInitializer.class).asEagerSingleton();
  bindConstant().annotatedWith(JpaUnit.class).to("String_Node_Str");
  bind(CertificateResource.class);
  bind(ConsumerResource.class);
  bind(PoolResource.class);
  bind(EntitlementResource.class);
  bind(OwnerResource.class);
  bind(ProductServiceAdapter.class).to(DefaultProductServiceAdapter.class);
  bind(ProductResource.class);
  bind(TestResource.class);
  bind(DateSource.class).to(DateSourceForTesting.class).asEagerSingleton();
  bind(Enforcer.class).to(JavascriptEnforcer.class);
  bind(BouncyCastlePKI.class);
  bind(SubscriptionServiceAdapter.class).to(DefaultSubscriptionServiceAdapter.class);
  bind(IdentityCertServiceAdapter.class).to(StubIdentityCertServiceAdapter.class);
  bind(Config.class);
  bind(CertificateServiceAdapter.class).to(DefaultCertificateServiceAdapter.class);
  bind(RulesCurator.class).to(TestRulesCurator.class);
  bind(ScriptEngine.class).toProvider(ScriptEngineProvider.class);
  bind(Reader.class).annotatedWith(Names.named("String_Node_Str")).toProvider(RulesReaderProvider.class);
}

Fixed version (ground truth):
@Override public void configure(){
  bind(JPAInitializer.class).asEagerSingleton();
  bindConstant().annotatedWith(JpaUnit.class).to("String_Node_Str");
  bind(CertificateResource.class);
  bind(ConsumerResource.class);
  bind(PoolResource.class);
  bind(EntitlementResource.class);
  bind(OwnerResource.class);
  bind(ProductServiceAdapter.class).to(DefaultProductServiceAdapter.class);
  bind(ProductResource.class);
  bind(TestResource.class);
  bind(DateSource.class).to(DateSourceForTesting.class).asEagerSingleton();
  bind(Enforcer.class).to(JavascriptEnforcer.class);
  bind(BouncyCastlePKI.class);
  bind(SubscriptionServiceAdapter.class).to(DefaultSubscriptionServiceAdapter.class);
  bind(IdentityCertServiceAdapter.class).to(StubIdentityCertServiceAdapter.class);
  bind(Config.class);
  bind(EntitlementCertServiceAdapter.class).to(DefaultEntitlementCertServiceAdapter.class);
  bind(RulesCurator.class).to(TestRulesCurator.class);
  bind(ScriptEngine.class).toProvider(ScriptEngineProvider.class);
  bind(Reader.class).annotatedWith(Names.named("String_Node_Str")).toProvider(RulesReaderProvider.class);
}
Program: 49606
Project: 49606
Buggy source:
@Override public ConsumerIdentityCertificate generateIdentityCert(Consumer consumer){
  ConsumerIdentityCertificate idCert=new ConsumerIdentityCertificate();
  idCert.setId(43l);
  idCert.setKey("String_Node_Str".getBytes());
  idCert.setPem("String_Node_Str".getBytes());
  return idCert;
}

Fixed version (ground truth):
@Override public ConsumerIdentityCertificate generateIdentityCert(Consumer consumer){
  ConsumerIdentityCertificate idCert=new ConsumerIdentityCertificate();
  idCert.setId(43L);
  idCert.setKey("String_Node_Str".getBytes());
  idCert.setPem("String_Node_Str".getBytes());
  return idCert;
}
Program: 49607
Project: 49607
Buggy source:
@SuppressWarnings("String_Node_Str") public List<Pool> listAvailableEntitlementPools(Consumer c,Owner o,String productId,boolean activeOnly){
  List<Pool> results=null;
  Criteria crit=currentSession().createCriteria(Pool.class);
  if (activeOnly) {
    crit.add(Restrictions.eq("String_Node_Str",Boolean.TRUE));
  }
  if (c != null) {
    crit.add(Restrictions.eq("String_Node_Str",c.getOwner()));
  }
  if (o != null) {
    crit.add(Restrictions.eq("String_Node_Str",o));
  }
  if (productId != null) {
    crit.add(Restrictions.eq("String_Node_Str",productId));
  }
  crit.add(Restrictions.lt("String_Node_Str",new Date()));
  crit.add(Restrictions.gt("String_Node_Str",new Date()));
  results=(List<Pool>)crit.list();
  if (results == null) {
    results=new ArrayList<Pool>();
  }
  if (c != null) {
    List<Pool> finalResults=new LinkedList<Pool>();
    for (    Pool p : results) {
      PreEntHelper helper=enforcer.pre(c,p);
      if (helper.getResult().isSuccessful()) {
        finalResults.add(p);
      }
 else {
        log.info("String_Node_Str" + p.getId());
      }
    }
    return finalResults;
  }
  return results;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public List<Pool> listAvailableEntitlementPools(Consumer c,Owner o,String productId,boolean activeOnly){
  List<Pool> results=null;
  Criteria crit=currentSession().createCriteria(Pool.class);
  if (activeOnly) {
    crit.add(Restrictions.eq("String_Node_Str",Boolean.TRUE));
  }
  if (c != null) {
    crit.add(Restrictions.eq("String_Node_Str",c.getOwner()));
  }
  if (o != null) {
    crit.add(Restrictions.eq("String_Node_Str",o));
  }
  if (productId != null) {
    crit.add(Restrictions.eq("String_Node_Str",productId));
  }
  crit.add(Restrictions.lt("String_Node_Str",new Date()));
  crit.add(Restrictions.gt("String_Node_Str",new Date()));
  results=(List<Pool>)crit.list();
  if (results == null) {
    results=new ArrayList<Pool>();
  }
  if (c != null) {
    List<Pool> finalResults=new LinkedList<Pool>();
    for (    Pool p : results) {
      PreEntHelper helper=enforcer.pre(c,p);
      if (helper.getResult().isSuccessful()) {
        finalResults.add(p);
      }
 else {
        log.info("String_Node_Str" + p.getId());
        log.info(helper.getResult().getErrors());
      }
    }
    return finalResults;
  }
  return results;
}
Program: 49608
Project: 49608
Buggy source:
@Override public PreEntHelper pre(Consumer consumer,Pool entitlementPool){
  runPre(preHelper,consumer,entitlementPool);
  if (entitlementPool.isExpired(dateSource)) {
    preHelper.getResult().addError(new ValidationError("String_Node_Str" + entitlementPool.getProductId() + "String_Node_Str"+ entitlementPool.getEndDate()));
    return preHelper;
  }
  return preHelper;
}

Fixed version (ground truth):
@Override public PreEntHelper pre(Consumer consumer,Pool entitlementPool){
  PreEntHelper preHelper=runPre(consumer,entitlementPool);
  if (entitlementPool.isExpired(dateSource)) {
    preHelper.getResult().addError(new ValidationError("String_Node_Str" + entitlementPool.getProductId() + "String_Node_Str"+ entitlementPool.getEndDate()));
    return preHelper;
  }
  return preHelper;
}
Program: 49609
Project: 49609
Buggy source:
private void runPre(PreEntHelper preHelper,Consumer consumer,Pool pool){
  Invocable inv=(Invocable)jsEngine;
  String productId=pool.getProductId();
  jsEngine.put("String_Node_Str",new ReadOnlyConsumer(consumer));
  jsEngine.put("String_Node_Str",new ReadOnlyProduct(prodAdapter.getProductById(productId)));
  jsEngine.put("String_Node_Str",new ReadOnlyEntitlementPool(pool));
  jsEngine.put("String_Node_Str",preHelper);
  log.debug("String_Node_Str" + consumer.getUuid() + "String_Node_Str"+ pool.getProductId());
  try {
    inv.invokeFunction(PRE_PREFIX + productId);
    log.debug("String_Node_Str" + PRE_PREFIX + productId);
  }
 catch (  NoSuchMethodException e) {
    try {
      inv.invokeFunction(GLOBAL_PRE_FUNCTION);
      log.debug("String_Node_Str" + GLOBAL_PRE_FUNCTION);
    }
 catch (    NoSuchMethodException ex) {
      log.warn("String_Node_Str" + GLOBAL_PRE_FUNCTION);
    }
catch (    ScriptException ex) {
      throw new RuleExecutionException(ex);
    }
  }
catch (  ScriptException e) {
    throw new RuleExecutionException(e);
  }
}

Fixed version (ground truth):
private PreEntHelper runPre(Consumer consumer,Pool pool){
  Invocable inv=(Invocable)jsEngine;
  String productId=pool.getProductId();
  PreEntHelper preHelper=new PreEntHelper();
  jsEngine.put("String_Node_Str",new ReadOnlyConsumer(consumer));
  jsEngine.put("String_Node_Str",new ReadOnlyProduct(prodAdapter.getProductById(productId)));
  jsEngine.put("String_Node_Str",new ReadOnlyEntitlementPool(pool));
  jsEngine.put("String_Node_Str",preHelper);
  log.debug("String_Node_Str" + consumer.getUuid() + "String_Node_Str"+ pool.getProductId());
  try {
    inv.invokeFunction(PRE_PREFIX + productId);
    log.debug("String_Node_Str" + PRE_PREFIX + productId);
  }
 catch (  NoSuchMethodException e) {
    try {
      inv.invokeFunction(GLOBAL_PRE_FUNCTION);
      log.debug("String_Node_Str" + GLOBAL_PRE_FUNCTION);
    }
 catch (    NoSuchMethodException ex) {
      log.warn("String_Node_Str" + GLOBAL_PRE_FUNCTION);
    }
catch (    ScriptException ex) {
      throw new RuleExecutionException(ex);
    }
  }
catch (  ScriptException e) {
    throw new RuleExecutionException(e);
  }
  return preHelper;
}
Program: 49610
Project: 49610
Buggy source:
@Override public PostEntHelper post(Entitlement ent){
  postHelper.init(ent);
  runPost(postHelper,ent);
  return postHelper;
}

Fixed version (ground truth):
@Override public PostEntHelper post(Entitlement ent){
  PostEntHelper postHelper=new PostEntHelper();
  postHelper.init(ent);
  runPost(postHelper,ent);
  return postHelper;
}
Program: 49611
Project: 49611
Buggy source:
@Inject public JavascriptEnforcer(DateSource dateSource,RulesCurator rulesCurator,PreEntHelper preHelper,PostEntHelper postHelper,ProductServiceAdapter prodAdapter){
  this.dateSource=dateSource;
  this.rulesCurator=rulesCurator;
  this.preHelper=preHelper;
  this.postHelper=postHelper;
  this.prodAdapter=prodAdapter;
  ScriptEngineManager mgr=new ScriptEngineManager();
  jsEngine=mgr.getEngineByName("String_Node_Str");
  if (jsEngine == null) {
    throw new RuntimeException("String_Node_Str");
  }
  try {
    Reader reader=new StringReader(this.rulesCurator.getRules().getRules());
    jsEngine.eval(reader);
  }
 catch (  ScriptException ex) {
    throw new RuleParseException(ex);
  }
}

Fixed version (ground truth):
@Inject public JavascriptEnforcer(DateSource dateSource,RulesCurator rulesCurator,ProductServiceAdapter prodAdapter){
  this.dateSource=dateSource;
  this.rulesCurator=rulesCurator;
  this.prodAdapter=prodAdapter;
  ScriptEngineManager mgr=new ScriptEngineManager();
  jsEngine=mgr.getEngineByName("String_Node_Str");
  if (jsEngine == null) {
    throw new RuntimeException("String_Node_Str");
  }
  try {
    Reader reader=new StringReader(this.rulesCurator.getRules().getRules());
    jsEngine.eval(reader);
  }
 catch (  ScriptException ex) {
    throw new RuleParseException(ex);
  }
}
Program: 49612
Project: 49612
Buggy source:
/** 
 * default ctor
 */
public PreEntHelper(){
  result=new ValidationResult();
}

Fixed version (ground truth):
public PreEntHelper(){
  result=new ValidationResult();
}
Program: 49613
Project: 49613
Buggy source:
/** 
 * Return the value of the fact assigned to the given key.
 * @param factKey Fact key
 * @return Fact value assigned to the given key.
 */
public String getFact(String factKey){
  return consumer.getFact(factKey);
}

Fixed version (ground truth):
/** 
 * Return the value of the fact assigned to the given key.
 * @param factKey Fact key
 * @return Fact value assigned to the given key.
 */
public String getFact(String factKey){
  String result=consumer.getFact(factKey);
  if (result == null) {
    throw new MissingFactException(consumer.getUuid(),factKey);
  }
  return result;
}
Program: 49614
Project: 49614
Buggy source:
/** 
 * Returns the list of available entitlement pools.
 * @param ownerId optional parameter to limit the search by owner
 * @param productId optional parameter to limit the search by product      
 * @return the list of available entitlement pools.
 */
@GET @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) public List<Pool> list(@QueryParam("String_Node_Str") Long ownerId,@QueryParam("String_Node_Str") String consumerUuid,@QueryParam("String_Node_Str") String productId){
  List<Pool> returnValue=new LinkedList<Pool>();
  if ((ownerId == null) && (productId == null) && (consumerUuid == null)) {
    return poolCurator.findAll();
  }
 else {
    Product p=null;
    if (productId != null) {
      p=productServiceAdapter.getProductById(productId);
      if (p == null) {
        return returnValue;
      }
    }
    Consumer c=null;
    if (consumerUuid != null) {
      c=consumerCurator.lookupByUuid(consumerUuid);
      if (c == null) {
        return returnValue;
      }
    }
    Owner o=null;
    if (ownerId != null) {
      o=ownerCurator.find(ownerId);
      if (o == null) {
        return returnValue;
      }
    }
    return poolCurator.listAvailableEntitlementPools(c,o,p,true);
  }
}

Fixed version (ground truth):
/** 
 * Returns the list of available entitlement pools.
 * @param ownerId optional parameter to limit the search by owner
 * @param productId optional parameter to limit the search by product      
 * @return the list of available entitlement pools.
 */
@GET @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) public List<Pool> list(@QueryParam("String_Node_Str") Long ownerId,@QueryParam("String_Node_Str") String consumerUuid,@QueryParam("String_Node_Str") String productId){
  if (consumerUuid != null && ownerId != null) {
    throw new BadRequestException("String_Node_Str");
  }
  List<Pool> returnValue=new LinkedList<Pool>();
  if ((ownerId == null) && (productId == null) && (consumerUuid == null)) {
    return poolCurator.findAll();
  }
 else {
    Product p=null;
    if (productId != null) {
      p=productServiceAdapter.getProductById(productId);
      if (p == null) {
        return returnValue;
      }
    }
    Consumer c=null;
    if (consumerUuid != null) {
      c=consumerCurator.lookupByUuid(consumerUuid);
      if (c == null) {
        return returnValue;
      }
    }
    Owner o=null;
    if (ownerId != null) {
      o=ownerCurator.find(ownerId);
      if (o == null) {
        return returnValue;
      }
    }
    return poolCurator.listAvailableEntitlementPools(c,o,p,true);
  }
}
Program: 49615
Project: 49615
Buggy source:
@Before public void createEnforcer(){
  owner=TestUtil.createOwner();
  ownerCurator.create(owner);
  consumer=TestUtil.createConsumer(owner);
  consumerTypeCurator.create(consumer.getType());
  consumerCurator.create(consumer);
  PreEntHelper preHelper=new PreEntHelper();
  PostEntHelper postHelper=new PostEntHelper(productAdapter);
  enforcer=new JavascriptEnforcer(new DateSourceForTesting(2010,1,1),rulesCurator,preHelper,postHelper,productAdapter);
}

Fixed version (ground truth):
@Before public void createEnforcer(){
  owner=TestUtil.createOwner();
  ownerCurator.create(owner);
  consumer=TestUtil.createConsumer(owner);
  consumerTypeCurator.create(consumer.getType());
  consumerCurator.create(consumer);
  enforcer=new JavascriptEnforcer(new DateSourceForTesting(2010,1,1),rulesCurator,productAdapter);
}
Program: 49616
Project: 49616
Buggy source:
@Before public void setUp(){
  owner1=TestUtil.createOwner();
  owner2=TestUtil.createOwner();
  ownerCurator.create(owner1);
  ownerCurator.create(owner2);
  product1=TestUtil.createProduct();
  product2=TestUtil.createProduct();
  productCurator.create(product1);
  productCurator.create(product2);
  pool1=new Pool(owner1,product1.getId(),new Long(500),TestUtil.createDate(2000,1,1),TestUtil.createDate(3000,1,1));
  pool2=new Pool(owner1,product2.getId(),new Long(500),TestUtil.createDate(2000,1,1),TestUtil.createDate(3000,1,1));
  pool3=new Pool(owner2,product1.getId(),new Long(500),TestUtil.createDate(2000,1,1),TestUtil.createDate(3000,1,1));
  poolCurator.create(pool1);
  poolCurator.create(pool2);
  poolCurator.create(pool3);
  poolResource=new PoolResource(poolCurator,consumerCurator,ownerCurator,productAdapter);
}

Fixed version (ground truth):
@Before public void setUp(){
  owner1=TestUtil.createOwner();
  owner2=TestUtil.createOwner();
  ownerCurator.create(owner1);
  ownerCurator.create(owner2);
  product1=new Product(PRODUCT_CPULIMITED,PRODUCT_CPULIMITED);
  product2=TestUtil.createProduct();
  productCurator.create(product1);
  productCurator.create(product2);
  pool1=new Pool(owner1,product1.getId(),new Long(500),TestUtil.createDate(2000,1,1),TestUtil.createDate(3000,1,1));
  pool2=new Pool(owner1,product2.getId(),new Long(500),TestUtil.createDate(2000,1,1),TestUtil.createDate(3000,1,1));
  pool3=new Pool(owner2,product1.getId(),new Long(500),TestUtil.createDate(2000,1,1),TestUtil.createDate(3000,1,1));
  poolCurator.create(pool1);
  poolCurator.create(pool2);
  poolCurator.create(pool3);
  poolResource=new PoolResource(poolCurator,consumerCurator,ownerCurator,productAdapter);
  failConsumer=TestUtil.createConsumer(owner1);
  failConsumer.setMetadataField("String_Node_Str","String_Node_Str");
  consumerTypeCurator.create(failConsumer.getType());
  consumerCurator.create(failConsumer);
  passConsumer=TestUtil.createConsumer(owner1);
  passConsumer.setMetadataField("String_Node_Str","String_Node_Str");
  consumerTypeCurator.create(passConsumer.getType());
  consumerCurator.create(passConsumer);
}
Program: 49617
Project: 49617
Buggy source:
public static Date createDate(int year,int month,int day){
  Calendar cal=Calendar.getInstance();
  cal.set(Calendar.YEAR,year);
  cal.set(Calendar.MONTH,month);
  cal.set(Calendar.DATE,day);
  cal.set(Calendar.HOUR_OF_DAY,0);
  cal.set(Calendar.MINUTE,0);
  cal.set(Calendar.SECOND,0);
  cal.set(Calendar.MILLISECOND,0);
  Date jsqlD=new Date(cal.getTime().getTime());
  return jsqlD;
}

Fixed version (ground truth):
public static Date createDate(int year,int month,int day){
  Calendar cal=Calendar.getInstance();
  cal.set(Calendar.YEAR,year);
  cal.set(Calendar.MONTH,month - 1);
  cal.set(Calendar.DATE,day);
  cal.set(Calendar.HOUR_OF_DAY,0);
  cal.set(Calendar.MINUTE,0);
  cal.set(Calendar.SECOND,0);
  cal.set(Calendar.MILLISECOND,0);
  Date jsqlD=new Date(cal.getTime().getTime());
  return jsqlD;
}
Program: 49618
Project: 49618
Buggy source:
@Test public void hasEntitlementWithEntitledProductShouldReturnTrue(){
  Entitlement entitlement=entitler.entitle(owner,consumer,product);
  assertNotNull(entitlementCurator.find(entitlement.getId()));
  WebResource r=resource().path("String_Node_Str" + consumer.getUuid() + "String_Node_Str"+ product.getId());
  Entitlement returned=r.accept("String_Node_Str").type("String_Node_Str").get(Entitlement.class);
  assertEntitlementsAreSame(entitlement,returned);
}

Fixed version (ground truth):
@Test public void hasEntitlementWithEntitledProductShouldReturnTrue(){
  Entitlement entitlement=entitler.entitle(consumer,product);
  assertNotNull(entitlementCurator.find(entitlement.getId()));
  WebResource r=resource().path("String_Node_Str" + consumer.getUuid() + "String_Node_Str"+ product.getId());
  Entitlement returned=r.accept("String_Node_Str").type("String_Node_Str").get(Entitlement.class);
  assertEntitlementsAreSame(entitlement,returned);
}
Program: 49619
Project: 49619
Buggy source:
@Test public void getSingleEntitlement(){
  Consumer c=TestUtil.createConsumer(consumerType,owner);
  consumerCurator.create(c);
  Entitlement entitlement=entitler.entitle(owner,c,product);
  WebResource r=resource().path("String_Node_Str" + entitlement.getId());
  Entitlement returned=r.accept("String_Node_Str").type("String_Node_Str").get(Entitlement.class);
  assertEntitlementsAreSame(entitlement,returned);
  assertNotNull(entitlementCurator.find(entitlement.getId()));
}

Fixed version (ground truth):
@Test public void getSingleEntitlement(){
  Consumer c=TestUtil.createConsumer(consumerType,owner);
  consumerCurator.create(c);
  Entitlement entitlement=entitler.entitle(c,product);
  WebResource r=resource().path("String_Node_Str" + entitlement.getId());
  Entitlement returned=r.accept("String_Node_Str").type("String_Node_Str").get(Entitlement.class);
  assertEntitlementsAreSame(entitlement,returned);
  assertNotNull(entitlementCurator.find(entitlement.getId()));
}
Program: 49620
Project: 49620
Buggy source:
@Test public void deleteEntitlementWithValidIdShouldPass(){
  unitOfWork.beginWork();
  Entitlement entitlement=entitler.entitle(owner,consumer,product);
  assertNotNull(entitlementCurator.find(entitlement.getId()));
  unitOfWork.endWork();
  unitOfWork.beginWork();
  WebResource r=resource().path("String_Node_Str" + entitlement.getId());
  r.accept("String_Node_Str").type("String_Node_Str").delete();
  unitOfWork.endWork();
  assertNull(entitlementCurator.find(entitlement.getId()));
}

Fixed version (ground truth):
@Test public void deleteEntitlementWithValidIdShouldPass(){
  unitOfWork.beginWork();
  Entitlement entitlement=entitler.entitle(consumer,product);
  assertNotNull(entitlementCurator.find(entitlement.getId()));
  unitOfWork.endWork();
  unitOfWork.beginWork();
  WebResource r=resource().path("String_Node_Str" + entitlement.getId());
  r.accept("String_Node_Str").type("String_Node_Str").delete();
  unitOfWork.endWork();
  assertNull(entitlementCurator.find(entitlement.getId()));
}
Program: 49621
Project: 49621
Buggy source:
protected void assertEntitlementSucceeded(){
  assertEquals(new Long(1),new Long(entitlementCurator.findAll().size()));
  assertEquals(new Long(1),poolCurator.listByOwnerAndProduct(owner,product).get(0).getCurrentMembers());
  assertEquals(1,consumerCurator.find(consumer.getId()).getConsumedProducts().size());
  assertEquals(product.getId(),consumerCurator.find(consumer.getId()).getConsumedProducts().iterator().next().getProductId());
  assertEquals(1,consumerCurator.find(consumer.getId()).getEntitlements().size());
}

Fixed version (ground truth):
protected void assertEntitlementSucceeded(){
  assertEquals(new Long(1),new Long(entitlementCurator.findAll().size()));
  assertEquals(new Long(1),poolCurator.listByOwnerAndProduct(owner,product).get(0).getCurrentMembers());
  assertEquals(1,consumerCurator.find(consumer.getId()).getEntitlements().size());
}
Program: 49622
Project: 49622
Buggy source:
@Test public void listEntitlements(){
  for (int i=0; i < entitlementPool.getMaxMembers(); i++) {
    Consumer c=TestUtil.createConsumer(consumerType,owner);
    consumerCurator.create(c);
    entitler.entitle(owner,c,product);
  }
  WebResource r=resource().path("String_Node_Str");
  List<Entitlement> returned=r.accept("String_Node_Str").type("String_Node_Str").get(new GenericType<List<Entitlement>>(){
  }
);
  assertTrue(10 == returned.size());
  assertTrue(10 == entitlementCurator.findAll().size());
}

Fixed version (ground truth):
@Test public void listEntitlements(){
  for (int i=0; i < entitlementPool.getMaxMembers(); i++) {
    Consumer c=TestUtil.createConsumer(consumerType,owner);
    consumerCurator.create(c);
    entitler.entitle(c,product);
  }
  WebResource r=resource().path("String_Node_Str");
  List<Entitlement> returned=r.accept("String_Node_Str").type("String_Node_Str").get(new GenericType<List<Entitlement>>(){
  }
);
  assertTrue(10 == returned.size());
  assertTrue(10 == entitlementCurator.findAll().size());
}
Program: 49623
Project: 49623
Buggy source:
@Test public void listEntitlementsForExistingOwnerShouldPass(){
  for (int i=0; i < MAX_POOL_MEMBERS.longValue() / 2; i++) {
    Consumer c=TestUtil.createConsumer(type,owner);
    consumerCurator.create(c);
    entitler.entitle(owner,c,product);
  }
  for (int i=0; i < MAX_POOL_MEMBERS.longValue() / 2; i++) {
    Consumer c=TestUtil.createConsumer(type,owner);
    consumerCurator.create(c);
    entitler.entitle(owner,c,anotherProduct);
  }
  WebResource r=resource().path("String_Node_Str" + owner.getId() + "String_Node_Str");
  List<Entitlement> returned=r.accept("String_Node_Str").type("String_Node_Str").get(new GenericType<List<Entitlement>>(){
  }
);
  assertEquals(MAX_POOL_MEMBERS,new Long(returned.size()));
}

Fixed version (ground truth):
@Test public void listEntitlementsForExistingOwnerShouldPass(){
  for (int i=0; i < MAX_POOL_MEMBERS.longValue() / 2; i++) {
    Consumer c=TestUtil.createConsumer(type,owner);
    consumerCurator.create(c);
    entitler.entitle(c,product);
  }
  for (int i=0; i < MAX_POOL_MEMBERS.longValue() / 2; i++) {
    Consumer c=TestUtil.createConsumer(type,owner);
    consumerCurator.create(c);
    entitler.entitle(c,anotherProduct);
  }
  WebResource r=resource().path("String_Node_Str" + owner.getId() + "String_Node_Str");
  List<Entitlement> returned=r.accept("String_Node_Str").type("String_Node_Str").get(new GenericType<List<Entitlement>>(){
  }
);
  assertEquals(MAX_POOL_MEMBERS,new Long(returned.size()));
}
Program: 49624
Project: 49624
Buggy source:
@Override protected Injector getInjector(){
  return Guice.createInjector(new LinkedList<Module>(){
{
      add(PersistenceService.usingJpa().across(UnitOfWork.REQUEST).buildModule());
      add(new CandlepinProductionConfiguration());
      add(Servlets.configure().filters().filter("String_Node_Str").through(LoggingFilter.class).filter("String_Node_Str").through(Key.get(Filter.class,named(FilterConstants.BASIC_AUTH))).servlets().serve("String_Node_Str").with(ServletContainer.class).buildModule());
      add(Modules.override(new DefaultConfig()).with(new CustomizableModules().load()));
    }
  }
);
}

Fixed version (ground truth):
@Override protected Injector getInjector(){
  return Guice.createInjector(new LinkedList<Module>(){
{
      add(PersistenceService.usingJpa().across(UnitOfWork.REQUEST).buildModule());
      add(new CandlepinProductionConfiguration());
      add(Servlets.configure().filters().filter("String_Node_Str").through(LoggingFilter.class).filter("String_Node_Str").through(Key.get(Filter.class,named(FilterConstants.BASIC_AUTH))).servlets().serve("String_Node_Str").with(Key.get(ServletContainer.class,named(CANDLEPIN_SERVLET)),new HashMap<String,String>(){
{
          put("String_Node_Str","String_Node_Str");
        }
      }
).buildModule());
      add(new ServletConfig());
      add(Modules.override(new DefaultConfig()).with(new CustomizableModules().load()));
    }
  }
);
}
Program: 49625
Project: 49625
Buggy source:
public void doFilter(ServletRequest request,ServletResponse response,FilterChain chain) throws IOException, ServletException {
}

Fixed version (ground truth):
public void doFilter(ServletRequest request,ServletResponse response,FilterChain chain) throws IOException, ServletException {
  log.debug("String_Node_Str");
  HttpServletRequest httpRequest=(HttpServletRequest)request;
  HttpServletResponse httpResponse=(HttpServletResponse)response;
  String auth=httpRequest.getHeader("String_Node_Str");
  if (auth != null && auth.toUpperCase().startsWith("String_Node_Str") && httpRequest.getMethod().equals("String_Node_Str")) {
    String userpassEncoded=auth.substring(6);
    String[] userpass=Base64.base64Decode(userpassEncoded).split("String_Node_Str");
    try {
      doBasicAuth(userpass[0],userpass[1]);
      request.setAttribute("String_Node_Str",userpass[0]);
      chain.doFilter(request,response);
    }
 catch (    ForbiddenException ex) {
      httpResponse.setStatus(HttpServletResponse.SC_FORBIDDEN);
    }
catch (    Exception ex) {
      log.error(ex.getMessage());
      httpResponse.setStatus(HttpServletResponse.SC_BAD_GATEWAY);
    }
  }
  chain.doFilter(request,response);
  log.debug("String_Node_Str");
}
Program: 49626
Project: 49626
Buggy source:
@Before public void setUp(){
  consumerResource=new ConsumerResource(ownerCurator,consumerCurator,consumerTypeCurator,consumerIdCertCurator);
  standardSystemType=consumerTypeCurator.create(new ConsumerType("String_Node_Str"));
  owner=ownerCurator.create(new Owner("String_Node_Str"));
}

Fixed version (ground truth):
@Before public void setUp(){
  consumerResource=new ConsumerResource(ownerCurator,consumerCurator,consumerTypeCurator,consumerIdCertCurator,httpServletRequest);
  standardSystemType=consumerTypeCurator.create(new ConsumerType("String_Node_Str"));
  owner=ownerCurator.create(new Owner("String_Node_Str"));
}
Program: 49627
Project: 49627
Buggy source:
public Properties parseConfig(Map<String,String> inputConfiguration){
  Properties toReturn=new Properties(defaultConfigurationSettings());
  toReturn.putAll(stripPrefixFromConfigKeys(inputConfiguration));
  return toReturn;
}

Fixed version (ground truth):
public Properties parseConfig(Map<String,String> inputConfiguration){
  Properties toReturn=new Properties();
  toReturn.putAll(stripPrefixFromConfigKeys(inputConfiguration));
  return toReturn;
}
Program: 49628
Project: 49628
Buggy source:
public Properties loadDefaultConfigurationSettings(String persistenceUnit,File configFile) throws XPathExpressionException, IOException, ParserConfigurationException, SAXException {
  return parsePropertiesFromConfigFile(persistenceUnit,parseXML(configFile));
}

Fixed version (ground truth):
/** 
 * loads the default configuration from the file.
 * @param persistenceUnit JPA persistence unit name.
 * @param configFile location of the configuration file.
 * @return jpa configuration as a JPA for the given unit name.
 * @throws XPathExpressionException thrown for invalid xml file
 * @throws IOException thrown if file is not found.
 * @throws ParserConfigurationException thrown for invalid xml file
 * @throws SAXException thrown for invalid xml file
 */
public Properties loadDefaultConfigurationSettings(String persistenceUnit,File configFile) throws XPathExpressionException, IOException, ParserConfigurationException, SAXException {
  return parsePropertiesFromConfigFile(persistenceUnit,parseXML(configFile));
}
Program: 49629
Project: 49629
Buggy source:
public Document parseXML(File file) throws IOException, ParserConfigurationException, SAXException {
  DocumentBuilderFactory domFactory=DocumentBuilderFactory.newInstance();
  domFactory.setNamespaceAware(false);
  DocumentBuilder builder=domFactory.newDocumentBuilder();
  Document doc=builder.parse(file);
  return doc;
}

Fixed version (ground truth):
/** 
 * parses the XML file.
 * @param file file to parse
 * @return returns XML Document for the given file.
 * @throws IOException thrown if there's a problem reading a file.
 * @throws ParserConfigurationException thrown for invalid xml file.
 * @throws SAXException thrown for invalid xml file.
 */
public Document parseXML(File file) throws IOException, ParserConfigurationException, SAXException {
  DocumentBuilderFactory domFactory=DocumentBuilderFactory.newInstance();
  domFactory.setNamespaceAware(false);
  DocumentBuilder builder=domFactory.newDocumentBuilder();
  Document doc=builder.parse(file);
  return doc;
}
Program: 49630
Project: 49630
Buggy source:
public Properties parseConfig(Map<String,String> inputConfiguration){
  Properties toReturn=new Properties(defaultConfigurationSettings());
  toReturn.putAll(stripPrefixFromConfigKeys(inputConfiguration));
  return toReturn;
}

Fixed version (ground truth):
/** 
 * Converts the given Map into a Properties object. 
 * @param inputConfiguration Configuration to be converted.
 * @return config as a Properties file
 */
public Properties parseConfig(Map<String,String> inputConfiguration){
  Properties toReturn=new Properties(defaultConfigurationSettings());
  toReturn.putAll(stripPrefixFromConfigKeys(inputConfiguration));
  return toReturn;
}
Program: 49631
Project: 49631
Buggy source:
public Properties parsePropertiesFromConfigFile(String persistenceUnitName,Document doc) throws XPathExpressionException {
  XPath xpath=XPathFactory.newInstance().newXPath();
  XPathExpression expr=xpath.compile("String_Node_Str" + persistenceUnitName + "String_Node_Str");
  Object result=expr.evaluate(doc,XPathConstants.NODESET);
  NodeList nodes=(NodeList)result;
  Properties toReturn=new Properties();
  for (int i=0; i < nodes.getLength(); i++) {
    String name=nodeValue(nodes,i,"String_Node_Str");
    String value=nodeValue(nodes,i,"String_Node_Str");
    toReturn.put(name,value);
  }
  return toReturn;
}

Fixed version (ground truth):
/** 
 * @param persistenceUnitName jpa persistence unit name
 * @param doc XML Document
 * @return configuration as a Properties.
 * @throws XPathExpressionException thrown for invalid xml file.
 */
public Properties parsePropertiesFromConfigFile(String persistenceUnitName,Document doc) throws XPathExpressionException {
  XPath xpath=XPathFactory.newInstance().newXPath();
  XPathExpression expr=xpath.compile("String_Node_Str" + persistenceUnitName + "String_Node_Str");
  Object result=expr.evaluate(doc,XPathConstants.NODESET);
  NodeList nodes=(NodeList)result;
  Properties toReturn=new Properties();
  for (int i=0; i < nodes.getLength(); i++) {
    String name=nodeValue(nodes,i,"String_Node_Str");
    String value=nodeValue(nodes,i,"String_Node_Str");
    toReturn.put(name,value);
  }
  return toReturn;
}
Program: 49632
Project: 49632
Buggy source:
public Properties defaultConfigurationSettings(){
  try {
    return loadDefaultConfigurationSettings("String_Node_Str",new File(getClass().getResource("String_Node_Str").toURI()));
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * @return the default jpa configuration
 */
public Properties defaultConfigurationSettings(){
  try {
    return loadDefaultConfigurationSettings("String_Node_Str",new File(getClass().getResource("String_Node_Str").toURI()));
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}
Program: 49633
Project: 49633
Buggy source:
public Properties stripPrefixFromConfigKeys(Map<String,String> inputConfiguration){
  Properties toReturn=new Properties();
  for (  String key : inputConfiguration.keySet()) {
    toReturn.put(key.substring(PREFIX_LENGTH + 1),inputConfiguration.get(key));
  }
  return toReturn;
}

Fixed version (ground truth):
/** 
 * Return a copy of the input without the prefixes.
 * @param inputConfiguration Configuration to be converted.
 * @return config as a Properties object without the prefixes.
 */
public Properties stripPrefixFromConfigKeys(Map<String,String> inputConfiguration){
  Properties toReturn=new Properties();
  for (  String key : inputConfiguration.keySet()) {
    toReturn.put(key.substring(PREFIX_LENGTH + 1),inputConfiguration.get(key));
  }
  return toReturn;
}
Program: 49634
Project: 49634
Buggy source:
/** 
 * Returns all the entitlement pools for the consumer with the given uuid.
 * @param consumerUuid whose entitlement pools are sought.
 * @return all the entitlement pools for the consumer with the given uuid.
 */
@GET @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) @Path("String_Node_Str") public List<EntitlementPool> listByConsumer(@PathParam("String_Node_Str") String consumerUuid){
  log.debug("String_Node_Str" + consumer_uuid);
  Consumer consumer=consumerCurator.lookupByUuid(consumer_uuid);
  log.debug("String_Node_Str" + consumer.toString());
  List<EntitlementPool> eps=entitlementPoolCurator.listByConsumer(consumer);
  log.debug("String_Node_Str" + eps.toString());
  return eps;
}

Fixed version (ground truth):
/** 
 * Returns all the entitlement pools for the consumer with the given uuid.
 * @param consumerUuid whose entitlement pools are sought.
 * @return all the entitlement pools for the consumer with the given uuid.
 */
@GET @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) @Path("String_Node_Str") public List<EntitlementPool> listByConsumer(@PathParam("String_Node_Str") String consumerUuid){
  log.debug("String_Node_Str" + consumerUuid);
  Consumer consumer=consumerCurator.lookupByUuid(consumerUuid);
  log.debug("String_Node_Str" + consumer.toString());
  List<EntitlementPool> eps=entitlementPoolCurator.listByConsumer(consumer);
  log.debug("String_Node_Str" + eps.toString());
  return eps;
}
Program: 49635
Project: 49635
Buggy source:
public static Properties stripPrefixFromConfigKeys(Map<String,String> inputConfiguration){
  Properties toReturn=new Properties();
  for (  String key : inputConfiguration.keySet()) {
    toReturn.put(key.substring(PREFIX_LENGTH),inputConfiguration.get(key));
  }
  return toReturn;
}

Fixed version (ground truth):
public static Properties stripPrefixFromConfigKeys(Map<String,String> inputConfiguration){
  Properties toReturn=new Properties();
  for (  String key : inputConfiguration.keySet()) {
    toReturn.put(key.substring(PREFIX_LENGTH + 1),inputConfiguration.get(key));
  }
  return toReturn;
}
Program: 49636
Project: 49636
Buggy source:
@Test public void shouldStripJPAConfigKeyPrefixes(){
  final String key1="String_Node_Str";
  final String key2="String_Node_Str";
  Map<String,String> configuraton=new HashMap<String,String>(){
{
      put(JPAConfiguration.JPA_CONFIG_PREFIX + key1,"String_Node_Str");
      put(JPAConfiguration.JPA_CONFIG_PREFIX + key2,"String_Node_Str");
    }
  }
;
  Properties stripped=JPAConfiguration.stripPrefixFromConfigKeys(configuraton);
  assertEquals(2,stripped.size());
  assertTrue(stripped.containsKey(key1));
  assertTrue(stripped.containsKey(key2));
}

Fixed version (ground truth):
@Test public void shouldStripJPAConfigKeyPrefixes(){
  final String key1="String_Node_Str";
  final String key2="String_Node_Str";
  Map<String,String> configuraton=new HashMap<String,String>(){
{
      put(JPAConfiguration.JPA_CONFIG_PREFIX + "String_Node_Str" + key1,"String_Node_Str");
      put(JPAConfiguration.JPA_CONFIG_PREFIX + "String_Node_Str" + key2,"String_Node_Str");
    }
  }
;
  Properties stripped=JPAConfiguration.stripPrefixFromConfigKeys(configuraton);
  assertEquals(2,stripped.size());
  assertTrue(stripped.containsKey(key1));
  assertTrue(stripped.containsKey(key2));
}
Program: 49637
Project: 49637
Buggy source:
@GET @Path("String_Node_Str") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) public Consumer getConsumer(){
  Consumer consumer=new Consumer();
  Product product=new Product("String_Node_Str","String_Node_Str");
  consumer.addConsumedProduct(product);
  return consumer;
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) public Consumer getConsumer(){
  Consumer consumer=new Consumer();
  Product product=new Product("String_Node_Str","String_Node_Str");
  return consumer;
}
Program: 49638
Project: 49638
Buggy source:
private void runPre(PreEntHelper preHelper,Consumer consumer,EntitlementPool pool){
  Invocable inv=(Invocable)jsEngine;
  Product p=pool.getProduct();
  jsEngine.put("String_Node_Str",new ReadOnlyConsumer(consumer));
  jsEngine.put("String_Node_Str",new ReadOnlyProduct(pool.getProduct()));
  jsEngine.put("String_Node_Str",new ReadOnlyEntitlementPool(pool));
  jsEngine.put("String_Node_Str",preHelper);
  try {
    inv.invokeFunction(PRE_PREFIX + p.getLabel());
  }
 catch (  NoSuchMethodException e) {
    try {
      inv.invokeFunction(GLOBAL_PRE_FUNCTION);
    }
 catch (    NoSuchMethodException ex) {
    }
catch (    ScriptException ex) {
      throw new RuleExecutionException(ex);
    }
  }
catch (  ScriptException e) {
    throw new RuleExecutionException(e);
  }
}

Fixed version (ground truth):
private void runPre(PreEntHelper preHelper,Consumer consumer,EntitlementPool pool){
  Invocable inv=(Invocable)jsEngine;
  String productOID=pool.getProduct();
  jsEngine.put("String_Node_Str",new ReadOnlyConsumer(consumer));
  jsEngine.put("String_Node_Str",new ReadOnlyProduct(prodAdapter.getProductByOID(productOID)));
  jsEngine.put("String_Node_Str",new ReadOnlyEntitlementPool(pool));
  jsEngine.put("String_Node_Str",preHelper);
  try {
    inv.invokeFunction(PRE_PREFIX + productOID);
  }
 catch (  NoSuchMethodException e) {
    try {
      inv.invokeFunction(GLOBAL_PRE_FUNCTION);
    }
 catch (    NoSuchMethodException ex) {
    }
catch (    ScriptException ex) {
      throw new RuleExecutionException(ex);
    }
  }
catch (  ScriptException e) {
    throw new RuleExecutionException(e);
  }
}
Program: 49639
Project: 49639
Buggy source:
private void runPost(PostEntHelper postHelper,Entitlement ent){
  Invocable inv=(Invocable)jsEngine;
  EntitlementPool pool=ent.getPool();
  Consumer c=ent.getConsumer();
  Product p=pool.getProduct();
  jsEngine.put("String_Node_Str",new ReadOnlyConsumer(c));
  jsEngine.put("String_Node_Str",new ReadOnlyProduct(pool.getProduct()));
  jsEngine.put("String_Node_Str",postHelper);
  jsEngine.put("String_Node_Str",new ReadOnlyEntitlement(ent));
  try {
    inv.invokeFunction(POST_PREFIX + p.getLabel());
  }
 catch (  NoSuchMethodException e) {
    try {
      inv.invokeFunction(GLOBAL_POST_FUNCTION);
    }
 catch (    NoSuchMethodException ex) {
    }
catch (    ScriptException ex) {
      throw new RuleExecutionException(ex);
    }
  }
catch (  ScriptException e) {
    throw new RuleExecutionException(e);
  }
}

Fixed version (ground truth):
private void runPost(PostEntHelper postHelper,Entitlement ent){
  Invocable inv=(Invocable)jsEngine;
  EntitlementPool pool=ent.getPool();
  Consumer c=ent.getConsumer();
  String productOID=pool.getProduct();
  jsEngine.put("String_Node_Str",new ReadOnlyConsumer(c));
  jsEngine.put("String_Node_Str",new ReadOnlyProduct(prodAdapter.getProductByOID(productOID)));
  jsEngine.put("String_Node_Str",postHelper);
  jsEngine.put("String_Node_Str",new ReadOnlyEntitlement(ent));
  try {
    inv.invokeFunction(POST_PREFIX + productOID);
  }
 catch (  NoSuchMethodException e) {
    try {
      inv.invokeFunction(GLOBAL_POST_FUNCTION);
    }
 catch (    NoSuchMethodException ex) {
    }
catch (    ScriptException ex) {
      throw new RuleExecutionException(ex);
    }
  }
catch (  ScriptException e) {
    throw new RuleExecutionException(e);
  }
}
Program: 49640
Project: 49640
Buggy source:
@Inject public JavascriptEnforcer(DateSource dateSource,RulesCurator rulesCurator,PreEntHelper preHelper,PostEntHelper postHelper,ProductServiceAdapter prodAdapter){
  this.dateSource=dateSource;
  this.rulesCurator=rulesCurator;
  this.preHelper=preHelper;
  this.postHelper=postHelper;
  this.prodAdapter=prodAdapter;
  ScriptEngineManager mgr=new ScriptEngineManager();
  jsEngine=mgr.getEngineByName("String_Node_Str");
  if (jsEngine == null) {
    throw new RuntimeException("String_Node_Str");
  }
  try {
    Reader reader=new StringReader(this.rulesCurator.getRules().getRules());
    jsEngine.eval(reader);
  }
 catch (  ScriptException ex) {
    throw new RuleParseException(ex);
  }
  this.rules=new Rules(this.rulesCurator.getRules().getRules(),prodAdapter);
}

Fixed version (ground truth):
@Inject public JavascriptEnforcer(DateSource dateSource,RulesCurator rulesCurator,PreEntHelper preHelper,PostEntHelper postHelper,ProductServiceAdapter prodAdapter){
  this.dateSource=dateSource;
  this.rulesCurator=rulesCurator;
  this.preHelper=preHelper;
  this.postHelper=postHelper;
  this.prodAdapter=prodAdapter;
  ScriptEngineManager mgr=new ScriptEngineManager();
  jsEngine=mgr.getEngineByName("String_Node_Str");
  if (jsEngine == null) {
    throw new RuntimeException("String_Node_Str");
  }
  try {
    Reader reader=new StringReader(this.rulesCurator.getRules().getRules());
    jsEngine.eval(reader);
  }
 catch (  ScriptException ex) {
    throw new RuleParseException(ex);
  }
}
Program: 49641
Project: 49641
Buggy source:
public EnforcerImpl(DateSource dateSource){
  this.dateSource=dateSource;
}

Fixed version (ground truth):
public EnforcerImpl(DateSource dateSource,EntitlementPoolCurator epCurator){
  this.dateSource=dateSource;
  this.epCurator=epCurator;
}
Program: 49642
Project: 49642
Buggy source:
@Override public boolean validate(Consumer consumer,EntitlementPool enitlementPool){
  if (!enitlementPool.hasAvailableEntitlements()) {
    errors.add(new ValidationError("String_Node_Str"));
    return false;
  }
  if (enitlementPool.isExpired(dateSource)) {
    errors.add(new ValidationError("String_Node_Str" + enitlementPool.getProduct().getName() + "String_Node_Str"+ enitlementPool.getEndDate()));
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean validate(Consumer consumer,EntitlementPool enitlementPool){
  if (!epCurator.entitlementsAvailable(enitlementPool)) {
    errors.add(new ValidationError("String_Node_Str"));
    return false;
  }
  if (enitlementPool.isExpired(dateSource)) {
    errors.add(new ValidationError("String_Node_Str" + enitlementPool.getProduct().getName() + "String_Node_Str"+ enitlementPool.getEndDate()));
    return false;
  }
  return true;
}
Program: 49643
Project: 49643
Buggy source:
/** 
 * Entitles the given Consumer with the given Product.
 * @param c Consumer to be entitled
 * @param p The Product
 * @return Entitled object
 */
@POST @Consumes({MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) @Path("String_Node_Str") public Object entitle(@FormParam("String_Node_Str") String consumerUuid,@FormParam("String_Node_Str") String productLabel){
  Owner owner=getCurrentUsersOwner(ownerCurator);
  Consumer consumer=consumerCurator.lookupByUuid(consumerUuid);
  if (consumer == null) {
    throw new RuntimeException("String_Node_Str" + consumerUuid);
  }
  Product p=productCurator.lookupByLabel(productLabel);
  if (p == null) {
    throw new RuntimeException("String_Node_Str" + productLabel);
  }
  EntitlementPool ePool=epCurator.lookupByOwnerAndProduct(owner,consumer,p);
  if (ePool == null) {
    throw new RuntimeException("String_Node_Str" + p.getName());
  }
  if (!enforcer.validate(consumer,ePool)) {
    throw new RuntimeException(enforcer.errors().toString());
  }
  Entitlement e=epCurator.createEntitlement(ePool,consumer);
  return CertGenerator.getCertString();
}

Fixed version (ground truth):
/** 
 * Entitles the given Consumer with the given Product.
 * @param c Consumer to be entitled
 * @param p The Product
 * @return Entitled object
 */
@POST @Consumes({MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) @Path("String_Node_Str") public Object entitle(@FormParam("String_Node_Str") String consumerUuid,@FormParam("String_Node_Str") String productLabel){
  Owner owner=getCurrentUsersOwner(ownerCurator);
  Consumer consumer=consumerCurator.lookupByUuid(consumerUuid);
  if (consumer == null) {
    throw new RuntimeException("String_Node_Str" + consumerUuid);
  }
  Product p=productCurator.lookupByLabel(productLabel);
  if (p == null) {
    throw new RuntimeException("String_Node_Str" + productLabel);
  }
  EntitlementPool ePool=epCurator.lookupByOwnerAndProduct(owner,consumer,p);
  if (ePool == null) {
    throw new RuntimeException("String_Node_Str" + p.getName());
  }
  Enforcer enforcer=new EnforcerImpl(dateSource,epCurator);
  if (!enforcer.validate(consumer,ePool)) {
    throw new RuntimeException(enforcer.errors().toString());
  }
  Entitlement e=epCurator.createEntitlement(ePool,consumer);
  return CertGenerator.getCertString();
}
Program: 49644
Project: 49644
Buggy source:
@GET @Path("String_Node_Str") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) public ConsumerInfo getInfo(){
  ConsumerInfo ci=new ConsumerInfo();
  ci.setType(ConsumerInfo.TYPE_SYSTEM);
  ci.setParent(null);
  ci.setMetadataField("String_Node_Str","String_Node_Str");
  ci.setMetadataField("String_Node_Str","String_Node_Str");
  System.out.println(ci.getMetadata());
  return ci;
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) public ConsumerInfo getInfo(){
  ConsumerInfo ci=new ConsumerInfo();
  ci.setType(new ConsumerType("String_Node_Str"));
  ci.setParent(null);
  ci.setMetadataField("String_Node_Str","String_Node_Str");
  ci.setMetadataField("String_Node_Str","String_Node_Str");
  System.out.println(ci.getMetadata());
  return ci;
}
Program: 49645
Project: 49645
Buggy source:
public void testJSON(){
}

Fixed version (ground truth):
public void testJSON(){
  ClientConfig cc=new DefaultClientConfig();
  Client c=Client.create(cc);
  Consumer consumer=TestUtil.createConsumer();
  String uuid=consumer.getUuid();
  WebResource deleteResource=c.resource("String_Node_Str");
  deleteResource.accept("String_Node_Str").type("String_Node_Str").delete(consumer);
  assertNull(ObjectFactory.get().lookupByUUID(c.getClass(),uuid));
}
Program: 49646
Project: 49646
Buggy source:
public void setName(String name){
  this.name=name;
}

Fixed version (ground truth):
/** 
 * Set the name of the model object.
 * @param name name of the object
 */
public void setName(String name){
  this.name=name;
}
Program: 49647
Project: 49647
Buggy source:
public String getName(){
  return name;
}

Fixed version (ground truth):
/** 
 * Returns the name of the object.
 * @return the name of the object.
 */
public String getName(){
  return name;
}
Program: 49648
Project: 49648
Buggy source:
public String getUuid(){
  return uuid;
}

Fixed version (ground truth):
/** 
 * Returns the unique id of the model object.
 * @return the unique id of the model object.
 */
public String getUuid(){
  return uuid;
}