Program: 127586
Project: 127586
Buggy source:
@Override public List<TdColumn> fillColumns(ColumnSet colSet,DatabaseMetaData dbJDBCMetadata,List<String> columnFilter,String columnPattern){
  if (colSet == null || dbJDBCMetadata == null) {
    return null;
  }
  List<TdColumn> returnColumns=new ArrayList<TdColumn>();
  Map<String,TdColumn> columnMap=new HashMap<String,TdColumn>();
  String typeName=null;
  try {
    String catalogName=getName(CatalogHelper.getParentCatalog(colSet));
    Schema schema=SchemaHelper.getParentSchema(colSet);
    if (catalogName == null && schema != null) {
      catalogName=getName(CatalogHelper.getParentCatalog(schema));
    }
    String schemaPattern=getName(schema);
    schemaPattern="String_Node_Str".equals(schemaPattern) ? null : schemaPattern;
    String tablePattern=getName(colSet);
    if (MetadataConnectionUtils.isSybase(dbJDBCMetadata)) {
      schemaPattern=ColumnSetHelper.getTableOwner(colSet);
    }
    ResultSet columns;
    if (MetadataConnectionUtils.isMysql(dbJDBCMetadata)) {
      columns=dbJDBCMetadata.getColumns(catalogName,schemaPattern,"String_Node_Str" + tablePattern + "String_Node_Str",columnPattern);
    }
 else {
      columns=dbJDBCMetadata.getColumns(catalogName,schemaPattern,tablePattern,columnPattern);
    }
    boolean isOdbcTeradata=ConnectionUtils.isOdbcTeradata(dbJDBCMetadata);
    while (columns.next()) {
      int decimalDigits=0;
      int numPrecRadix=0;
      String columnName=columns.getString(GetColumn.COLUMN_NAME.name());
      TdColumn column=ColumnHelper.createTdColumn(columnName);
      int dataType=0;
      try {
        typeName=columns.getString(GetColumn.TYPE_NAME.name());
        typeName=typeName.toUpperCase().trim();
        typeName=ManagementTextUtils.filterSpecialChar(typeName);
        if (typeName.startsWith("String_Node_Str") && typeName.endsWith("String_Node_Str")) {
          typeName="String_Node_Str";
        }
        typeName=MetadataToolHelper.validateValueForDBType(typeName);
        if (dbJDBCMetadata instanceof DB2ForZosDataBaseMetadata) {
          dataType=Java2SqlType.getJavaTypeBySqlType(typeName);
          decimalDigits=columns.getInt(GetColumn.DECIMAL_DIGITS.name());
        }
 else         if (dbJDBCMetadata instanceof TeradataDataBaseMetadata) {
          dataType=Java2SqlType.getTeradataJavaTypeBySqlTypeAsInt(typeName);
          typeName=Java2SqlType.getTeradataJavaTypeBySqlTypeAsString(typeName);
        }
 else {
          dataType=columns.getInt(GetColumn.DATA_TYPE.name());
          if (!isOdbcTeradata) {
            numPrecRadix=columns.getInt(GetColumn.NUM_PREC_RADIX.name());
            decimalDigits=columns.getInt(GetColumn.DECIMAL_DIGITS.name());
          }
        }
        if (MetadataConnectionUtils.isMssql(dbJDBCMetadata)) {
          if (typeName.toLowerCase().equals("String_Node_Str")) {
            dataType=91;
          }
 else           if (typeName.toLowerCase().equals("String_Node_Str")) {
            dataType=92;
          }
        }
        if (!isOdbcTeradata) {
          int column_size=columns.getInt(GetColumn.COLUMN_SIZE.name());
          column.setLength(column_size);
        }
      }
 catch (      Exception e1) {
        log.warn(e1,e1);
      }
      TdSqlDataType sqlDataType=MetadataConnectionUtils.createDataType(dataType,typeName,decimalDigits,numPrecRadix);
      column.setSqlDataType(sqlDataType);
      int nullable=0;
      if (dbJDBCMetadata instanceof DB2ForZosDataBaseMetadata || dbJDBCMetadata instanceof TeradataDataBaseMetadata || dbJDBCMetadata instanceof EmbeddedHiveDataBaseMetadata) {
        String isNullable=columns.getString("String_Node_Str");
        if (!isNullable.equals("String_Node_Str")) {
          nullable=1;
        }
      }
 else {
        nullable=columns.getInt(GetColumn.NULLABLE.name());
      }
      column.getSqlDataType().setNullable(NullableType.get(nullable));
      String colComment=columns.getString(GetColumn.REMARKS.name());
      if (colComment == null) {
        colComment="String_Node_Str";
      }
      ColumnHelper.setComment(colComment,column);
      Object defaultvalue=null;
      try {
        if (!isOdbcTeradata) {
          defaultvalue=columns.getObject(GetColumn.COLUMN_DEF.name());
        }
      }
 catch (      Exception e1) {
        log.warn(e1,e1);
      }
      String defaultStr=(defaultvalue != null) ? String.valueOf(defaultvalue) : null;
      TdExpression defExpression=createTdExpression(GetColumn.COLUMN_DEF.name(),defaultStr);
      column.setInitialValue(defExpression);
      ExtractMetaDataUtils.handleDefaultValue(column,dbJDBCMetadata);
      DatabaseConnection dbConnection=(DatabaseConnection)ConnectionHelper.getConnection(colSet);
      String dbmsId=dbConnection == null ? null : dbConnection.getDbmsId();
      if (dbmsId != null) {
        MappingTypeRetriever mappingTypeRetriever=MetadataTalendType.getMappingTypeRetriever(dbmsId);
        String talendType=mappingTypeRetriever.getDefaultSelectedTalendType(typeName,ExtractMetaDataUtils.getIntMetaDataInfo(columns,"String_Node_Str"),(dbJDBCMetadata instanceof TeradataDataBaseMetadata) ? 0 : ExtractMetaDataUtils.getIntMetaDataInfo(columns,"String_Node_Str"));
        column.setTalendType(talendType);
        String defaultSelectedDbType=MetadataTalendType.getMappingTypeRetriever(dbConnection.getDbmsId()).getDefaultSelectedDbType(talendType);
        column.setSourceType(defaultSelectedDbType);
      }
      try {
        column.setNullable("String_Node_Str".equals(columns.getString(GetColumn.IS_NULLABLE.name())));
      }
 catch (      Exception e) {
      }
      returnColumns.add(column);
      columnMap.put(columnName,column);
    }
    columns.close();
    if (isLinked()) {
      ColumnSetHelper.addColumns(colSet,returnColumns);
    }
    fillPkandFk(colSet,columnMap,dbJDBCMetadata,catalogName,schemaPattern,tablePattern);
  }
 catch (  Exception e) {
    log.error(e,e);
  }
  return returnColumns;
}

Fixed version (ground truth):
@Override public List<TdColumn> fillColumns(ColumnSet colSet,DatabaseMetaData dbJDBCMetadata,List<String> columnFilter,String columnPattern){
  if (colSet == null || dbJDBCMetadata == null) {
    return null;
  }
  List<TdColumn> returnColumns=new ArrayList<TdColumn>();
  Map<String,TdColumn> columnMap=new HashMap<String,TdColumn>();
  String typeName=null;
  try {
    String catalogName=getName(CatalogHelper.getParentCatalog(colSet));
    Schema schema=SchemaHelper.getParentSchema(colSet);
    if (catalogName == null && schema != null) {
      catalogName=getName(CatalogHelper.getParentCatalog(schema));
    }
    String schemaPattern=getName(schema);
    schemaPattern="String_Node_Str".equals(schemaPattern) ? null : schemaPattern;
    String tablePattern=getName(colSet);
    if (MetadataConnectionUtils.isSybase(dbJDBCMetadata)) {
      schemaPattern=ColumnSetHelper.getTableOwner(colSet);
    }
    ResultSet columns=dbJDBCMetadata.getColumns(catalogName,schemaPattern,tablePattern,columnPattern);
    boolean isOdbcTeradata=ConnectionUtils.isOdbcTeradata(dbJDBCMetadata);
    while (columns.next()) {
      int decimalDigits=0;
      int numPrecRadix=0;
      String columnName=columns.getString(GetColumn.COLUMN_NAME.name());
      TdColumn column=ColumnHelper.createTdColumn(columnName);
      int dataType=0;
      try {
        typeName=columns.getString(GetColumn.TYPE_NAME.name());
        typeName=typeName.toUpperCase().trim();
        typeName=ManagementTextUtils.filterSpecialChar(typeName);
        if (typeName.startsWith("String_Node_Str") && typeName.endsWith("String_Node_Str")) {
          typeName="String_Node_Str";
        }
        typeName=MetadataToolHelper.validateValueForDBType(typeName);
        if (dbJDBCMetadata instanceof DB2ForZosDataBaseMetadata) {
          dataType=Java2SqlType.getJavaTypeBySqlType(typeName);
          decimalDigits=columns.getInt(GetColumn.DECIMAL_DIGITS.name());
        }
 else         if (dbJDBCMetadata instanceof TeradataDataBaseMetadata) {
          dataType=Java2SqlType.getTeradataJavaTypeBySqlTypeAsInt(typeName);
          typeName=Java2SqlType.getTeradataJavaTypeBySqlTypeAsString(typeName);
        }
 else {
          dataType=columns.getInt(GetColumn.DATA_TYPE.name());
          if (!isOdbcTeradata) {
            numPrecRadix=columns.getInt(GetColumn.NUM_PREC_RADIX.name());
            decimalDigits=columns.getInt(GetColumn.DECIMAL_DIGITS.name());
          }
        }
        if (MetadataConnectionUtils.isMssql(dbJDBCMetadata)) {
          if (typeName.toLowerCase().equals("String_Node_Str")) {
            dataType=91;
          }
 else           if (typeName.toLowerCase().equals("String_Node_Str")) {
            dataType=92;
          }
        }
        if (!isOdbcTeradata) {
          int column_size=columns.getInt(GetColumn.COLUMN_SIZE.name());
          column.setLength(column_size);
        }
      }
 catch (      Exception e1) {
        log.warn(e1,e1);
      }
      TdSqlDataType sqlDataType=MetadataConnectionUtils.createDataType(dataType,typeName,decimalDigits,numPrecRadix);
      column.setSqlDataType(sqlDataType);
      int nullable=0;
      if (dbJDBCMetadata instanceof DB2ForZosDataBaseMetadata || dbJDBCMetadata instanceof TeradataDataBaseMetadata || dbJDBCMetadata instanceof EmbeddedHiveDataBaseMetadata) {
        String isNullable=columns.getString("String_Node_Str");
        if (!isNullable.equals("String_Node_Str")) {
          nullable=1;
        }
      }
 else {
        nullable=columns.getInt(GetColumn.NULLABLE.name());
      }
      column.getSqlDataType().setNullable(NullableType.get(nullable));
      String colComment=columns.getString(GetColumn.REMARKS.name());
      if (colComment == null) {
        colComment="String_Node_Str";
      }
      ColumnHelper.setComment(colComment,column);
      Object defaultvalue=null;
      try {
        if (!isOdbcTeradata) {
          defaultvalue=columns.getObject(GetColumn.COLUMN_DEF.name());
        }
      }
 catch (      Exception e1) {
        log.warn(e1,e1);
      }
      String defaultStr=(defaultvalue != null) ? String.valueOf(defaultvalue) : null;
      TdExpression defExpression=createTdExpression(GetColumn.COLUMN_DEF.name(),defaultStr);
      column.setInitialValue(defExpression);
      ExtractMetaDataUtils.handleDefaultValue(column,dbJDBCMetadata);
      DatabaseConnection dbConnection=(DatabaseConnection)ConnectionHelper.getConnection(colSet);
      String dbmsId=dbConnection == null ? null : dbConnection.getDbmsId();
      if (dbmsId != null) {
        MappingTypeRetriever mappingTypeRetriever=MetadataTalendType.getMappingTypeRetriever(dbmsId);
        String talendType=mappingTypeRetriever.getDefaultSelectedTalendType(typeName,ExtractMetaDataUtils.getIntMetaDataInfo(columns,"String_Node_Str"),(dbJDBCMetadata instanceof TeradataDataBaseMetadata) ? 0 : ExtractMetaDataUtils.getIntMetaDataInfo(columns,"String_Node_Str"));
        column.setTalendType(talendType);
        String defaultSelectedDbType=MetadataTalendType.getMappingTypeRetriever(dbConnection.getDbmsId()).getDefaultSelectedDbType(talendType);
        column.setSourceType(defaultSelectedDbType);
      }
      try {
        column.setNullable("String_Node_Str".equals(columns.getString(GetColumn.IS_NULLABLE.name())));
      }
 catch (      Exception e) {
      }
      returnColumns.add(column);
      columnMap.put(columnName,column);
    }
    columns.close();
    if (isLinked()) {
      ColumnSetHelper.addColumns(colSet,returnColumns);
    }
    fillPkandFk(colSet,columnMap,dbJDBCMetadata,catalogName,schemaPattern,tablePattern);
  }
 catch (  Exception e) {
    log.error(e,e);
  }
  return returnColumns;
}