Program: 106578
Project: 106578
Buggy source:
@Override public boolean authenticate(String username,String password,Long domainId,Map<String,Object[]> requestParameters){
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + username);
  }
  UserAccount user=_userAccountDao.getUserAccount(username,domainId);
  if (user == null) {
    s_logger.debug("String_Node_Str" + username + "String_Node_Str"+ domainId);
    return false;
  }
  String url=_configDao.getValue(LDAPParams.hostname.toString());
  if (url == null) {
    s_logger.debug("String_Node_Str");
    return false;
  }
  String port=_configDao.getValue(LDAPParams.port.toString());
  String queryFilter=_configDao.getValue(LDAPParams.queryfilter.toString());
  String searchBase=_configDao.getValue(LDAPParams.searchbase.toString());
  String useSSL=_configDao.getValue(LDAPParams.usessl.toString());
  String bindDN=_configDao.getValue(LDAPParams.dn.toString());
  String bindPasswd=_configDao.getValue(LDAPParams.passwd.toString());
  try {
    Hashtable<String,String> env=new Hashtable<String,String>(11);
    env.put(Context.INITIAL_CONTEXT_FACTORY,"String_Node_Str");
    env.put(Context.PROVIDER_URL,"String_Node_Str" + url + "String_Node_Str"+ port);
    if (new Boolean(useSSL) == Boolean.TRUE)     env.put(Context.SECURITY_PROTOCOL,"String_Node_Str");
    env.put(Context.SECURITY_PRINCIPAL,bindDN);
    env.put(Context.SECURITY_CREDENTIALS,bindPasswd);
    DirContext ctx=new InitialDirContext(env);
    queryFilter=queryFilter.replaceAll("String_Node_Str",username);
    queryFilter=queryFilter.replaceAll("String_Node_Str",user.getFirstname() + "String_Node_Str" + user.getLastname());
    queryFilter=queryFilter.replaceAll("String_Node_Str",user.getEmail());
    SearchControls sc=new SearchControls();
    String[] searchFilter={"String_Node_Str"};
    sc.setReturningAttributes(new String[0]);
    sc.setReturningAttributes(searchFilter);
    sc.setSearchScope(SearchControls.SUBTREE_SCOPE);
    sc.setCountLimit(1);
    NamingEnumeration<SearchResult> answer=ctx.search(searchBase,queryFilter,sc);
    SearchResult sr=(SearchResult)answer.next();
    String cn=sr.getName();
    answer.close();
    ctx.close();
    s_logger.info("String_Node_Str" + cn);
    env=new Hashtable<String,String>(11);
    env.put(Context.INITIAL_CONTEXT_FACTORY,"String_Node_Str");
    env.put(Context.PROVIDER_URL,"String_Node_Str" + url + "String_Node_Str"+ port);
    if (new Boolean(useSSL) == Boolean.TRUE)     env.put(Context.SECURITY_PROTOCOL,"String_Node_Str");
    env.put(Context.SECURITY_PRINCIPAL,cn + "String_Node_Str" + searchBase);
    env.put(Context.SECURITY_CREDENTIALS,password);
    ctx=new InitialDirContext(env);
    ctx.close();
  }
 catch (  NamingException ne) {
    ne.printStackTrace();
    s_logger.warn("String_Node_Str" + ne.getMessage());
    return false;
  }
catch (  Exception e) {
    s_logger.warn("String_Node_Str" + e.getMessage());
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean authenticate(String username,String password,Long domainId,Map<String,Object[]> requestParameters){
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + username);
  }
  UserAccount user=_userAccountDao.getUserAccount(username,domainId);
  if (user == null) {
    s_logger.debug("String_Node_Str" + username + "String_Node_Str"+ domainId);
    return false;
  }
  String url=_configDao.getValue(LDAPParams.hostname.toString());
  if (url == null) {
    s_logger.debug("String_Node_Str");
    return false;
  }
  String port=_configDao.getValue(LDAPParams.port.toString());
  String queryFilter=_configDao.getValue(LDAPParams.queryfilter.toString());
  String searchBase=_configDao.getValue(LDAPParams.searchbase.toString());
  String useSSL=_configDao.getValue(LDAPParams.usessl.toString());
  String bindDN=_configDao.getValue(LDAPParams.dn.toString());
  String bindPasswd=_configDao.getValue(LDAPParams.passwd.toString());
  try {
    Hashtable<String,String> env=new Hashtable<String,String>(11);
    env.put(Context.INITIAL_CONTEXT_FACTORY,"String_Node_Str");
    String protocol="String_Node_Str";
    if (new Boolean(useSSL)) {
      env.put(Context.SECURITY_PROTOCOL,"String_Node_Str");
      protocol="String_Node_Str";
    }
    env.put(Context.PROVIDER_URL,protocol + url + "String_Node_Str"+ port);
    env.put(Context.SECURITY_PRINCIPAL,bindDN);
    env.put(Context.SECURITY_CREDENTIALS,bindPasswd);
    DirContext ctx=new InitialDirContext(env);
    queryFilter=queryFilter.replaceAll("String_Node_Str",username);
    queryFilter=queryFilter.replaceAll("String_Node_Str",user.getFirstname() + "String_Node_Str" + user.getLastname());
    queryFilter=queryFilter.replaceAll("String_Node_Str",user.getEmail());
    SearchControls sc=new SearchControls();
    String[] searchFilter={"String_Node_Str"};
    sc.setReturningAttributes(new String[0]);
    sc.setReturningAttributes(searchFilter);
    sc.setSearchScope(SearchControls.SUBTREE_SCOPE);
    sc.setCountLimit(1);
    NamingEnumeration<SearchResult> answer=ctx.search(searchBase,queryFilter,sc);
    SearchResult sr=(SearchResult)answer.next();
    String cn=sr.getName();
    answer.close();
    ctx.close();
    s_logger.info("String_Node_Str" + cn);
    env=new Hashtable<String,String>(11);
    env.put(Context.INITIAL_CONTEXT_FACTORY,"String_Node_Str");
    env.put(Context.PROVIDER_URL,"String_Node_Str" + url + "String_Node_Str"+ port);
    if (new Boolean(useSSL) == Boolean.TRUE)     env.put(Context.SECURITY_PROTOCOL,"String_Node_Str");
    env.put(Context.SECURITY_PRINCIPAL,cn + "String_Node_Str" + searchBase);
    env.put(Context.SECURITY_CREDENTIALS,password);
    ctx=new InitialDirContext(env);
    ctx.close();
  }
 catch (  NamingException ne) {
    ne.printStackTrace();
    s_logger.warn("String_Node_Str" + ne.getMessage());
    return false;
  }
catch (  Exception e) {
    s_logger.warn("String_Node_Str" + e.getMessage());
    return false;
  }
  return true;
}