Program: 118017
Project: 118017
Buggy source:
public static List<DataNode> createExtraContextLoadNodes(IProcess process){
  List<DataNode> nodeList=new ArrayList<DataNode>();
  String paramName=EParameterName.IMPLICIT_TCONTEXTLOAD.getName();
  boolean useContextLoad=((Boolean)process.getElementParameter(paramName).getValue()) && process.getElementParameter(paramName).isShow(process.getElementParameters());
  if (!useContextLoad) {
    return Collections.emptyList();
  }
  paramName=JobSettingsConstants.getExtraParameterName(EParameterName.FROM_FILE_FLAG.getName());
  boolean fileFlag=((Boolean)process.getElementParameter(paramName).getValue()) && process.getElementParameter(paramName).isShow(process.getElementParameters());
  String dbInput=null;
  paramName=JobSettingsConstants.getExtraParameterName(EParameterName.FROM_DATABASE_FLAG.getName());
  boolean dbFlag=((Boolean)process.getElementParameter(paramName).getValue()) && process.getElementParameter(paramName).isShow(process.getElementParameters());
  if (!dbFlag) {
    dbInput=null;
  }
 else {
    dbInput=(String)process.getElementParameter(JobSettingsConstants.getExtraParameterName(EParameterName.DB_TYPE.getName())).getValue();
    dbInput=OracleComponentHelper.filterOracleComponentName(dbInput);
    if (dbInput == null || dbInput.equals("String_Node_Str")) {
      dbInput=null;
      dbFlag=false;
    }
  }
  if (!fileFlag && !dbFlag) {
    return Collections.emptyList();
  }
  IComponent tContextLoadComponent=new JobContextLoadComponent(fileFlag,dbInput);
  final String uniqueName="String_Node_Str";
  DataNode tContextLoadNode=new DataNode(tContextLoadComponent,uniqueName);
  tContextLoadNode.setStart(true);
  tContextLoadNode.setSubProcessStart(true);
  tContextLoadNode.setActivate(true);
  IMetadataTable table=getSchemaTablefromComponent(JobContextLoadComponent.CONTEXTLOAD_COMPONENT,uniqueName);
  if (table != null) {
    tContextLoadNode.getMetadataList().clear();
    tContextLoadNode.getMetadataList().add(table);
  }
  IElementParameter param=null;
  if (fileFlag) {
    String inputFile=(String)process.getElementParameter(EParameterName.IMPLICIT_TCONTEXTLOAD_FILE.getName()).getValue();
    String fileSparator=(String)process.getElementParameter(EParameterName.FIELDSEPARATOR.getName()).getValue();
    tContextLoadNode.getElementParameter(EParameterName.IMPLICIT_TCONTEXTLOAD_FILE.getName()).setValue(inputFile);
    if (getMetadataChars().contains(TalendQuoteUtils.removeQuotes(fileSparator))) {
      fileSparator=TalendQuoteUtils.removeQuotes(fileSparator);
      if (fileSparator.equals(File.separator)) {
        fileSparator=TalendQuoteUtils.addQuotes("String_Node_Str" + fileSparator);
      }
 else {
        fileSparator=TalendQuoteUtils.addQuotes("String_Node_Str" + fileSparator);
      }
    }
    String regex="String_Node_Str" + fileSparator + "String_Node_Str"+ fileSparator+ "String_Node_Str";
    tContextLoadNode.getElementParameter(JobSettingsConstants.IMPLICIT_TCONTEXTLOAD_REGEX).setValue(regex);
  }
 else {
    paramName=JobSettingsConstants.getExtraParameterName(EParameterName.URL.getName());
    param=process.getElementParameter(paramName);
    if (param != null) {
      tContextLoadNode.getElementParameter(paramName).setValue(param.getValue());
    }
    paramName=JobSettingsConstants.getExtraParameterName(EParameterName.DRIVER_JAR.getName());
    param=process.getElementParameter(paramName);
    if (param != null) {
      tContextLoadNode.getElementParameter(paramName).setValue(param.getValue());
    }
    paramName=JobSettingsConstants.getExtraParameterName(EParameterName.DRIVER_CLASS.getName());
    param=process.getElementParameter(paramName);
    if (param != null) {
      tContextLoadNode.getElementParameter(paramName).setValue(param.getValue());
    }
    paramName=JobSettingsConstants.getExtraParameterName(EParameterName.HOST.getName());
    tContextLoadNode.getElementParameter(paramName).setValue(process.getElementParameter(paramName).getValue());
    paramName=JobSettingsConstants.getExtraParameterName(EParameterName.PORT.getName());
    tContextLoadNode.getElementParameter(paramName).setValue(process.getElementParameter(paramName).getValue());
    paramName=JobSettingsConstants.getExtraParameterName(EParameterName.DBNAME.getName());
    tContextLoadNode.getElementParameter(paramName).setValue(process.getElementParameter(paramName).getValue());
    paramName=JobSettingsConstants.getExtraParameterName(EParameterName.DB_VERSION.getName());
    tContextLoadNode.getElementParameter(paramName).setValue(process.getElementParameter(paramName).getValue());
    paramName=JobSettingsConstants.getExtraParameterName(EParameterName.PROPERTIES.getName());
    param=process.getElementParameter(paramName);
    if (param != null) {
      tContextLoadNode.getElementParameter(paramName).setValue(param.getValue());
    }
    paramName=JobSettingsConstants.getExtraParameterName(EParameterName.SCHEMA_DB.getName());
    param=process.getElementParameter(paramName);
    if (param != null) {
      tContextLoadNode.getElementParameter(paramName).setValue(param.getValue());
    }
    String schema=(String)process.getElementParameter(paramName).getValue();
    if (schema != null) {
      schema=TalendTextUtils.removeQuotes(schema);
    }
    paramName=JobSettingsConstants.getExtraParameterName(EParameterName.USER.getName());
    tContextLoadNode.getElementParameter(paramName).setValue(process.getElementParameter(paramName).getValue());
    paramName=JobSettingsConstants.getExtraParameterName(EParameterName.PASS.getName());
    tContextLoadNode.getElementParameter(paramName).setValue(process.getElementParameter(paramName).getValue());
    paramName=JobSettingsConstants.getExtraParameterName(EParameterName.CONNECTION_TYPE.getName());
    tContextLoadNode.getElementParameter(paramName).setValue(OracleComponentHelper.filterOracleConnectionType((String)process.getElementParameter(JobSettingsConstants.getExtraParameterName(EParameterName.DB_TYPE.getName())).getValue()));
    paramName=JobSettingsConstants.getExtraParameterName(EParameterName.DBTABLE.getName());
    tContextLoadNode.getElementParameter(paramName).setValue(process.getElementParameter(paramName).getValue());
    String dbTableName=(String)process.getElementParameter(paramName).getValue();
    String realTableName=getCurrentTableName(dbTableName);
    if (realTableName == null) {
      realTableName=QueryUtil.DEFAULT_TABLE_NAME;
    }
    String dbType=getDatabaseTypeFromParameter(process);
    if (dbType != null) {
      if (dbType.equals(EDatabaseTypeName.GENERAL_JDBC.getDisplayName())) {
        dbType=findRealDbTypeForJDBC(process,dbType);
      }
      EDatabaseTypeName dbTypeName=EDatabaseTypeName.getTypeFromDbType(dbType);
      if (EDatabaseTypeName.ORACLE_OCI.equals(dbTypeName) || EDatabaseTypeName.ORACLEFORSID.equals(dbTypeName) || EDatabaseTypeName.ORACLESN.equals(dbTypeName)) {
        for (        IMetadataColumn column : table.getListColumns()) {
          column.setOriginalDbColumnName(column.getOriginalDbColumnName().toUpperCase());
        }
      }
      if (realTableName.startsWith(TalendTextUtils.QUOTATION_MARK) && realTableName.endsWith(TalendTextUtils.QUOTATION_MARK) && realTableName.length() > 2) {
        realTableName=realTableName.substring(1,realTableName.length() - 1);
      }
      String query=TalendTextUtils.addSQLQuotes(QueryUtil.generateNewQuery(null,table,dbType,schema,realTableName));
      paramName=JobSettingsConstants.getExtraParameterName(EParameterName.QUERY_CONDITION.getName());
      String conditionStatement=(String)process.getElementParameter(paramName).getValue();
      if (conditionStatement != null) {
        String tmp=TalendTextUtils.removeQuotes(conditionStatement);
        if (!"String_Node_Str".equals(tmp)) {
          query=query + CONNECTOR + QUOTE+ "String_Node_Str"+ QUOTE+ CONNECTOR+ conditionStatement;
        }
      }
      final String quoteByDBType=TalendTextUtils.getQuoteByDBType(dbType,false);
      if (dbTypeName == EDatabaseTypeName.MSSQL) {
        query=query.replaceAll("String_Node_Str","String_Node_Str" + quoteByDBType + "String_Node_Str"+ quoteByDBType);
      }
      tContextLoadNode.getElementParameter(JobSettingsConstants.QUERY).setValue(query);
    }
  }
  paramName=EParameterName.LOAD_NEW_VARIABLE.getName();
  param=process.getElementParameter(paramName);
  if (param != null) {
    tContextLoadNode.getElementParameter(paramName).setValue(param.getValue());
  }
  paramName=EParameterName.NOT_LOAD_OLD_VARIABLE.getName();
  param=process.getElementParameter(paramName);
  if (param != null) {
    tContextLoadNode.getElementParameter(paramName).setValue(param.getValue());
  }
  paramName=EParameterName.PRINT_OPERATIONS.getName();
  tContextLoadNode.getElementParameter(paramName).setValue(process.getElementParameter(paramName).getValue());
  paramName=EParameterName.DISABLE_ERROR.getName();
  param=process.getElementParameter(paramName);
  if (param != null) {
    tContextLoadNode.getElementParameter(paramName).setValue(param.getValue());
  }
  paramName=EParameterName.DISABLE_INFO.getName();
  param=process.getElementParameter(paramName);
  if (param != null) {
    tContextLoadNode.getElementParameter(paramName).setValue(param.getValue());
  }
  paramName=EParameterName.DISABLE_WARNINGS.getName();
  tContextLoadNode.getElementParameter(paramName).setValue(process.getElementParameter(paramName).getValue());
  tContextLoadNode.setProcess(process);
  nodeList.add(tContextLoadNode);
  return nodeList;
}

Fixed version (ground truth):
public static List<DataNode> createExtraContextLoadNodes(IProcess process){
  List<DataNode> nodeList=new ArrayList<DataNode>();
  String paramName=EParameterName.IMPLICIT_TCONTEXTLOAD.getName();
  boolean useContextLoad=((Boolean)process.getElementParameter(paramName).getValue()) && process.getElementParameter(paramName).isShow(process.getElementParameters());
  if (!useContextLoad) {
    return Collections.emptyList();
  }
  paramName=JobSettingsConstants.getExtraParameterName(EParameterName.FROM_FILE_FLAG.getName());
  boolean fileFlag=((Boolean)process.getElementParameter(paramName).getValue()) && process.getElementParameter(paramName).isShow(process.getElementParameters());
  String dbInput=null;
  paramName=JobSettingsConstants.getExtraParameterName(EParameterName.FROM_DATABASE_FLAG.getName());
  boolean dbFlag=((Boolean)process.getElementParameter(paramName).getValue()) && process.getElementParameter(paramName).isShow(process.getElementParameters());
  if (!dbFlag) {
    dbInput=null;
  }
 else {
    dbInput=(String)process.getElementParameter(JobSettingsConstants.getExtraParameterName(EParameterName.DB_TYPE.getName())).getValue();
    dbInput=OracleComponentHelper.filterOracleComponentName(dbInput);
    if (dbInput == null || dbInput.equals("String_Node_Str")) {
      dbInput=null;
      dbFlag=false;
    }
  }
  if (!fileFlag && !dbFlag) {
    return Collections.emptyList();
  }
  IComponent tContextLoadComponent=new JobContextLoadComponent(fileFlag,dbInput);
  final String uniqueName="String_Node_Str";
  DataNode tContextLoadNode=new DataNode(tContextLoadComponent,uniqueName);
  tContextLoadNode.setStart(true);
  tContextLoadNode.setSubProcessStart(true);
  tContextLoadNode.setActivate(true);
  IMetadataTable table=getSchemaTablefromComponent(JobContextLoadComponent.CONTEXTLOAD_COMPONENT,uniqueName);
  if (table != null) {
    tContextLoadNode.getMetadataList().clear();
    tContextLoadNode.getMetadataList().add(table);
  }
  IElementParameter param=null;
  if (fileFlag) {
    String inputFile=(String)process.getElementParameter(EParameterName.IMPLICIT_TCONTEXTLOAD_FILE.getName()).getValue();
    String fileSparator=(String)process.getElementParameter(EParameterName.FIELDSEPARATOR.getName()).getValue();
    tContextLoadNode.getElementParameter(EParameterName.IMPLICIT_TCONTEXTLOAD_FILE.getName()).setValue(inputFile);
    String regex=FileSeparator.getSeparatorsRegexp(TalendQuoteUtils.removeQuotes(fileSparator));
    tContextLoadNode.getElementParameter(JobSettingsConstants.IMPLICIT_TCONTEXTLOAD_REGEX).setValue(regex);
  }
 else {
    paramName=JobSettingsConstants.getExtraParameterName(EParameterName.URL.getName());
    param=process.getElementParameter(paramName);
    if (param != null) {
      tContextLoadNode.getElementParameter(paramName).setValue(param.getValue());
    }
    paramName=JobSettingsConstants.getExtraParameterName(EParameterName.DRIVER_JAR.getName());
    param=process.getElementParameter(paramName);
    if (param != null) {
      tContextLoadNode.getElementParameter(paramName).setValue(param.getValue());
    }
    paramName=JobSettingsConstants.getExtraParameterName(EParameterName.DRIVER_CLASS.getName());
    param=process.getElementParameter(paramName);
    if (param != null) {
      tContextLoadNode.getElementParameter(paramName).setValue(param.getValue());
    }
    paramName=JobSettingsConstants.getExtraParameterName(EParameterName.HOST.getName());
    tContextLoadNode.getElementParameter(paramName).setValue(process.getElementParameter(paramName).getValue());
    paramName=JobSettingsConstants.getExtraParameterName(EParameterName.PORT.getName());
    tContextLoadNode.getElementParameter(paramName).setValue(process.getElementParameter(paramName).getValue());
    paramName=JobSettingsConstants.getExtraParameterName(EParameterName.DBNAME.getName());
    tContextLoadNode.getElementParameter(paramName).setValue(process.getElementParameter(paramName).getValue());
    paramName=JobSettingsConstants.getExtraParameterName(EParameterName.DB_VERSION.getName());
    tContextLoadNode.getElementParameter(paramName).setValue(process.getElementParameter(paramName).getValue());
    paramName=JobSettingsConstants.getExtraParameterName(EParameterName.PROPERTIES.getName());
    param=process.getElementParameter(paramName);
    if (param != null) {
      tContextLoadNode.getElementParameter(paramName).setValue(param.getValue());
    }
    paramName=JobSettingsConstants.getExtraParameterName(EParameterName.SCHEMA_DB.getName());
    param=process.getElementParameter(paramName);
    if (param != null) {
      tContextLoadNode.getElementParameter(paramName).setValue(param.getValue());
    }
    String schema=(String)process.getElementParameter(paramName).getValue();
    if (schema != null) {
      schema=TalendTextUtils.removeQuotes(schema);
    }
    paramName=JobSettingsConstants.getExtraParameterName(EParameterName.USER.getName());
    tContextLoadNode.getElementParameter(paramName).setValue(process.getElementParameter(paramName).getValue());
    paramName=JobSettingsConstants.getExtraParameterName(EParameterName.PASS.getName());
    tContextLoadNode.getElementParameter(paramName).setValue(process.getElementParameter(paramName).getValue());
    paramName=JobSettingsConstants.getExtraParameterName(EParameterName.CONNECTION_TYPE.getName());
    tContextLoadNode.getElementParameter(paramName).setValue(OracleComponentHelper.filterOracleConnectionType((String)process.getElementParameter(JobSettingsConstants.getExtraParameterName(EParameterName.DB_TYPE.getName())).getValue()));
    paramName=JobSettingsConstants.getExtraParameterName(EParameterName.DBTABLE.getName());
    tContextLoadNode.getElementParameter(paramName).setValue(process.getElementParameter(paramName).getValue());
    String dbTableName=(String)process.getElementParameter(paramName).getValue();
    String realTableName=getCurrentTableName(dbTableName);
    if (realTableName == null) {
      realTableName=QueryUtil.DEFAULT_TABLE_NAME;
    }
    String dbType=getDatabaseTypeFromParameter(process);
    if (dbType != null) {
      if (dbType.equals(EDatabaseTypeName.GENERAL_JDBC.getDisplayName())) {
        dbType=findRealDbTypeForJDBC(process,dbType);
      }
      EDatabaseTypeName dbTypeName=EDatabaseTypeName.getTypeFromDbType(dbType);
      if (EDatabaseTypeName.ORACLE_OCI.equals(dbTypeName) || EDatabaseTypeName.ORACLEFORSID.equals(dbTypeName) || EDatabaseTypeName.ORACLESN.equals(dbTypeName)) {
        for (        IMetadataColumn column : table.getListColumns()) {
          column.setOriginalDbColumnName(column.getOriginalDbColumnName().toUpperCase());
        }
      }
      if (realTableName.startsWith(TalendTextUtils.QUOTATION_MARK) && realTableName.endsWith(TalendTextUtils.QUOTATION_MARK) && realTableName.length() > 2) {
        realTableName=realTableName.substring(1,realTableName.length() - 1);
      }
      String query=TalendTextUtils.addSQLQuotes(QueryUtil.generateNewQuery(null,table,dbType,schema,realTableName));
      paramName=JobSettingsConstants.getExtraParameterName(EParameterName.QUERY_CONDITION.getName());
      String conditionStatement=(String)process.getElementParameter(paramName).getValue();
      if (conditionStatement != null) {
        String tmp=TalendTextUtils.removeQuotes(conditionStatement);
        if (!"String_Node_Str".equals(tmp)) {
          query=query + CONNECTOR + QUOTE+ "String_Node_Str"+ QUOTE+ CONNECTOR+ conditionStatement;
        }
      }
      final String quoteByDBType=TalendTextUtils.getQuoteByDBType(dbType,false);
      if (dbTypeName == EDatabaseTypeName.MSSQL) {
        query=query.replaceAll("String_Node_Str","String_Node_Str" + quoteByDBType + "String_Node_Str"+ quoteByDBType);
      }
      tContextLoadNode.getElementParameter(JobSettingsConstants.QUERY).setValue(query);
    }
  }
  paramName=EParameterName.LOAD_NEW_VARIABLE.getName();
  param=process.getElementParameter(paramName);
  if (param != null) {
    tContextLoadNode.getElementParameter(paramName).setValue(param.getValue());
  }
  paramName=EParameterName.NOT_LOAD_OLD_VARIABLE.getName();
  param=process.getElementParameter(paramName);
  if (param != null) {
    tContextLoadNode.getElementParameter(paramName).setValue(param.getValue());
  }
  paramName=EParameterName.PRINT_OPERATIONS.getName();
  tContextLoadNode.getElementParameter(paramName).setValue(process.getElementParameter(paramName).getValue());
  paramName=EParameterName.DISABLE_ERROR.getName();
  param=process.getElementParameter(paramName);
  if (param != null) {
    tContextLoadNode.getElementParameter(paramName).setValue(param.getValue());
  }
  paramName=EParameterName.DISABLE_INFO.getName();
  param=process.getElementParameter(paramName);
  if (param != null) {
    tContextLoadNode.getElementParameter(paramName).setValue(param.getValue());
  }
  paramName=EParameterName.DISABLE_WARNINGS.getName();
  tContextLoadNode.getElementParameter(paramName).setValue(process.getElementParameter(paramName).getValue());
  tContextLoadNode.setProcess(process);
  nodeList.add(tContextLoadNode);
  return nodeList;
}