Program: 135754
Project: 135754
Buggy source:
private static Claim dbAuthenticate(PasswordCredentials creds,String domainName){
  Domain domain=null;
  User user=null;
  debug("String_Node_Str");
  try {
    Domains domains=domainStore.getDomains(domainName);
    List<Domain> domainList=domains.getDomains();
    if (domainList.size() == 0) {
      throw new AuthenticationException("String_Node_Str" + domainName + "String_Node_Str");
    }
    domain=domainList.get(0);
  }
 catch (  StoreException se) {
    throw new AuthenticationException("String_Node_Str" + se.toString());
  }
  try {
    debug("String_Node_Str");
    Users users=userStore.getUsers(creds.username());
    List<User> userList=users.getUsers();
    if (userList.size() == 0) {
      throw new AuthenticationException("String_Node_Str" + creds.username() + "String_Node_Str");
    }
    user=userList.get(0);
    if (!creds.password().equalsIgnoreCase(user.getPassword())) {
      throw new AuthenticationException("String_Node_Str");
    }
    debug("String_Node_Str");
    List<String> roles=new ArrayList<String>();
    Grants grants=grantStore.getGrants(domain.getDomainid(),user.getUserid());
    List<Grant> grantList=grants.getGrants();
    for (int z=0; z < grantList.size(); z++) {
      Grant grant=grantList.get(z);
      Role role=roleStore.getRole(grant.getRoleid());
      roles.add(role.getName());
    }
    debug("String_Node_Str");
    ClaimBuilder claim=new ClaimBuilder();
    claim.setUserId(user.getUserid().toString());
    claim.setUser(creds.username());
    claim.setDomain(domainName);
    for (int z=0; z < roles.size(); z++) {
      claim.addRole(roles.get(z));
    }
    return claim.build();
  }
 catch (  StoreException se) {
    throw new AuthenticationException("String_Node_Str" + se.toString());
  }
}

Fixed version (ground truth):
private static Claim dbAuthenticate(PasswordCredentials creds,String domainName){
  Domain domain=null;
  User user=null;
  debug("String_Node_Str");
  try {
    Domains domains=domainStore.getDomains(domainName);
    List<Domain> domainList=domains.getDomains();
    if (domainList.size() == 0) {
      throw new AuthenticationException("String_Node_Str" + domainName + "String_Node_Str");
    }
    domain=domainList.get(0);
  }
 catch (  StoreException se) {
    throw new AuthenticationException("String_Node_Str" + se.toString() + se);
  }
  try {
    debug("String_Node_Str");
    Users users=userStore.getUsers(creds.username());
    List<User> userList=users.getUsers();
    if (userList.size() == 0) {
      throw new AuthenticationException("String_Node_Str" + creds.username() + "String_Node_Str");
    }
    user=userList.get(0);
    if (!creds.password().equalsIgnoreCase(user.getPassword())) {
      throw new AuthenticationException("String_Node_Str");
    }
    debug("String_Node_Str");
    List<String> roles=new ArrayList<String>();
    Grants grants=grantStore.getGrants(domain.getDomainid(),user.getUserid());
    List<Grant> grantList=grants.getGrants();
    for (int z=0; z < grantList.size(); z++) {
      Grant grant=grantList.get(z);
      Role role=roleStore.getRole(grant.getRoleid());
      roles.add(role.getName());
    }
    debug("String_Node_Str");
    ClaimBuilder claim=new ClaimBuilder();
    claim.setUserId(user.getUserid().toString());
    claim.setUser(creds.username());
    claim.setDomain(domainName);
    for (int z=0; z < roles.size(); z++) {
      claim.addRole(roles.get(z));
    }
    return claim.build();
  }
 catch (  StoreException se) {
    throw new AuthenticationException("String_Node_Str" + se.toString() + se);
  }
}