Program: 125584
Project: 125584
Buggy source:
/** 
 * ggu Comment method "cloneOriginalValueConnection". only clone the properties of connection.
 * @param selectedContext
 */
public static DatabaseConnection cloneOriginalValueConnection(DatabaseConnection dbConn,boolean defaultContext,String selectedContext){
  if (dbConn == null) {
    return null;
  }
  ContextType contextType=ConnectionContextHelper.getContextTypeForContextMode(null,dbConn,selectedContext,defaultContext);
  DatabaseConnection cloneConn=ConnectionFactory.eINSTANCE.createDatabaseConnection();
  String server=ConnectionContextHelper.getOriginalValue(contextType,dbConn.getServerName());
  String username=ConnectionContextHelper.getOriginalValue(contextType,dbConn.getUsername());
  String password=ConnectionContextHelper.getOriginalValue(contextType,dbConn.getRawPassword());
  String port=ConnectionContextHelper.getOriginalValue(contextType,dbConn.getPort());
  String sidOrDatabase=ConnectionContextHelper.getOriginalValue(contextType,dbConn.getSID());
  String datasource=ConnectionContextHelper.getOriginalValue(contextType,dbConn.getDatasourceName());
  String filePath=ConnectionContextHelper.getOriginalValue(contextType,dbConn.getFileFieldName());
  String schemaOracle=ConnectionContextHelper.getOriginalValue(contextType,dbConn.getUiSchema());
  String dbRootPath=ConnectionContextHelper.getOriginalValue(contextType,dbConn.getDBRootPath());
  String additionParam=ConnectionContextHelper.getOriginalValue(contextType,dbConn.getAdditionalParams());
  String url=ConnectionContextHelper.getOriginalValue(contextType,dbConn.getURL());
  String className=ConnectionContextHelper.getOriginalValue(contextType,dbConn.getDriverClass());
  String jarPath=ConnectionContextHelper.getOriginalValue(contextType,dbConn.getDriverJarPath());
  String dbmsID=ConnectionContextHelper.getOriginalValue(contextType,dbConn.getDbmsId());
  filePath=TalendQuoteUtils.removeQuotes(filePath);
  dbRootPath=TalendQuoteUtils.removeQuotes(dbRootPath);
  cloneConn.setAdditionalParams(additionParam);
  cloneConn.setDatasourceName(datasource);
  cloneConn.setDBRootPath(dbRootPath);
  cloneConn.setFileFieldName(filePath);
  cloneConn.setRawPassword(password);
  cloneConn.setPort(port);
  cloneConn.setUiSchema(schemaOracle);
  cloneConn.setServerName(server);
  cloneConn.setSID(sidOrDatabase);
  cloneConn.setUsername(username);
  cloneConn.setDriverJarPath(jarPath);
  cloneConn.setComment(dbConn.getComment());
  cloneConn.setDatabaseType(dbConn.getDatabaseType());
  cloneConn.setDbmsId(dbmsID);
  cloneConn.setDivergency(dbConn.isDivergency());
  cloneConn.setDbVersionString(dbConn.getDbVersionString());
  cloneConn.setId(dbConn.getId());
  cloneConn.setLabel(dbConn.getLabel());
  cloneConn.setNullChar(dbConn.getNullChar());
  cloneConn.setProductId(dbConn.getProductId());
  cloneConn.setSqlSynthax(dbConn.getSqlSynthax());
  cloneConn.setStandardSQL(dbConn.isStandardSQL());
  cloneConn.setStringQuote(dbConn.getStringQuote());
  cloneConn.setSynchronised(dbConn.isSynchronised());
  cloneConn.setSystemSQL(dbConn.isSystemSQL());
  cloneConn.setVersion(dbConn.getVersion());
  cloneConn.setReadOnly(dbConn.isReadOnly());
  cloneConn.setDriverClass(className);
  cloneConn.setName(dbConn.getName());
  cloneOtherParameters(dbConn,cloneConn);
  if (dbConn.isSetSQLMode()) {
    cloneConn.setSQLMode(dbConn.isSQLMode());
  }
 else {
    cloneConn.setSQLMode(true);
  }
  ContextType hadoopClusterContextType=getHadoopClusterContextType(dbConn,defaultContext);
  if (EDatabaseTypeName.HIVE.equals(EDatabaseTypeName.getTypeFromDbType(dbConn.getDatabaseType()))) {
    String hadoopUserName=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_USERNAME);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_USERNAME,getOriginalValue(hadoopClusterContextType,contextType,hadoopUserName));
    String jobTracker=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_JOB_TRACKER_URL);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_JOB_TRACKER_URL,getOriginalValue(hadoopClusterContextType,contextType,jobTracker));
    String nameNode=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_NAME_NODE_URL);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_NAME_NODE_URL,getOriginalValue(hadoopClusterContextType,contextType,nameNode));
    String hivePrincipal=cloneConn.getParameters().get(ConnParameterKeys.HIVE_AUTHENTICATION_HIVEPRINCIPLA);
    cloneConn.getParameters().put(ConnParameterKeys.HIVE_AUTHENTICATION_HIVEPRINCIPLA,getOriginalValue(hadoopClusterContextType,contextType,hivePrincipal));
    String hiveMetadata=cloneConn.getParameters().get(ConnParameterKeys.HIVE_AUTHENTICATION_METASTOREURL);
    cloneConn.getParameters().put(ConnParameterKeys.HIVE_AUTHENTICATION_METASTOREURL,getOriginalValue(hadoopClusterContextType,contextType,hiveMetadata));
    String driverPath=cloneConn.getParameters().get(ConnParameterKeys.HIVE_AUTHENTICATION_DRIVERJAR_PATH);
    cloneConn.getParameters().put(ConnParameterKeys.HIVE_AUTHENTICATION_DRIVERJAR_PATH,getOriginalValue(hadoopClusterContextType,contextType,driverPath));
    String driverClass=cloneConn.getParameters().get(ConnParameterKeys.HIVE_AUTHENTICATION_DRIVERCLASS);
    cloneConn.getParameters().put(ConnParameterKeys.HIVE_AUTHENTICATION_DRIVERCLASS,getOriginalValue(hadoopClusterContextType,contextType,driverClass));
    String hiveUserName=cloneConn.getParameters().get(ConnParameterKeys.HIVE_AUTHENTICATION_USERNAME);
    cloneConn.getParameters().put(ConnParameterKeys.HIVE_AUTHENTICATION_USERNAME,getOriginalValue(hadoopClusterContextType,contextType,hiveUserName));
    String hivePassword=cloneConn.getParameters().get(ConnParameterKeys.HIVE_AUTHENTICATION_PASSWORD);
    cloneConn.getParameters().put(ConnParameterKeys.HIVE_AUTHENTICATION_PASSWORD,getOriginalValue(hadoopClusterContextType,contextType,hivePassword));
    String ktPrincipal=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_KEYTAB_PRINCIPAL);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_KEYTAB_PRINCIPAL,getOriginalValue(hadoopClusterContextType,contextType,ktPrincipal));
    String keytab=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_KEYTAB);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_KEYTAB,getOriginalValue(hadoopClusterContextType,contextType,keytab));
    String jdbcPropertiesString=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_JDBC_PROPERTIES);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HIVE_JDBC_PROPERTIES,HadoopRepositoryUtil.getOriginalValueOfProperties(jdbcPropertiesString,contextType));
    String additionalJDBCSettings=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_ADDITIONAL_JDBC_SETTINGS);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HIVE_ADDITIONAL_JDBC_SETTINGS,getOriginalValue(hadoopClusterContextType,contextType,additionalJDBCSettings));
    String propertiesString=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_PROPERTIES);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HIVE_PROPERTIES,HadoopRepositoryUtil.getOriginalValueOfProperties(propertiesString,contextType));
    String trustStorePath=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_SSL_TRUST_STORE_PATH);
    if (trustStorePath != null) {
      cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_SSL_TRUST_STORE_PATH,getOriginalValue(hadoopClusterContextType,contextType,trustStorePath));
    }
    String trustStorePassword=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_SSL_TRUST_STORE_PASSWORD);
    if (trustStorePassword != null) {
      cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_SSL_TRUST_STORE_PASSWORD,cloneConn.getValue(cloneConn.getValue(getOriginalValue(hadoopClusterContextType,contextType,trustStorePassword),false),true));
    }
    String template=null;
    String hiveServerVersion=HiveServerVersionInfo.HIVE_SERVER_1.getKey();
    EMap<String,String> parameterMap=dbConn.getParameters();
    if (parameterMap != null) {
      hiveServerVersion=parameterMap.get(ConnParameterKeys.HIVE_SERVER_VERSION);
    }
    if (HiveServerVersionInfo.HIVE_SERVER_2.getKey().equals(hiveServerVersion)) {
      template=DbConnStrForHive.URL_HIVE_2_TEMPLATE;
    }
 else {
      template=DbConnStrForHive.URL_HIVE_1_TEMPLATE;
    }
    String newURl=DatabaseConnStrUtil.getHiveURLString(cloneConn,server,port,sidOrDatabase,template);
    cloneConn.setURL(newURl);
    return cloneConn;
  }
  if (EDatabaseTypeName.HBASE.equals(EDatabaseTypeName.getTypeFromDbType(cloneConn.getDatabaseType()))) {
    String hbaseMasterPrin=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HBASE_AUTHENTICATION_MASTERPRINCIPAL);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HBASE_AUTHENTICATION_MASTERPRINCIPAL,getOriginalValue(hadoopClusterContextType,contextType,hbaseMasterPrin));
    String hbaseRegionPrin=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HBASE_AUTHENTICATION_REGIONSERVERPRINCIPAL);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HBASE_AUTHENTICATION_REGIONSERVERPRINCIPAL,getOriginalValue(hadoopClusterContextType,contextType,hbaseRegionPrin));
    String hbaseKeyTabPrin=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_KEYTAB_PRINCIPAL);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_KEYTAB_PRINCIPAL,getOriginalValue(hadoopClusterContextType,contextType,hbaseKeyTabPrin));
    String hbaseKeyTab=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_KEYTAB);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_KEYTAB,getOriginalValue(hadoopClusterContextType,contextType,hbaseKeyTab));
  }
  if (EDatabaseTypeName.IBMDB2.equals(EDatabaseTypeName.getTypeFromDbType(dbConn.getDatabaseType()))) {
    String cursorForDb2="String_Node_Str";
    String database=sidOrDatabase + cursorForDb2;
    String newURL=DatabaseConnStrUtil.getURLString(cloneConn.getDatabaseType(),dbConn.getDbVersionString(),server,username,password,port,database,filePath.toLowerCase(),datasource,dbRootPath,additionParam);
    cloneConn.setURL(newURL);
    return cloneConn;
  }
  if (contextType != null && !EDatabaseTypeName.GENERAL_JDBC.equals(EDatabaseTypeName.getTypeFromDbType(dbConn.getDatabaseType()))) {
    String newURL=DatabaseConnStrUtil.getURLString(cloneConn.getDatabaseType(),dbConn.getDbVersionString(),server,username,password,port,sidOrDatabase,filePath.toLowerCase(),datasource,dbRootPath,additionParam);
    cloneConn.setURL(newURL);
    return cloneConn;
  }
  if (dbConn.getURL() != null && !dbConn.getURL().equals("String_Node_Str")) {
    cloneConn.setURL(url);
  }
 else {
    String newURL=DatabaseConnStrUtil.getURLString(cloneConn.getDatabaseType(),dbConn.getDbVersionString(),server,username,password,port,sidOrDatabase,filePath.toLowerCase(),datasource,dbRootPath,additionParam);
    cloneConn.setURL(newURL);
  }
  return cloneConn;
}

Fixed version (ground truth):
/** 
 * ggu Comment method "cloneOriginalValueConnection". only clone the properties of connection.
 * @param selectedContext
 */
public static DatabaseConnection cloneOriginalValueConnection(DatabaseConnection dbConn,boolean defaultContext,String selectedContext){
  if (dbConn == null) {
    return null;
  }
  ContextType contextType=ConnectionContextHelper.getContextTypeForContextMode(null,dbConn,selectedContext,defaultContext);
  DatabaseConnection cloneConn=ConnectionFactory.eINSTANCE.createDatabaseConnection();
  String server=ConnectionContextHelper.getOriginalValue(contextType,dbConn.getServerName());
  String username=ConnectionContextHelper.getOriginalValue(contextType,dbConn.getUsername());
  String password=ConnectionContextHelper.getOriginalValue(contextType,dbConn.getRawPassword());
  String port=ConnectionContextHelper.getOriginalValue(contextType,dbConn.getPort());
  String sidOrDatabase=ConnectionContextHelper.getOriginalValue(contextType,dbConn.getSID());
  String datasource=ConnectionContextHelper.getOriginalValue(contextType,dbConn.getDatasourceName());
  String filePath=ConnectionContextHelper.getOriginalValue(contextType,dbConn.getFileFieldName());
  String schemaOracle=ConnectionContextHelper.getOriginalValue(contextType,dbConn.getUiSchema());
  String dbRootPath=ConnectionContextHelper.getOriginalValue(contextType,dbConn.getDBRootPath());
  String additionParam=ConnectionContextHelper.getOriginalValue(contextType,dbConn.getAdditionalParams());
  String url=ConnectionContextHelper.getOriginalValue(contextType,dbConn.getURL());
  String className=ConnectionContextHelper.getOriginalValue(contextType,dbConn.getDriverClass());
  String jarPath=ConnectionContextHelper.getOriginalValue(contextType,dbConn.getDriverJarPath());
  String dbmsID=ConnectionContextHelper.getOriginalValue(contextType,dbConn.getDbmsId());
  filePath=TalendQuoteUtils.removeQuotes(filePath);
  dbRootPath=TalendQuoteUtils.removeQuotes(dbRootPath);
  cloneConn.setAdditionalParams(additionParam);
  cloneConn.setDatasourceName(datasource);
  cloneConn.setDBRootPath(dbRootPath);
  cloneConn.setFileFieldName(filePath);
  cloneConn.setRawPassword(password);
  cloneConn.setPort(port);
  cloneConn.setUiSchema(schemaOracle);
  cloneConn.setServerName(server);
  cloneConn.setSID(sidOrDatabase);
  cloneConn.setUsername(username);
  cloneConn.setDriverJarPath(jarPath);
  cloneConn.setComment(dbConn.getComment());
  cloneConn.setDatabaseType(dbConn.getDatabaseType());
  cloneConn.setDbmsId(dbmsID);
  cloneConn.setDivergency(dbConn.isDivergency());
  cloneConn.setDbVersionString(dbConn.getDbVersionString());
  cloneConn.setId(dbConn.getId());
  cloneConn.setLabel(dbConn.getLabel());
  cloneConn.setNullChar(dbConn.getNullChar());
  cloneConn.setProductId(dbConn.getProductId());
  cloneConn.setSqlSynthax(dbConn.getSqlSynthax());
  cloneConn.setStandardSQL(dbConn.isStandardSQL());
  cloneConn.setStringQuote(dbConn.getStringQuote());
  cloneConn.setSynchronised(dbConn.isSynchronised());
  cloneConn.setSystemSQL(dbConn.isSystemSQL());
  cloneConn.setVersion(dbConn.getVersion());
  cloneConn.setReadOnly(dbConn.isReadOnly());
  cloneConn.setDriverClass(className);
  cloneConn.setName(dbConn.getName());
  cloneOtherParameters(dbConn,cloneConn);
  if (dbConn.isSetSQLMode()) {
    cloneConn.setSQLMode(dbConn.isSQLMode());
  }
 else {
    cloneConn.setSQLMode(true);
  }
  ContextType hadoopClusterContextType=getHadoopClusterContextType(dbConn,defaultContext);
  if (EDatabaseTypeName.HIVE.equals(EDatabaseTypeName.getTypeFromDbType(dbConn.getDatabaseType()))) {
    String hadoopUserName=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_USERNAME);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_USERNAME,getOriginalValue(hadoopClusterContextType,contextType,hadoopUserName));
    String jobTracker=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_JOB_TRACKER_URL);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_JOB_TRACKER_URL,getOriginalValue(hadoopClusterContextType,contextType,jobTracker));
    String nameNode=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_NAME_NODE_URL);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_NAME_NODE_URL,getOriginalValue(hadoopClusterContextType,contextType,nameNode));
    String hivePrincipal=cloneConn.getParameters().get(ConnParameterKeys.HIVE_AUTHENTICATION_HIVEPRINCIPLA);
    cloneConn.getParameters().put(ConnParameterKeys.HIVE_AUTHENTICATION_HIVEPRINCIPLA,getOriginalValue(hadoopClusterContextType,contextType,hivePrincipal));
    String hiveMetadata=cloneConn.getParameters().get(ConnParameterKeys.HIVE_AUTHENTICATION_METASTOREURL);
    cloneConn.getParameters().put(ConnParameterKeys.HIVE_AUTHENTICATION_METASTOREURL,getOriginalValue(hadoopClusterContextType,contextType,hiveMetadata));
    String driverPath=cloneConn.getParameters().get(ConnParameterKeys.HIVE_AUTHENTICATION_DRIVERJAR_PATH);
    cloneConn.getParameters().put(ConnParameterKeys.HIVE_AUTHENTICATION_DRIVERJAR_PATH,getOriginalValue(hadoopClusterContextType,contextType,driverPath));
    String driverClass=cloneConn.getParameters().get(ConnParameterKeys.HIVE_AUTHENTICATION_DRIVERCLASS);
    cloneConn.getParameters().put(ConnParameterKeys.HIVE_AUTHENTICATION_DRIVERCLASS,getOriginalValue(hadoopClusterContextType,contextType,driverClass));
    String hiveUserName=cloneConn.getParameters().get(ConnParameterKeys.HIVE_AUTHENTICATION_USERNAME);
    cloneConn.getParameters().put(ConnParameterKeys.HIVE_AUTHENTICATION_USERNAME,getOriginalValue(hadoopClusterContextType,contextType,hiveUserName));
    String hivePassword=cloneConn.getParameters().get(ConnParameterKeys.HIVE_AUTHENTICATION_PASSWORD);
    cloneConn.getParameters().put(ConnParameterKeys.HIVE_AUTHENTICATION_PASSWORD,getOriginalValue(hadoopClusterContextType,contextType,hivePassword));
    String ktPrincipal=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_KEYTAB_PRINCIPAL);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_KEYTAB_PRINCIPAL,getOriginalValue(hadoopClusterContextType,contextType,ktPrincipal));
    String keytab=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_KEYTAB);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_KEYTAB,getOriginalValue(hadoopClusterContextType,contextType,keytab));
    String maprticket_Username=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_AUTHENTICATION_USERNAME);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HIVE_AUTHENTICATION_USERNAME,getOriginalValue(hadoopClusterContextType,contextType,maprticket_Username));
    String maprticket_Password=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_AUTHENTICATION_MAPRTICKET_PASSWORD);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HIVE_AUTHENTICATION_MAPRTICKET_PASSWORD,getOriginalValue(hadoopClusterContextType,contextType,maprticket_Password));
    String maprticket_Cluster=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_AUTHENTICATION_MAPRTICKET_CLUSTER);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HIVE_AUTHENTICATION_MAPRTICKET_CLUSTER,getOriginalValue(hadoopClusterContextType,contextType,maprticket_Cluster));
    String maprticket_Duration=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_AUTHENTICATION_MAPRTICKET_DURATION);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HIVE_AUTHENTICATION_MAPRTICKET_DURATION,getOriginalValue(hadoopClusterContextType,contextType,maprticket_Duration));
    String jdbcPropertiesString=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_JDBC_PROPERTIES);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HIVE_JDBC_PROPERTIES,HadoopRepositoryUtil.getOriginalValueOfProperties(jdbcPropertiesString,contextType));
    String additionalJDBCSettings=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_ADDITIONAL_JDBC_SETTINGS);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HIVE_ADDITIONAL_JDBC_SETTINGS,getOriginalValue(hadoopClusterContextType,contextType,additionalJDBCSettings));
    String propertiesString=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_PROPERTIES);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HIVE_PROPERTIES,HadoopRepositoryUtil.getOriginalValueOfProperties(propertiesString,contextType));
    String trustStorePath=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_SSL_TRUST_STORE_PATH);
    if (trustStorePath != null) {
      cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_SSL_TRUST_STORE_PATH,getOriginalValue(hadoopClusterContextType,contextType,trustStorePath));
    }
    String trustStorePassword=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_SSL_TRUST_STORE_PASSWORD);
    if (trustStorePassword != null) {
      cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_SSL_TRUST_STORE_PASSWORD,cloneConn.getValue(cloneConn.getValue(getOriginalValue(hadoopClusterContextType,contextType,trustStorePassword),false),true));
    }
    String template=null;
    String hiveServerVersion=HiveServerVersionInfo.HIVE_SERVER_1.getKey();
    EMap<String,String> parameterMap=dbConn.getParameters();
    if (parameterMap != null) {
      hiveServerVersion=parameterMap.get(ConnParameterKeys.HIVE_SERVER_VERSION);
    }
    if (HiveServerVersionInfo.HIVE_SERVER_2.getKey().equals(hiveServerVersion)) {
      template=DbConnStrForHive.URL_HIVE_2_TEMPLATE;
    }
 else {
      template=DbConnStrForHive.URL_HIVE_1_TEMPLATE;
    }
    String newURl=DatabaseConnStrUtil.getHiveURLString(cloneConn,server,port,sidOrDatabase,template);
    cloneConn.setURL(newURl);
    return cloneConn;
  }
  if (EDatabaseTypeName.HBASE.equals(EDatabaseTypeName.getTypeFromDbType(cloneConn.getDatabaseType()))) {
    String hbaseMasterPrin=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HBASE_AUTHENTICATION_MASTERPRINCIPAL);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HBASE_AUTHENTICATION_MASTERPRINCIPAL,getOriginalValue(hadoopClusterContextType,contextType,hbaseMasterPrin));
    String hbaseRegionPrin=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HBASE_AUTHENTICATION_REGIONSERVERPRINCIPAL);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HBASE_AUTHENTICATION_REGIONSERVERPRINCIPAL,getOriginalValue(hadoopClusterContextType,contextType,hbaseRegionPrin));
    String hbaseKeyTabPrin=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_KEYTAB_PRINCIPAL);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_KEYTAB_PRINCIPAL,getOriginalValue(hadoopClusterContextType,contextType,hbaseKeyTabPrin));
    String hbaseKeyTab=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_KEYTAB);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_KEYTAB,getOriginalValue(hadoopClusterContextType,contextType,hbaseKeyTab));
    String maprticket_Username=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HBASE_AUTHENTICATION_USERNAME);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HBASE_AUTHENTICATION_USERNAME,getOriginalValue(hadoopClusterContextType,contextType,maprticket_Username));
    String maprticket_Password=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HBASE_AUTHENTICATION_MAPRTICKET_PASSWORD);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HBASE_AUTHENTICATION_MAPRTICKET_PASSWORD,getOriginalValue(hadoopClusterContextType,contextType,maprticket_Password));
    String maprticket_Cluster=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HBASE_AUTHENTICATION_MAPRTICKET_CLUSTER);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HBASE_AUTHENTICATION_MAPRTICKET_CLUSTER,getOriginalValue(hadoopClusterContextType,contextType,maprticket_Cluster));
    String maprticket_Duration=cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HBASE_AUTHENTICATION_MAPRTICKET_DURATION);
    cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HBASE_AUTHENTICATION_MAPRTICKET_DURATION,getOriginalValue(hadoopClusterContextType,contextType,maprticket_Duration));
  }
  if (EDatabaseTypeName.IBMDB2.equals(EDatabaseTypeName.getTypeFromDbType(dbConn.getDatabaseType()))) {
    String cursorForDb2="String_Node_Str";
    String database=sidOrDatabase + cursorForDb2;
    String newURL=DatabaseConnStrUtil.getURLString(cloneConn.getDatabaseType(),dbConn.getDbVersionString(),server,username,password,port,database,filePath.toLowerCase(),datasource,dbRootPath,additionParam);
    cloneConn.setURL(newURL);
    return cloneConn;
  }
  if (contextType != null && !EDatabaseTypeName.GENERAL_JDBC.equals(EDatabaseTypeName.getTypeFromDbType(dbConn.getDatabaseType()))) {
    String newURL=DatabaseConnStrUtil.getURLString(cloneConn.getDatabaseType(),dbConn.getDbVersionString(),server,username,password,port,sidOrDatabase,filePath.toLowerCase(),datasource,dbRootPath,additionParam);
    cloneConn.setURL(newURL);
    return cloneConn;
  }
  if (dbConn.getURL() != null && !dbConn.getURL().equals("String_Node_Str")) {
    cloneConn.setURL(url);
  }
 else {
    String newURL=DatabaseConnStrUtil.getURLString(cloneConn.getDatabaseType(),dbConn.getDbVersionString(),server,username,password,port,sidOrDatabase,filePath.toLowerCase(),datasource,dbRootPath,additionParam);
    cloneConn.setURL(newURL);
  }
  return cloneConn;
}