Program: 138946
Project: 138946
Buggy source:
/** 
 * Method "getColumns".
 * @param catalogName a catalog name; must match the catalog name as it is stored in the database; "" retrievesthose without a catalog; null means that the catalog name should not be used to narrow the search
 * @param schemaPattern a schema name pattern; must match the schema name as it is stored in the database; ""retrieves those without a schema; null means that the schema name should not be used to narrow the search
 * @param tablePattern a table name pattern; must match the table name as it is stored in the database
 * @param columnPattern a column name pattern; must match the column name as it is stored in the database
 * @throws SQLException
 * @see DatabaseMetaData#getColumns(String,String,String,String)
 */
public List<TdColumn> getColumns(String catalogName,String schemaPattern,String tablePattern,String columnPattern) throws SQLException {
  List<TdColumn> tableColumns=new ArrayList<TdColumn>();
  ResultSet columns=getConnectionMetadata(connection).getColumns(catalogName,schemaPattern,tablePattern,columnPattern);
  while (columns.next()) {
    String colName=null;
    try {
      colName=columns.getString(GetColumn.COLUMN_NAME.name());
    }
 catch (    Exception e1) {
      log.warn(e1,e1);
      if (colName == null) {
        colName=e1.getMessage();
      }
    }
    TdColumn column=ColumnHelper.createTdColumn(colName);
    int dataType=0;
    try {
      dataType=columns.getInt(GetColumn.DATA_TYPE.name());
      column.getSqlDataType().setJavaDataType(dataType);
    }
 catch (    Exception e) {
      log.warn(e,e);
    }
    String typeName=null;
    try {
      typeName=columns.getString(GetColumn.TYPE_NAME.name());
      if (ConnectionUtils.isMssql(connection)) {
        if (typeName.toLowerCase().equals("String_Node_Str")) {
          column.getSqlDataType().setJavaDataType(91);
        }
 else         if (typeName.toLowerCase().equals("String_Node_Str")) {
          column.getSqlDataType().setJavaDataType(92);
        }
      }
    }
 catch (    Exception e1) {
      log.warn(e1,e1);
    }
    try {
      column.setLength(columns.getInt(GetColumn.COLUMN_SIZE.name()));
    }
 catch (    Exception e1) {
      log.warn(e1,e1);
    }
    int decimalDigits=0;
    try {
      decimalDigits=columns.getInt(GetColumn.DECIMAL_DIGITS.name());
    }
 catch (    Exception e) {
      log.warn(e);
    }
    int numPrecRadix=0;
    try {
      numPrecRadix=columns.getInt(GetColumn.NUM_PREC_RADIX.name());
    }
 catch (    Exception e) {
      log.warn(e);
    }
    try {
      String colComment=getComment(colName,columns);
      ColumnHelper.setComment(colComment,column);
    }
 catch (    Exception e) {
      log.warn(e,e);
    }
    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=BooleanExpressionHelper.createTdExpression(GetColumn.COLUMN_DEF.name(),defaultStr);
    try {
      column.getSqlDataType().setNullable(NullableType.get(columns.getInt(GetColumn.NULLABLE.name())));
    }
 catch (    Exception e1) {
      log.warn(e1,e1);
    }
    TdSqlDataType sqlDataType=DatabaseContentRetriever.createDataType(dataType,typeName,decimalDigits,numPrecRadix);
    column.setSqlDataType(sqlDataType);
    column.setInitialValue(defExpression);
    tableColumns.add(column);
  }
  columns.close();
  return tableColumns;
}

Fixed version (ground truth):
/** 
 * Method "getColumns".
 * @param catalogName a catalog name; must match the catalog name as it is stored in the database; "" retrievesthose without a catalog; null means that the catalog name should not be used to narrow the search
 * @param schemaPattern a schema name pattern; must match the schema name as it is stored in the database; ""retrieves those without a schema; null means that the schema name should not be used to narrow the search
 * @param tablePattern a table name pattern; must match the table name as it is stored in the database
 * @param columnPattern a column name pattern; must match the column name as it is stored in the database
 * @throws SQLException
 * @see DatabaseMetaData#getColumns(String,String,String,String)
 */
public List<TdColumn> getColumns(String catalogName,String schemaPattern,String tablePattern,String columnPattern) throws SQLException {
  List<TdColumn> tableColumns=new ArrayList<TdColumn>();
  ResultSet columns=getConnectionMetadata(connection).getColumns(catalogName,schemaPattern,tablePattern,columnPattern);
  while (columns.next()) {
    String colName=null;
    try {
      colName=columns.getString(GetColumn.COLUMN_NAME.name());
    }
 catch (    Exception e1) {
      log.warn(e1,e1);
      if (colName == null) {
        colName=e1.getMessage();
      }
    }
    TdColumn column=ColumnHelper.createTdColumn(colName);
    int dataType=0;
    try {
      dataType=columns.getInt(GetColumn.DATA_TYPE.name());
    }
 catch (    Exception e) {
      log.warn(e,e);
    }
    String typeName=null;
    try {
      typeName=columns.getString(GetColumn.TYPE_NAME.name());
      if (ConnectionUtils.isMssql(connection)) {
        if (typeName.toLowerCase().equals("String_Node_Str")) {
          dataType=91;
        }
 else         if (typeName.toLowerCase().equals("String_Node_Str")) {
          dataType=92;
        }
      }
    }
 catch (    Exception e1) {
      log.warn(e1,e1);
    }
    try {
      column.setLength(columns.getInt(GetColumn.COLUMN_SIZE.name()));
    }
 catch (    Exception e1) {
      log.warn(e1,e1);
    }
    int decimalDigits=0;
    try {
      decimalDigits=columns.getInt(GetColumn.DECIMAL_DIGITS.name());
    }
 catch (    Exception e) {
      log.warn(e);
    }
    int numPrecRadix=0;
    try {
      numPrecRadix=columns.getInt(GetColumn.NUM_PREC_RADIX.name());
    }
 catch (    Exception e) {
      log.warn(e);
    }
    try {
      String colComment=getComment(colName,columns);
      ColumnHelper.setComment(colComment,column);
    }
 catch (    Exception e) {
      log.warn(e,e);
    }
    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=BooleanExpressionHelper.createTdExpression(GetColumn.COLUMN_DEF.name(),defaultStr);
    TdSqlDataType sqlDataType=DatabaseContentRetriever.createDataType(dataType,typeName,decimalDigits,numPrecRadix);
    column.setSqlDataType(sqlDataType);
    try {
      column.getSqlDataType().setNullable(NullableType.get(columns.getInt(GetColumn.NULLABLE.name())));
    }
 catch (    Exception e1) {
      log.warn(e1,e1);
    }
    column.setInitialValue(defExpression);
    tableColumns.add(column);
  }
  columns.close();
  return tableColumns;
}