Program: 139371
Project: 139371
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()) {
    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;
    Expression defExpression=BooleanExpressionHelper.createExpression(GetColumn.COLUMN_DEF.name(),defaultStr);
    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);
    try {
      column.setLength(columns.getInt(GetColumn.COLUMN_SIZE.name()));
    }
 catch (    Exception e1) {
      log.warn(e1,e1);
    }
    try {
      column.setIsNullable(NullableType.get(columns.getInt(GetColumn.NULLABLE.name())));
    }
 catch (    Exception e1) {
      log.warn(e1,e1);
    }
    try {
      column.setJavaType(columns.getInt(GetColumn.DATA_TYPE.name()));
    }
 catch (    Exception e) {
      log.warn(e,e);
    }
    try {
      String colComment=getComment(colName,columns);
      ColumnHelper.setComment(colComment,column);
    }
 catch (    Exception e) {
      log.warn(e,e);
    }
    TdSqlDataType sqlDataType=DatabaseContentRetriever.createDataType(columns);
    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());
      column.setJavaType(dataType);
    }
 catch (    Exception e) {
      log.warn(e,e);
    }
    String typeName=null;
    try {
      typeName=columns.getString(GetColumn.TYPE_NAME.name());
    }
 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;
    Expression defExpression=BooleanExpressionHelper.createExpression(GetColumn.COLUMN_DEF.name(),defaultStr);
    try {
      column.setIsNullable(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;
}