Program: 129925
Project: 129925
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 {
    java.sql.Connection sqlConnection=dbJDBCMetadata.getConnection();
    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);
    String tablePattern=getName(colSet);
    if (MetadataConnectionUtils.isSybase(dbJDBCMetadata)) {
      schemaPattern=ColumnSetHelper.getTableOwner(colSet);
    }
    ResultSet columns=dbJDBCMetadata.getColumns(catalogName,schemaPattern,tablePattern,columnPattern);
    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());
        if (!(dbJDBCMetadata instanceof DB2ForZosDataBaseMetadata)) {
          dataType=columns.getInt(GetColumn.DATA_TYPE.name());
          numPrecRadix=columns.getInt(GetColumn.NUM_PREC_RADIX.name());
        }
 else {
          dataType=Java2SqlType.getJavaTypeBySqlType(typeName);
        }
        if (MetadataConnectionUtils.isMssql(dbJDBCMetadata)) {
          if (typeName.toLowerCase().equals("String_Node_Str")) {
            dataType=91;
          }
 else           if (typeName.toLowerCase().equals("String_Node_Str")) {
            dataType=92;
          }
        }
        int column_size=columns.getInt(GetColumn.COLUMN_SIZE.name());
        column.setLength(column_size);
        decimalDigits=columns.getInt(GetColumn.DECIMAL_DIGITS.name());
      }
 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)) {
        nullable=columns.getInt(GetColumn.NULLABLE.name());
      }
 else {
        String isNullable=columns.getString("String_Node_Str");
        if (!isNullable.equals("String_Node_Str")) {
          nullable=1;
        }
      }
      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 {
        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);
      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"),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);
    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());
        if (!(dbJDBCMetadata instanceof DB2ForZosDataBaseMetadata)) {
          dataType=columns.getInt(GetColumn.DATA_TYPE.name());
          numPrecRadix=columns.getInt(GetColumn.NUM_PREC_RADIX.name());
        }
 else {
          dataType=Java2SqlType.getJavaTypeBySqlType(typeName);
        }
        if (MetadataConnectionUtils.isMssql(dbJDBCMetadata)) {
          if (typeName.toLowerCase().equals("String_Node_Str")) {
            dataType=91;
          }
 else           if (typeName.toLowerCase().equals("String_Node_Str")) {
            dataType=92;
          }
        }
        int column_size=columns.getInt(GetColumn.COLUMN_SIZE.name());
        column.setLength(column_size);
        decimalDigits=columns.getInt(GetColumn.DECIMAL_DIGITS.name());
      }
 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)) {
        nullable=columns.getInt(GetColumn.NULLABLE.name());
      }
 else {
        String isNullable=columns.getString("String_Node_Str");
        if (!isNullable.equals("String_Node_Str")) {
          nullable=1;
        }
      }
      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 {
        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);
      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"),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;
}