Program: 118276
Project: 118276
Buggy source:
protected void initConnectionParameters(){
  connParameters=null;
  IElementParameter basePropertyParameter=null;
  for (  IElementParameter param : elem.getElementParameters()) {
    if (param.getFieldType() == EParameterFieldType.PROPERTY_TYPE) {
      if (param.getRepositoryValue().startsWith("String_Node_Str")) {
        basePropertyParameter=param;
        break;
      }
    }
  }
  IElementParameter updateBasePropertyParameter=updateBasePropertyParameter();
  if (updateBasePropertyParameter != null && !updateBasePropertyParameter.equals(basePropertyParameter)) {
    basePropertyParameter=updateBasePropertyParameter;
  }
  connParameters=new ConnectionParameters();
  String type=getValueFromRepositoryName(elem,"String_Node_Str",basePropertyParameter);
  if (type.equals("String_Node_Str") || type.contains("String_Node_Str")) {
    IElementParameter ele=elem.getElementParameter("String_Node_Str");
    if (ele != null) {
      type=(String)ele.getValue();
    }
 else {
      type="String_Node_Str";
    }
  }
 else   if (EDatabaseTypeName.HIVE.getProduct().equalsIgnoreCase(type)) {
    setSpecialParamsForHiveEmbedded(elem);
  }
  if (type.equals(EDatabaseTypeName.HSQLDB.name()) && getValueFromRepositoryName(elem,"String_Node_Str").equals("String_Node_Str")) {
    type=EDatabaseTypeName.HSQLDB_IN_PROGRESS.getDisplayName();
  }
  connParameters.setDbType(type);
  String driverName=getValueFromRepositoryName(elem,"String_Node_Str",basePropertyParameter);
  String dbVersionName=EDatabaseVersion4Drivers.getDbVersionName(type,driverName);
  if (EDatabaseTypeName.HIVE.getProduct().equalsIgnoreCase(type)) {
    if (EDatabaseVersion4Drivers.HIVE_EMBEDDED.getVersionValue().equals(elem.getElementParameter("String_Node_Str").getValue())) {
      connParameters.setDbVersion(EDatabaseVersion4Drivers.HIVE_EMBEDDED.getVersionValue());
    }
 else {
      connParameters.setDbVersion(EDatabaseVersion4Drivers.HIVE.getVersionValue());
    }
  }
 else {
    connParameters.setDbVersion(dbVersionName);
  }
  connParameters.setNode(elem);
  String selectedComponentName=(String)elem.getPropertyValue(EParameterName.UNIQUE_NAME.getName());
  connParameters.setSelectedComponentName(selectedComponentName);
  connParameters.setFieldType(paramFieldType);
  if (elem instanceof Node && !((Node)elem).getMetadataList().isEmpty()) {
    connParameters.setMetadataTable(((Node)elem).getMetadataList().get(0));
  }
  connParameters.setSchemaRepository(EmfComponent.REPOSITORY.equals(elem.getPropertyValue(EParameterName.SCHEMA_TYPE.getName())));
  connParameters.setFromDBNode(true);
  connParameters.setQuery("String_Node_Str");
  List<? extends IElementParameter> list=elem.getElementParameters();
  boolean end=false;
  for (int i=0; i < list.size() && !end; i++) {
    IElementParameter param=list.get(i);
    if (param.getFieldType() == EParameterFieldType.MEMO_SQL) {
      connParameters.setNodeReadOnly(param.isReadOnly());
      end=true;
    }
  }
  Object value=elem.getPropertyValue("String_Node_Str");
  IElementParameter compList=elem.getElementParameterFromField(EParameterFieldType.COMPONENT_LIST);
  if (value != null && (value instanceof Boolean) && ((Boolean)value) && compList != null && !isConnectionExist()) {
    Object compValue=compList.getValue();
    if (compValue != null && !compValue.equals("String_Node_Str")) {
      List<? extends INode> nodes=part.getProcess().getGraphicalNodes();
      for (      INode node : nodes) {
        if (node.getUniqueName().equals(compValue) && (node instanceof Node)) {
          connectionNode=node;
          break;
        }
      }
      if (connectionNode != null) {
        setAllConnectionParameters(type,connectionNode);
      }
    }
  }
 else {
    setAllConnectionParameters(null,elem);
  }
  if (connectionNode != null) {
    setConnectionParameterNames(connectionNode,connParameters,basePropertyParameter);
  }
 else {
    setConnectionParameterNames(elem,connParameters,basePropertyParameter);
  }
}

Fixed version (ground truth):
protected void initConnectionParameters(){
  connParameters=null;
  IElementParameter basePropertyParameter=null;
  for (  IElementParameter param : elem.getElementParameters()) {
    if (param.getFieldType() == EParameterFieldType.PROPERTY_TYPE) {
      if (param.getRepositoryValue().startsWith("String_Node_Str")) {
        basePropertyParameter=param;
        break;
      }
    }
  }
  IElementParameter updateBasePropertyParameter=updateBasePropertyParameter();
  if (updateBasePropertyParameter != null && !updateBasePropertyParameter.equals(basePropertyParameter)) {
    basePropertyParameter=updateBasePropertyParameter;
  }
  connParameters=new ConnectionParameters();
  String type=getValueFromRepositoryName(elem,"String_Node_Str",basePropertyParameter);
  if (type.equals("String_Node_Str") || type.contains("String_Node_Str")) {
    IElementParameter ele=elem.getElementParameter("String_Node_Str");
    if (ele != null) {
      type=(String)ele.getValue();
    }
 else {
      type="String_Node_Str";
    }
  }
 else   if (EDatabaseTypeName.HIVE.getProduct().equalsIgnoreCase(type)) {
    setSpecialParamsForHiveEmbedded(elem);
  }
 else   if (EDatabaseTypeName.IMPALA.getProduct().equalsIgnoreCase(type)) {
    String distroKey=getValueFromRepositoryName(elem,"String_Node_Str");
    connParameters.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_IMPALA_DISTRIBUTION,distroKey);
    String distroVersion=getValueFromRepositoryName(elem,"String_Node_Str");
    connParameters.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_IMPALA_VERSION,distroVersion);
  }
  if (type.equals(EDatabaseTypeName.HSQLDB.name()) && getValueFromRepositoryName(elem,"String_Node_Str").equals("String_Node_Str")) {
    type=EDatabaseTypeName.HSQLDB_IN_PROGRESS.getDisplayName();
  }
  connParameters.setDbType(type);
  String driverName=getValueFromRepositoryName(elem,"String_Node_Str",basePropertyParameter);
  String dbVersionName=EDatabaseVersion4Drivers.getDbVersionName(type,driverName);
  if (EDatabaseTypeName.HIVE.getProduct().equalsIgnoreCase(type)) {
    if (EDatabaseVersion4Drivers.HIVE_EMBEDDED.getVersionValue().equals(elem.getElementParameter("String_Node_Str").getValue())) {
      connParameters.setDbVersion(EDatabaseVersion4Drivers.HIVE_EMBEDDED.getVersionValue());
    }
 else {
      connParameters.setDbVersion(EDatabaseVersion4Drivers.HIVE.getVersionValue());
    }
  }
 else {
    connParameters.setDbVersion(dbVersionName);
  }
  connParameters.setNode(elem);
  String selectedComponentName=(String)elem.getPropertyValue(EParameterName.UNIQUE_NAME.getName());
  connParameters.setSelectedComponentName(selectedComponentName);
  connParameters.setFieldType(paramFieldType);
  if (elem instanceof Node && !((Node)elem).getMetadataList().isEmpty()) {
    connParameters.setMetadataTable(((Node)elem).getMetadataList().get(0));
  }
  connParameters.setSchemaRepository(EmfComponent.REPOSITORY.equals(elem.getPropertyValue(EParameterName.SCHEMA_TYPE.getName())));
  connParameters.setFromDBNode(true);
  connParameters.setQuery("String_Node_Str");
  List<? extends IElementParameter> list=elem.getElementParameters();
  boolean end=false;
  for (int i=0; i < list.size() && !end; i++) {
    IElementParameter param=list.get(i);
    if (param.getFieldType() == EParameterFieldType.MEMO_SQL) {
      connParameters.setNodeReadOnly(param.isReadOnly());
      end=true;
    }
  }
  Object value=elem.getPropertyValue("String_Node_Str");
  IElementParameter compList=elem.getElementParameterFromField(EParameterFieldType.COMPONENT_LIST);
  if (value != null && (value instanceof Boolean) && ((Boolean)value) && compList != null && !isConnectionExist()) {
    Object compValue=compList.getValue();
    if (compValue != null && !compValue.equals("String_Node_Str")) {
      List<? extends INode> nodes=part.getProcess().getGraphicalNodes();
      for (      INode node : nodes) {
        if (node.getUniqueName().equals(compValue) && (node instanceof Node)) {
          connectionNode=node;
          break;
        }
      }
      if (connectionNode != null) {
        setAllConnectionParameters(type,connectionNode);
      }
    }
  }
 else {
    setAllConnectionParameters(null,elem);
  }
  if (connectionNode != null) {
    setConnectionParameterNames(connectionNode,connParameters,basePropertyParameter);
  }
 else {
    setConnectionParameterNames(elem,connParameters,basePropertyParameter);
  }
}