Program: 119683
Project: 119683
Buggy source:
protected void initConnectionParametersWithContext(IElement element,IContext context){
  if (connParameters == null) {
    connParameters=new ConnectionParameters();
  }
  String dbType=connParameters.getDbType();
  Object value=elem.getPropertyValue("String_Node_Str");
  IElementParameter compList=elem.getElementParameterFromField(EParameterFieldType.COMPONENT_LIST);
  if (value != null && (value instanceof Boolean) && ((Boolean)value) && compList != null) {
    if (connectionNode == null) {
      Object compValue=compList.getValue();
      if (compValue != null && !compValue.equals("String_Node_Str")) {
        List<? extends INode> nodes=part.getProcess().getGeneratingNodes();
        for (        INode node : nodes) {
          if (node.getUniqueName().equals(compValue) && (node instanceof INode)) {
            connectionNode=node;
            break;
          }
        }
      }
    }
    if (connectionNode != null) {
      element=connectionNode;
    }
  }
  connParameters.setDbName(getParameterValueWithContext(element,EConnectionParameterName.SID.getName(),context));
  connParameters.setPassword(getParameterValueWithContext(element,EConnectionParameterName.PASSWORD.getName(),context));
  connParameters.setPort(getParameterValueWithContext(element,EConnectionParameterName.PORT.getName(),context));
  connParameters.setSchema(getParameterValueWithContext(element,EConnectionParameterName.SCHEMA.getName(),context));
  connParameters.setHost(getParameterValueWithContext(element,EConnectionParameterName.SERVER_NAME.getName(),context));
  connParameters.setUserName(getParameterValueWithContext(element,EConnectionParameterName.USERNAME.getName(),context));
  String dir=getParameterValueWithContext(element,EConnectionParameterName.DIRECTORY.getName(),context);
  if (dbType.equals(EDatabaseTypeName.HSQLDB_IN_PROGRESS.getDisplayName())) {
    dir=getParameterValueWithContext(element,EConnectionParameterName.DBPATH.getName(),context);
  }
  connParameters.setDirectory(dir);
  connParameters.setHttps(Boolean.parseBoolean(getParameterValueWithContext(element,EConnectionParameterName.HTTPS.getName(),context)));
  String url=TalendTextUtils.removeQuotesIfExist(getParameterValueWithContext(element,EConnectionParameterName.URL.getName(),context));
  if (StringUtils.isEmpty(url)) {
    if (EDatabaseTypeName.ORACLE_CUSTOM.getDisplayName().equals(dbType)) {
      url=TalendTextUtils.removeQuotesIfExist(getParameterValueWithContext(element,"String_Node_Str" + EConnectionParameterName.URL.getName(),context));
    }
  }
  connParameters.setUrl(url);
  String driverClass=TalendTextUtils.removeQuotesIfExist(getParameterValueWithContext(element,EConnectionParameterName.DRIVER_CLASS.getName(),context));
  String dbVersion=getValueFromRepositoryName(element,"String_Node_Str");
  if (EDatabaseVersion4Drivers.VERTICA_6.getVersionValue().equals(dbVersion) || EDatabaseVersion4Drivers.VERTICA_5_1.getVersionValue().equals(dbVersion) || EDatabaseVersion4Drivers.VERTICA_6_1_X.getVersionValue().equals(dbVersion)) {
    driverClass=EDatabase4DriverClassName.VERTICA2.getDriverClass();
  }
  connParameters.setDriverClass(driverClass);
  connParameters.setDriverJar(TalendTextUtils.removeQuotesIfExist(getParameterValueWithContext(element,EConnectionParameterName.DRIVER_JAR.getName(),context)));
  final String dbTypeByClassName=ExtractMetaDataUtils.getInstance().getDbTypeByClassName(connParameters.getDriverClass());
  if (connParameters.getDbType() == null || EDatabaseTypeName.MYSQL.getDisplayName().equals(connParameters.getDbType()) && !EDatabaseTypeName.MYSQL.getProduct().equals(dbTypeByClassName)) {
    if (dbTypeByClassName != null && !"String_Node_Str".equals(dbTypeByClassName)) {
      connParameters.setDbType(dbTypeByClassName);
    }
  }
  if (connParameters.getDbType().equals(EDatabaseTypeName.SQLITE.getXmlName()) || connParameters.getDbType().equals(EDatabaseTypeName.ACCESS.getXmlName()) || connParameters.getDbType().equals(EDatabaseTypeName.FIREBIRD.getXmlName())) {
    connParameters.setFilename(getParameterValueWithContext(element,EConnectionParameterName.FILE.getName(),context));
  }
  connParameters.setJdbcProperties(getParameterValueWithContext(element,EConnectionParameterName.PROPERTIES_STRING.getName(),context));
  connParameters.setDatasource(getParameterValueWithContext(element,EConnectionParameterName.DATASOURCE.getName(),context));
}

Fixed version (ground truth):
protected void initConnectionParametersWithContext(IElement element,IContext context){
  if (connParameters == null) {
    connParameters=new ConnectionParameters();
  }
  String dbType=connParameters.getDbType();
  Object value=elem.getPropertyValue("String_Node_Str");
  IElementParameter compList=elem.getElementParameterFromField(EParameterFieldType.COMPONENT_LIST);
  if (value != null && (value instanceof Boolean) && ((Boolean)value) && compList != null) {
    if (connectionNode == null) {
      Object compValue=compList.getValue();
      if (compValue != null && !compValue.equals("String_Node_Str")) {
        List<? extends INode> nodes=part.getProcess().getGeneratingNodes();
        for (        INode node : nodes) {
          if (node.getUniqueName().equals(compValue) && (node instanceof INode)) {
            connectionNode=node;
            break;
          }
        }
      }
    }
    if (connectionNode != null) {
      element=connectionNode;
    }
  }
  connParameters.setDbName(getParameterValueWithContext(element,EConnectionParameterName.SID.getName(),context));
  connParameters.setPassword(getParameterValueWithContext(element,EConnectionParameterName.PASSWORD.getName(),context));
  connParameters.setPort(getParameterValueWithContext(element,EConnectionParameterName.PORT.getName(),context));
  connParameters.setSchema(getParameterValueWithContext(element,EConnectionParameterName.SCHEMA.getName(),context));
  connParameters.setHost(getParameterValueWithContext(element,EConnectionParameterName.SERVER_NAME.getName(),context));
  connParameters.setUserName(getParameterValueWithContext(element,EConnectionParameterName.USERNAME.getName(),context));
  String dir=getParameterValueWithContext(element,EConnectionParameterName.DIRECTORY.getName(),context);
  if (dbType.equals(EDatabaseTypeName.HSQLDB_IN_PROGRESS.getDisplayName())) {
    dir=getParameterValueWithContext(element,EConnectionParameterName.DBPATH.getName(),context);
  }
  connParameters.setDirectory(dir);
  connParameters.setHttps(Boolean.parseBoolean(getParameterValueWithContext(element,EConnectionParameterName.HTTPS.getName(),context)));
  String url=TalendTextUtils.removeQuotesIfExist(getParameterValueWithContext(element,EConnectionParameterName.URL.getName(),context));
  if (StringUtils.isEmpty(url)) {
    if (EDatabaseTypeName.ORACLE_CUSTOM.getDisplayName().equals(dbType)) {
      url=TalendTextUtils.removeQuotesIfExist(getParameterValueWithContext(element,"String_Node_Str" + EConnectionParameterName.URL.getName(),context));
    }
  }
  connParameters.setUrl(url);
  String driverClass=TalendTextUtils.removeQuotesIfExist(getParameterValueWithContext(element,EConnectionParameterName.DRIVER_CLASS.getName(),context));
  if (element != null) {
    String dbVersion=getValueFromRepositoryName(element,"String_Node_Str");
    if (EDatabaseVersion4Drivers.VERTICA_6.getVersionValue().equals(dbVersion) || EDatabaseVersion4Drivers.VERTICA_5_1.getVersionValue().equals(dbVersion) || EDatabaseVersion4Drivers.VERTICA_6_1_X.getVersionValue().equals(dbVersion)) {
      driverClass=EDatabase4DriverClassName.VERTICA2.getDriverClass();
    }
  }
  connParameters.setDriverClass(driverClass);
  connParameters.setDriverJar(TalendTextUtils.removeQuotesIfExist(getParameterValueWithContext(element,EConnectionParameterName.DRIVER_JAR.getName(),context)));
  final String dbTypeByClassName=ExtractMetaDataUtils.getInstance().getDbTypeByClassName(connParameters.getDriverClass());
  if (connParameters.getDbType() == null || EDatabaseTypeName.MYSQL.getDisplayName().equals(connParameters.getDbType()) && !EDatabaseTypeName.MYSQL.getProduct().equals(dbTypeByClassName)) {
    if (dbTypeByClassName != null && !"String_Node_Str".equals(dbTypeByClassName)) {
      connParameters.setDbType(dbTypeByClassName);
    }
  }
  if (connParameters.getDbType().equals(EDatabaseTypeName.SQLITE.getXmlName()) || connParameters.getDbType().equals(EDatabaseTypeName.ACCESS.getXmlName()) || connParameters.getDbType().equals(EDatabaseTypeName.FIREBIRD.getXmlName())) {
    connParameters.setFilename(getParameterValueWithContext(element,EConnectionParameterName.FILE.getName(),context));
  }
  connParameters.setJdbcProperties(getParameterValueWithContext(element,EConnectionParameterName.PROPERTIES_STRING.getName(),context));
  connParameters.setDatasource(getParameterValueWithContext(element,EConnectionParameterName.DATASOURCE.getName(),context));
}