Program: 19897
Project: 19897
Buggy source:
/** 
 * Convert a Hibernate table model to the DbDiff table model.
 * @param mappedTable hibernate table.
 * @return DbDiff table.
 */
private RelationalTable convertTable(org.hibernate.mapping.Table mappedTable){
  RelationalTable table=new RelationalTable(m_catalogSchema,getTableName(mappedTable));
  List<Column> columns=new ArrayList<>();
  List<RelationalIndex> indices=new ArrayList<>();
  @SuppressWarnings("String_Node_Str") Iterator<org.hibernate.mapping.Column> mappedColumns=mappedTable.getColumnIterator();
  int idx=1;
  while (mappedColumns.hasNext()) {
    org.hibernate.mapping.Column mappedColumn=mappedColumns.next();
    Column column=convertColumn(mappedColumn,mappedTable,idx++);
    columns.add(column);
    if (mappedColumn.isUnique()) {
      indices.add(getUniqueIndex(table,column));
    }
  }
  table.setColumns(columns);
  Set<ForeignKey> fkeys=new HashSet<>();
  @SuppressWarnings("String_Node_Str") Iterator<org.hibernate.mapping.ForeignKey> mappedKeys=mappedTable.getForeignKeyIterator();
  while (mappedKeys.hasNext()) {
    ForeignKey fkey=convertForeignKey(mappedKeys.next());
    if (fkey != null) {
      fkeys.add(fkey);
    }
  }
  table.setFks(fkeys);
  @SuppressWarnings("String_Node_Str") Iterator<Index> mappedIndices=mappedTable.getIndexIterator();
  while (mappedIndices.hasNext()) {
    indices.add(convertIndex(mappedIndices.next(),table));
  }
  @SuppressWarnings("String_Node_Str") Iterator<UniqueKey> mappedUniqueKeys=mappedTable.getUniqueKeyIterator();
  while (mappedUniqueKeys.hasNext()) {
    indices.add(convertIndex(mappedUniqueKeys.next(),table));
  }
  if (mappedTable.getPrimaryKey() != null) {
    indices.add(convertIndex(mappedTable.getPrimaryKey(),table));
    List<String> pkColumnNames=new ArrayList<>();
    @SuppressWarnings("String_Node_Str") Iterator<org.hibernate.mapping.Column> pkColumns=mappedTable.getPrimaryKey().getColumnIterator();
    while (pkColumns.hasNext()) {
      pkColumnNames.add(getColumnName(pkColumns.next()));
    }
    table.setPkColumns(pkColumnNames);
  }
  table.setIndices(indices);
  return table;
}

Fixed version (ground truth):
/** 
 * Convert a Hibernate table model to the DbDiff table model.
 * @param mappedTable hibernate table.
 * @return DbDiff table.
 */
private RelationalTable convertTable(org.hibernate.mapping.Table mappedTable){
  RelationalTable table=new RelationalTable(m_catalogSchema,getTableName(mappedTable));
  List<Column> columns=new ArrayList<>();
  List<RelationalIndex> indices=new ArrayList<>();
  @SuppressWarnings("String_Node_Str") Iterator<org.hibernate.mapping.Column> mappedColumns=mappedTable.getColumnIterator();
  int idx=1;
  while (mappedColumns.hasNext()) {
    org.hibernate.mapping.Column mappedColumn=mappedColumns.next();
    Column column=convertColumn(mappedColumn,mappedTable,idx++);
    columns.add(column);
    if (mappedColumn.isUnique()) {
      indices.add(getUniqueIndex(table,column));
    }
  }
  table.setColumns(columns);
  Set<ForeignKey> fkeys=new HashSet<>();
  @SuppressWarnings("String_Node_Str") Iterator<org.hibernate.mapping.ForeignKey> mappedKeys=mappedTable.getForeignKeyIterator();
  while (mappedKeys.hasNext()) {
    convertForeignKey(mappedKeys.next(),fkeys);
  }
  table.setFks(fkeys);
  @SuppressWarnings("String_Node_Str") Iterator<Index> mappedIndices=mappedTable.getIndexIterator();
  while (mappedIndices.hasNext()) {
    indices.add(convertIndex(mappedIndices.next(),table));
  }
  @SuppressWarnings("String_Node_Str") Iterator<UniqueKey> mappedUniqueKeys=mappedTable.getUniqueKeyIterator();
  while (mappedUniqueKeys.hasNext()) {
    indices.add(convertIndex(mappedUniqueKeys.next(),table));
  }
  if (mappedTable.getPrimaryKey() != null) {
    indices.add(convertIndex(mappedTable.getPrimaryKey(),table));
    List<String> pkColumnNames=new ArrayList<>();
    @SuppressWarnings("String_Node_Str") Iterator<org.hibernate.mapping.Column> pkColumns=mappedTable.getPrimaryKey().getColumnIterator();
    while (pkColumns.hasNext()) {
      pkColumnNames.add(getColumnName(pkColumns.next()));
    }
    table.setPkColumns(pkColumnNames);
  }
  table.setIndices(indices);
  return table;
}