Program: 125462
Project: 125462
Buggy source:
@Override public ResultSet getTables(String catalog,String database,String tableNamePattern,String[] types) throws SQLException {
  if (databaseName != null && !databaseName.trim().isEmpty()) {
    database=databaseName;
  }
  String sql=null;
  if (types != null && types.length > 0) {
    sql="String_Node_Str" + database + "String_Node_Str"+ addTypesToSql(types);
  }
 else {
    sql="String_Node_Str" + database + "String_Node_Str";
  }
  if (!StringUtils.isEmpty(tableNamePattern)) {
    sql=sql + "String_Node_Str" + tableNamePattern+ "String_Node_Str";
  }
  if (types != null && types.length > 0) {
    sql=sql + "String_Node_Str";
  }
 else {
    sql=sql + "String_Node_Str";
  }
  ResultSet rs=null;
  Statement stmt=null;
  List<String[]> list=new ArrayList<String[]>();
  try {
    stmt=connection.createStatement();
    rs=stmt.executeQuery(sql);
    while (rs.next()) {
      String name=rs.getString("String_Node_Str").trim();
      if (database == null || "String_Node_Str".equals(database)) {
        database=rs.getString("String_Node_Str").trim();
      }
      String type=rs.getString("String_Node_Str").trim();
      String[] r=new String[]{"String_Node_Str",database,name,type,"String_Node_Str"};
      list.add(r);
    }
  }
 catch (  SQLException e) {
    throw new RuntimeException(e);
  }
 finally {
    try {
      rs.close();
      stmt.close();
    }
 catch (    Exception e) {
    }
  }
  TeradataResultSet tableResultSet=new TeradataResultSet();
  tableResultSet.setMetadata(TABLE_META);
  tableResultSet.setData(list);
  return tableResultSet;
}

Fixed version (ground truth):
@Override public ResultSet getTables(String catalog,String database,String tableNamePattern,String[] types) throws SQLException {
  if (databaseName != null && !databaseName.trim().isEmpty()) {
    database=databaseName;
  }
  String sql=null;
  int dbMajorVersion=connection.getMetaData().getDatabaseMajorVersion();
  String sysTable="String_Node_Str";
  if (dbMajorVersion > 12) {
    sysTable="String_Node_Str";
  }
  if (types != null && types.length > 0) {
    sql="String_Node_Str" + sysTable + "String_Node_Str"+ database+ "String_Node_Str"+ addTypesToSql(types);
  }
 else {
    sql="String_Node_Str" + sysTable + "String_Node_Str"+ database+ "String_Node_Str";
  }
  if (!StringUtils.isEmpty(tableNamePattern)) {
    sql=sql + "String_Node_Str" + tableNamePattern+ "String_Node_Str";
  }
  if (types != null && types.length > 0) {
    sql=sql + "String_Node_Str";
  }
 else {
    sql=sql + "String_Node_Str";
  }
  ResultSet rs=null;
  Statement stmt=null;
  List<String[]> list=new ArrayList<String[]>();
  try {
    stmt=connection.createStatement();
    rs=stmt.executeQuery(sql);
    while (rs.next()) {
      String name=rs.getString("String_Node_Str").trim();
      if (database == null || "String_Node_Str".equals(database)) {
        database=rs.getString("String_Node_Str").trim();
      }
      String type=rs.getString("String_Node_Str").trim();
      String[] r=new String[]{"String_Node_Str",database,name,type,"String_Node_Str"};
      list.add(r);
    }
  }
 catch (  SQLException e) {
    throw new RuntimeException(e);
  }
 finally {
    try {
      rs.close();
      stmt.close();
    }
 catch (    Exception e) {
    }
  }
  TeradataResultSet tableResultSet=new TeradataResultSet();
  tableResultSet.setMetadata(TABLE_META);
  tableResultSet.setData(list);
  return tableResultSet;
}