Program: 125654
Project: 125654
Buggy source:
private Connection createHiveStandloneConnection(IMetadataConnection metadataConn) throws ClassNotFoundException, InstantiationException, IllegalAccessException, SQLException {
  Connection hiveStandaloneConn=null;
  String connURL=metadataConn.getUrl();
  if (connURL != null) {
    boolean useKerberos=Boolean.valueOf((String)metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_USE_KRB));
    boolean useMaprTicket=Boolean.valueOf((String)metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_HIVE_AUTHENTICATION_USE_MAPRTICKET));
    String hivePrincipal=(String)metadataConn.getParameter(ConnParameterKeys.HIVE_AUTHENTICATION_HIVEPRINCIPLA);
    ClassLoader hiveClassLoader=HiveClassLoaderFactory.getInstance().getClassLoader(metadataConn);
    if (useKerberos) {
      System.setProperty(HiveConfKeysForTalend.HIVE_CONF_KEY_HIVE_METASTORE_KERBEROS_PRINCIPAL.getKey(),hivePrincipal);
    }
    if (useMaprTicket) {
      setMaprTicketConfig(metadataConn,hiveClassLoader,useKerberos);
    }
    if (useKerberos) {
      String principal=(String)metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_KEYTAB_PRINCIPAL);
      String keytabPath=(String)metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_KEYTAB);
      boolean useKeytab=Boolean.valueOf((String)metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_USEKEYTAB));
      if (useKeytab) {
        try {
          ReflectionUtils.invokeStaticMethod("String_Node_Str",hiveClassLoader,"String_Node_Str",new String[]{principal,keytabPath});
        }
 catch (        Exception e) {
          throw new SQLException(e);
        }
      }
    }
    if (connURL.startsWith(DatabaseConnConstants.HIVE_2_URL_FORMAT)) {
      hiveStandaloneConn=createHive2StandaloneConnection(metadataConn);
    }
 else     if (connURL.startsWith(DatabaseConnConstants.HIVE_1_URL_FORMAT)) {
      hiveStandaloneConn=createHive1StandaloneConnection(metadataConn);
    }
 else {
    }
  }
  setHiveJDBCProperties(metadataConn,hiveStandaloneConn);
  return hiveStandaloneConn;
}

Fixed version (ground truth):
private Connection createHiveStandloneConnection(IMetadataConnection metadataConn) throws ClassNotFoundException, InstantiationException, IllegalAccessException, SQLException {
  Connection hiveStandaloneConn=null;
  String connURL=metadataConn.getUrl();
  if (connURL != null) {
    boolean useKerberos=Boolean.valueOf((String)metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_USE_KRB));
    boolean useMaprTicket=Boolean.valueOf((String)metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_HIVE_AUTHENTICATION_USE_MAPRTICKET));
    String hivePrincipal=(String)metadataConn.getParameter(ConnParameterKeys.HIVE_AUTHENTICATION_HIVEPRINCIPLA);
    ClassLoader hiveClassLoader=HiveClassLoaderFactory.getInstance().getClassLoader(metadataConn);
    if (useMaprTicket) {
      setMaprTicketPropertiesConfig(metadataConn);
    }
    if (useKerberos) {
      System.setProperty(HiveConfKeysForTalend.HIVE_CONF_KEY_HIVE_METASTORE_KERBEROS_PRINCIPAL.getKey(),hivePrincipal);
      String principal=(String)metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_KEYTAB_PRINCIPAL);
      String keytabPath=(String)metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_KEYTAB);
      boolean useKeytab=Boolean.valueOf((String)metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_USEKEYTAB));
      if (useKeytab) {
        try {
          ReflectionUtils.invokeStaticMethod("String_Node_Str",hiveClassLoader,"String_Node_Str",new String[]{principal,keytabPath});
        }
 catch (        Exception e) {
          throw new SQLException(e);
        }
      }
    }
    if (useMaprTicket) {
      setMaprTicketConfig(metadataConn,hiveClassLoader,useKerberos);
    }
    if (connURL.startsWith(DatabaseConnConstants.HIVE_2_URL_FORMAT)) {
      hiveStandaloneConn=createHive2StandaloneConnection(metadataConn);
    }
 else     if (connURL.startsWith(DatabaseConnConstants.HIVE_1_URL_FORMAT)) {
      hiveStandaloneConn=createHive1StandaloneConnection(metadataConn);
    }
 else {
    }
  }
  setHiveJDBCProperties(metadataConn,hiveStandaloneConn);
  return hiveStandaloneConn;
}