Program: 139431
Project: 139431
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=columns.getObject(GetColumn.COLUMN_DEF.name());
    String defaultStr=(defaultvalue != null) ? String.valueOf(defaultvalue) : null;
    Expression defExpression=BooleanExpressionHelper.createExpression(GetColumn.COLUMN_DEF.name(),defaultStr);
    String colName=columns.getString(GetColumn.COLUMN_NAME.name());
    TdColumn column=ColumnHelper.createTdColumn(colName);
    column.setLength(columns.getInt(GetColumn.COLUMN_SIZE.name()));
    column.setIsNullable(NullableType.get(columns.getInt(GetColumn.NULLABLE.name())));
    column.setJavaType(columns.getInt(GetColumn.DATA_TYPE.name()));
    String colComment=getComment(colName,columns);
    ColumnHelper.setComment(colComment,column);
    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()) {
    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;
}