Program: 84074
Project: 84074
Buggy source:
protected void readIndexes(String schema) throws JDBCException, SQLException {
  updateListeners("String_Node_Str" + database.toString() + "String_Node_Str");
  for (  Table table : tablesMap.values()) {
    ResultSet rs;
    Statement statement=null;
    if (database instanceof OracleDatabase) {
      statement=database.getConnection().createStatement();
      String sql="String_Node_Str" + database.convertRequestedSchemaToSchema(schema) + "String_Node_Str"+ table.getName()+ "String_Node_Str";
      rs=statement.executeQuery(sql);
    }
 else {
      rs=databaseMetaData.getIndexInfo(database.convertRequestedSchemaToCatalog(schema),database.convertRequestedSchemaToSchema(schema),table.getName(),false,true);
    }
    Map<String,Index> indexMap=new HashMap<String,Index>();
    while (rs.next()) {
      String indexName=convertFromDatabaseName(rs.getString("String_Node_Str"));
      short type=rs.getShort("String_Node_Str");
      boolean nonUnique=true;
      try {
        nonUnique=rs.getBoolean("String_Node_Str");
      }
 catch (      SQLException e) {
      }
      String columnName=convertFromDatabaseName(rs.getString("String_Node_Str"));
      short position=rs.getShort("String_Node_Str");
      String filterCondition=rs.getString("String_Node_Str");
      if (type == DatabaseMetaData.tableIndexStatistic) {
        continue;
      }
      if (columnName == null) {
        continue;
      }
      Index indexInformation;
      if (indexMap.containsKey(indexName)) {
        indexInformation=indexMap.get(indexName);
      }
 else {
        indexInformation=new Index();
        indexInformation.setTable(table);
        indexInformation.setName(indexName);
        indexInformation.setUnique(!nonUnique);
        indexInformation.setFilterCondition(filterCondition);
        indexMap.put(indexName,indexInformation);
      }
      final int columnsBefore=indexInformation.getColumns().size() + 1;
      for (int i=position; i > columnsBefore; --i) {
        indexInformation.getColumns().add(null);
      }
    }
    for (    Map.Entry<String,Index> entry : indexMap.entrySet()) {
      indexes.add(entry.getValue());
    }
    rs.close();
    if (statement != null) {
      statement.close();
    }
  }
  Set<Index> indexesToRemove=new HashSet<Index>();
  for (  Index index : indexes) {
    for (    PrimaryKey pk : primaryKeys) {
      if (index.getTable().getName().equalsIgnoreCase(pk.getTable().getName()) && index.getColumnNames().equals(pk.getColumnNames())) {
        indexesToRemove.add(index);
      }
    }
    for (    ForeignKey fk : foreignKeys) {
      if (index.getTable().getName().equalsIgnoreCase(fk.getForeignKeyTable().getName()) && index.getColumnNames().equals(fk.getForeignKeyColumns())) {
        indexesToRemove.add(index);
      }
    }
    for (    UniqueConstraint uc : uniqueConstraints) {
      if (index.getTable().getName().equalsIgnoreCase(uc.getTable().getName()) && index.getColumnNames().equals(uc.getColumnNames())) {
        indexesToRemove.add(index);
      }
    }
  }
  indexes.removeAll(indexesToRemove);
}

Fixed version (ground truth):
protected void readIndexes(String schema) throws JDBCException, SQLException {
  updateListeners("String_Node_Str" + database.toString() + "String_Node_Str");
  for (  Table table : tablesMap.values()) {
    ResultSet rs;
    Statement statement=null;
    if (database instanceof OracleDatabase) {
      statement=database.getConnection().createStatement();
      String sql="String_Node_Str" + database.convertRequestedSchemaToSchema(schema) + "String_Node_Str"+ table.getName()+ "String_Node_Str";
      rs=statement.executeQuery(sql);
    }
 else {
      rs=databaseMetaData.getIndexInfo(database.convertRequestedSchemaToCatalog(schema),database.convertRequestedSchemaToSchema(schema),table.getName(),false,true);
    }
    Map<String,Index> indexMap=new HashMap<String,Index>();
    while (rs.next()) {
      String indexName=convertFromDatabaseName(rs.getString("String_Node_Str"));
      short type=rs.getShort("String_Node_Str");
      boolean nonUnique=true;
      try {
        nonUnique=rs.getBoolean("String_Node_Str");
      }
 catch (      SQLException e) {
      }
      String columnName=convertFromDatabaseName(rs.getString("String_Node_Str"));
      short position=rs.getShort("String_Node_Str");
      String filterCondition=rs.getString("String_Node_Str");
      if (type == DatabaseMetaData.tableIndexStatistic) {
        continue;
      }
      if (columnName == null) {
        continue;
      }
      Index indexInformation;
      if (indexMap.containsKey(indexName)) {
        indexInformation=indexMap.get(indexName);
      }
 else {
        indexInformation=new Index();
        indexInformation.setTable(table);
        indexInformation.setName(indexName);
        indexInformation.setUnique(!nonUnique);
        indexInformation.setFilterCondition(filterCondition);
        indexMap.put(indexName,indexInformation);
      }
      for (int i=indexInformation.getColumns().size(); i < position; i++) {
        indexInformation.getColumns().add(null);
      }
      indexInformation.getColumns().set(position - 1,columnName);
    }
    for (    Map.Entry<String,Index> entry : indexMap.entrySet()) {
      indexes.add(entry.getValue());
    }
    rs.close();
    if (statement != null) {
      statement.close();
    }
  }
  Set<Index> indexesToRemove=new HashSet<Index>();
  for (  Index index : indexes) {
    for (    PrimaryKey pk : primaryKeys) {
      if (index.getTable().getName().equalsIgnoreCase(pk.getTable().getName()) && index.getColumnNames().equals(pk.getColumnNames())) {
        indexesToRemove.add(index);
      }
    }
    for (    ForeignKey fk : foreignKeys) {
      if (index.getTable().getName().equalsIgnoreCase(fk.getForeignKeyTable().getName()) && index.getColumnNames().equals(fk.getForeignKeyColumns())) {
        indexesToRemove.add(index);
      }
    }
    for (    UniqueConstraint uc : uniqueConstraints) {
      if (index.getTable().getName().equalsIgnoreCase(uc.getTable().getName()) && index.getColumnNames().equals(uc.getColumnNames())) {
        indexesToRemove.add(index);
      }
    }
  }
  indexes.removeAll(indexesToRemove);
}