Program: 25336
Project: 25336
Buggy source:
public GrillSessionHandle openSession(String username,String password,Map<String,String> configuration) throws GrillException {
  SessionHandle sessionHandle;
  username=UtilityMethods.removeDomain(username);
  doPasswdAuth(username,password);
  try {
    Map<String,String> sessionConf=new HashMap<String,String>();
    sessionConf.putAll(GrillSessionImpl.DEFAULT_HIVE_SESSION_CONF);
    if (configuration != null) {
      sessionConf.putAll(configuration);
    }
    Map<String,String> userConfig=UserConfigLoaderFactory.getUserConfig(username);
    UtilityMethods.mergeMaps(sessionConf,userConfig,false);
    sessionConf.put(GrillConfConstants.GRILL_SESSION_LOGGEDIN_USER,username);
    if (sessionConf.get(GrillConfConstants.GRILL_SESSION_CLUSTER_USER) == null) {
      LOG.info("String_Node_Str" + username);
      sessionConf.put(GrillConfConstants.GRILL_SESSION_CLUSTER_USER,username);
    }
    String clusterUser=sessionConf.get(GrillConfConstants.GRILL_SESSION_CLUSTER_USER);
    password="String_Node_Str";
    if (cliService.getHiveConf().getVar(ConfVars.HIVE_SERVER2_AUTHENTICATION).equals(HiveAuthFactory.AuthTypes.KERBEROS.toString()) && cliService.getHiveConf().getBoolVar(ConfVars.HIVE_SERVER2_ENABLE_DOAS)) {
      String delegationTokenStr=null;
      try {
        delegationTokenStr=cliService.getDelegationTokenFromMetaStore(username);
      }
 catch (      UnsupportedOperationException e) {
      }
      sessionHandle=cliService.openSessionWithImpersonation(clusterUser,password,sessionConf,delegationTokenStr);
    }
 else {
      sessionHandle=cliService.openSession(clusterUser,password,sessionConf);
    }
  }
 catch (  Exception e) {
    throw new GrillException(e);
  }
  GrillSessionHandle grillSession=new GrillSessionHandle(sessionHandle.getHandleIdentifier().getPublicId(),sessionHandle.getHandleIdentifier().getSecretId());
  sessionMap.put(grillSession.getPublicId().toString(),grillSession);
  return grillSession;
}

Fixed version (ground truth):
public GrillSessionHandle openSession(String username,String password,Map<String,String> configuration) throws GrillException {
  if (StringUtils.isBlank(username)) {
    throw new BadRequestException("String_Node_Str");
  }
  SessionHandle sessionHandle;
  username=UtilityMethods.removeDomain(username);
  doPasswdAuth(username,password);
  try {
    Map<String,String> sessionConf=new HashMap<String,String>();
    sessionConf.putAll(GrillSessionImpl.DEFAULT_HIVE_SESSION_CONF);
    if (configuration != null) {
      sessionConf.putAll(configuration);
    }
    Map<String,String> userConfig=UserConfigLoaderFactory.getUserConfig(username);
    UtilityMethods.mergeMaps(sessionConf,userConfig,false);
    sessionConf.put(GrillConfConstants.GRILL_SESSION_LOGGEDIN_USER,username);
    if (sessionConf.get(GrillConfConstants.GRILL_SESSION_CLUSTER_USER) == null) {
      LOG.info("String_Node_Str" + username);
      sessionConf.put(GrillConfConstants.GRILL_SESSION_CLUSTER_USER,username);
    }
    String clusterUser=sessionConf.get(GrillConfConstants.GRILL_SESSION_CLUSTER_USER);
    password="String_Node_Str";
    if (cliService.getHiveConf().getVar(ConfVars.HIVE_SERVER2_AUTHENTICATION).equals(HiveAuthFactory.AuthTypes.KERBEROS.toString()) && cliService.getHiveConf().getBoolVar(ConfVars.HIVE_SERVER2_ENABLE_DOAS)) {
      String delegationTokenStr=null;
      try {
        delegationTokenStr=cliService.getDelegationTokenFromMetaStore(username);
      }
 catch (      UnsupportedOperationException e) {
      }
      sessionHandle=cliService.openSessionWithImpersonation(clusterUser,password,sessionConf,delegationTokenStr);
    }
 else {
      sessionHandle=cliService.openSession(clusterUser,password,sessionConf);
    }
  }
 catch (  Exception e) {
    throw new GrillException(e);
  }
  GrillSessionHandle grillSession=new GrillSessionHandle(sessionHandle.getHandleIdentifier().getPublicId(),sessionHandle.getHandleIdentifier().getSecretId());
  sessionMap.put(grillSession.getPublicId().toString(),grillSession);
  return grillSession;
}