Program: 84062
Project: 84062
Buggy source:
protected void readIndexes(DatabaseSnapshot snapshot,String schema,DatabaseMetaData databaseMetaData) throws DatabaseException, SQLException {
  Database database=snapshot.getDatabase();
  updateListeners("String_Node_Str" + database.toString() + "String_Node_Str");
  String query="String_Node_Str" + database.convertRequestedSchemaToSchema(schema) + "String_Node_Str";
  Statement statement=((JdbcConnection)database.getConnection()).getUnderlyingConnection().createStatement();
  ResultSet rs=statement.executeQuery(query);
  while (rs.next()) {
    String indexName=convertFromDatabaseName(rs.getString("String_Node_Str"));
    String tableName=rs.getString("String_Node_Str");
    String tableSpace=rs.getString("String_Node_Str");
    String columnName=convertFromDatabaseName(rs.getString("String_Node_Str"));
    if (columnName == null) {
      continue;
    }
    short type=rs.getShort("String_Node_Str");
    boolean nonUnique=true;
    try {
      nonUnique=rs.getBoolean("String_Node_Str");
    }
 catch (    SQLException e) {
    }
    short position=rs.getShort("String_Node_Str");
    String filterCondition=rs.getString("String_Node_Str");
    if (type == DatabaseMetaData.tableIndexStatistic) {
      continue;
    }
    Index index;
    index=new Index();
    index.setTable(snapshot.getTable(tableName));
    index.setTablespace(tableSpace);
    index.setName(indexName);
    index.setUnique(!nonUnique);
    index.setFilterCondition(filterCondition);
    for (int i=index.getColumns().size(); i < position; i++) {
      index.getColumns().add(null);
    }
    index.getColumns().set(position - 1,columnName);
    snapshot.getIndexes().add(index);
  }
  JdbcUtils.closeResultSet(rs);
  JdbcUtils.closeStatement(statement);
  for (  Index index : snapshot.getIndexes()) {
    for (    PrimaryKey pk : snapshot.getPrimaryKeys()) {
      if (index.getTable().getName().equalsIgnoreCase(pk.getTable().getName()) && index.getColumnNames().equals(pk.getColumnNames())) {
        index.addAssociatedWith(Index.MARK_PRIMARY_KEY);
      }
    }
    for (    ForeignKey fk : snapshot.getForeignKeys()) {
      if (index.getTable().getName().equalsIgnoreCase(fk.getForeignKeyTable().getName()) && index.getColumnNames().equals(fk.getForeignKeyColumns())) {
        index.addAssociatedWith(Index.MARK_FOREIGN_KEY);
      }
    }
    for (    UniqueConstraint uc : snapshot.getUniqueConstraints()) {
      if (index.getTable().getName().equalsIgnoreCase(uc.getTable().getName()) && index.getColumnNames().equals(uc.getColumnNames())) {
        index.addAssociatedWith(Index.MARK_UNIQUE_CONSTRAINT);
      }
    }
  }
}

Fixed version (ground truth):
protected void readIndexes(DatabaseSnapshot snapshot,String schema,DatabaseMetaData databaseMetaData) throws DatabaseException, SQLException {
  Database database=snapshot.getDatabase();
  updateListeners("String_Node_Str" + database.toString() + "String_Node_Str");
  String query="String_Node_Str" + database.convertRequestedSchemaToSchema(schema) + "String_Node_Str";
  Statement statement=((JdbcConnection)database.getConnection()).getUnderlyingConnection().createStatement();
  ResultSet rs=statement.executeQuery(query);
  Map<String,Index> indexMap=new HashMap<String,Index>();
  while (rs.next()) {
    String indexName=convertFromDatabaseName(rs.getString("String_Node_Str"));
    String tableName=rs.getString("String_Node_Str");
    String tableSpace=rs.getString("String_Node_Str");
    String columnName=convertFromDatabaseName(rs.getString("String_Node_Str"));
    if (columnName == null) {
      continue;
    }
    short type=rs.getShort("String_Node_Str");
    boolean nonUnique=true;
    try {
      nonUnique=rs.getBoolean("String_Node_Str");
    }
 catch (    SQLException e) {
    }
    short position=rs.getShort("String_Node_Str");
    String filterCondition=rs.getString("String_Node_Str");
    if (type == DatabaseMetaData.tableIndexStatistic) {
      continue;
    }
    Index index;
    if (indexMap.containsKey(indexName)) {
      index=indexMap.get(indexName);
    }
 else {
      index=new Index();
      index.setTable(snapshot.getTable(tableName));
      index.setTablespace(tableSpace);
      index.setName(indexName);
      index.setUnique(!nonUnique);
      index.setFilterCondition(filterCondition);
      indexMap.put(indexName,index);
    }
    for (int i=index.getColumns().size(); i < position; i++) {
      index.getColumns().add(null);
    }
    index.getColumns().set(position - 1,columnName);
  }
  JdbcUtils.closeResultSet(rs);
  JdbcUtils.closeStatement(statement);
  for (  Map.Entry<String,Index> entry : indexMap.entrySet()) {
    snapshot.getIndexes().add(entry.getValue());
  }
  for (  Index index : snapshot.getIndexes()) {
    for (    PrimaryKey pk : snapshot.getPrimaryKeys()) {
      if (index.getTable().getName().equalsIgnoreCase(pk.getTable().getName()) && index.getColumnNames().equals(pk.getColumnNames())) {
        index.addAssociatedWith(Index.MARK_PRIMARY_KEY);
      }
    }
    for (    ForeignKey fk : snapshot.getForeignKeys()) {
      if (index.getTable().getName().equalsIgnoreCase(fk.getForeignKeyTable().getName()) && index.getColumnNames().equals(fk.getForeignKeyColumns())) {
        index.addAssociatedWith(Index.MARK_FOREIGN_KEY);
      }
    }
    for (    UniqueConstraint uc : snapshot.getUniqueConstraints()) {
      if (index.getTable().getName().equalsIgnoreCase(uc.getTable().getName()) && index.getColumnNames().equals(uc.getColumnNames())) {
        index.addAssociatedWith(Index.MARK_UNIQUE_CONSTRAINT);
      }
    }
  }
}