Program: 11161
Project: 11161
Buggy source:
/** 
 * Get the crossdata table metadata from a cassandra table metadata
 * @param session                The cassandra session.
 * @param cassandraTableMetadata The cassandra table metadata.
 * @return A {@link com.stratio.crossdata.common.metadata.TableMetadata} .
 */
private static TableMetadata getXDTableMetadata(Session session,com.datastax.driver.core.TableMetadata cassandraTableMetadata,String cluster){
  Map<IndexName,IndexMetadata> indexes=new HashMap<>();
  LinkedHashMap<ColumnName,ColumnMetadata> columns=new LinkedHashMap<>();
  List<com.datastax.driver.core.ColumnMetadata> cassandraColumns=cassandraTableMetadata.getColumns();
  for (  com.datastax.driver.core.ColumnMetadata cassandraColumn : cassandraColumns) {
    ColumnName columnName=new ColumnName(cassandraTableMetadata.getKeyspace().getName(),cassandraTableMetadata.getName(),cassandraColumn.getName());
    ColumnType columnType=utils.getCrossdataColumn(cassandraColumn.getType());
    ColumnMetadata columnMetadata=new ColumnMetadata(columnName,null,columnType);
    columns.put(columnName,columnMetadata);
    com.datastax.driver.core.ColumnMetadata.IndexMetadata cassandraIndex=cassandraColumn.getIndex();
    if (cassandraIndex != null) {
      IndexName indexName=new IndexName(cassandraTableMetadata.getKeyspace().getName(),cassandraTableMetadata.getName(),cassandraIndex.getName());
      Map<ColumnName,ColumnMetadata> columnIndex=new HashMap<>();
      columnIndex.put(columnName,columnMetadata);
      IndexMetadata indexMetadata=new IndexMetadata(indexName,columnIndex,cassandraIndex.isCustomIndex() ? IndexType.CUSTOM : IndexType.DEFAULT,null);
      indexes.put(indexName,indexMetadata);
    }
  }
  ClusterName clusterRef=new ClusterName(cluster);
  List<ColumnName> partitionKey=new ArrayList<>();
  List<com.datastax.driver.core.ColumnMetadata> partitionColumns=cassandraTableMetadata.getPartitionKey();
  for (  com.datastax.driver.core.ColumnMetadata cassandraPartition : partitionColumns) {
    ColumnName columnName=new ColumnName(cassandraPartition.getTable().getKeyspace().getName(),cassandraPartition.getTable().getName(),cassandraPartition.getName());
    partitionKey.add(columnName);
  }
  List<ColumnName> clusterKey=new ArrayList<>();
  List<com.datastax.driver.core.ColumnMetadata> clusterColumns=cassandraTableMetadata.getClusteringColumns();
  for (  com.datastax.driver.core.ColumnMetadata cassandraClusterKey : clusterColumns) {
    ColumnName columnName=new ColumnName(cassandraClusterKey.getTable().getKeyspace().getName(),cassandraClusterKey.getTable().getName(),cassandraClusterKey.getName());
    clusterKey.add(columnName);
  }
  TableName tableName=new TableName(cassandraTableMetadata.getKeyspace().getName(),cassandraTableMetadata.getName());
  return new TableMetadata(tableName,null,columns,indexes,clusterRef,partitionKey,clusterKey);
}

Fixed version (ground truth):
/** 
 * Get the crossdata table metadata from a cassandra table metadata
 * @param session                The cassandra session.
 * @param cassandraTableMetadata The cassandra table metadata.
 * @return A {@link com.stratio.crossdata.common.metadata.TableMetadata} .
 */
private static TableMetadata getXDTableMetadata(Session session,com.datastax.driver.core.TableMetadata cassandraTableMetadata,String cluster){
  Map<IndexName,IndexMetadata> indexes=new HashMap<>();
  LinkedHashMap<ColumnName,ColumnMetadata> columns=new LinkedHashMap<>();
  List<com.datastax.driver.core.ColumnMetadata> cassandraColumns=cassandraTableMetadata.getColumns();
  for (  com.datastax.driver.core.ColumnMetadata cassandraColumn : cassandraColumns) {
    ColumnName columnName=new ColumnName(cassandraTableMetadata.getKeyspace().getName(),cassandraTableMetadata.getName(),cassandraColumn.getName());
    ColumnType columnType=utils.getCrossdataColumn(cassandraColumn.getType());
    ColumnMetadata columnMetadata=new ColumnMetadata(columnName,null,columnType);
    if (cassandraColumn.getIndex() == null || !cassandraColumn.getIndex().isCustomIndex()) {
      columns.put(columnName,columnMetadata);
    }
    com.datastax.driver.core.ColumnMetadata.IndexMetadata cassandraIndex=cassandraColumn.getIndex();
    if (cassandraIndex != null) {
      IndexName indexName=new IndexName(cassandraTableMetadata.getKeyspace().getName(),cassandraTableMetadata.getName(),cassandraIndex.getName());
      Map<ColumnName,ColumnMetadata> columnIndex=new HashMap<>();
      IndexMetadata indexMetadata;
      if (cassandraIndex.isCustomIndex()) {
        columnIndex=getLuceneIndex(session,indexName,cassandraIndex);
        indexMetadata=new IndexMetadata(indexName,columnIndex,IndexType.FULL_TEXT,null);
      }
 else {
        columnIndex.put(columnName,columnMetadata);
        indexMetadata=new IndexMetadata(indexName,columnIndex,IndexType.DEFAULT,null);
      }
      indexes.put(indexName,indexMetadata);
    }
  }
  ClusterName clusterRef=new ClusterName(cluster);
  List<ColumnName> partitionKey=new ArrayList<>();
  List<com.datastax.driver.core.ColumnMetadata> partitionColumns=cassandraTableMetadata.getPartitionKey();
  for (  com.datastax.driver.core.ColumnMetadata cassandraPartition : partitionColumns) {
    ColumnName columnName=new ColumnName(cassandraPartition.getTable().getKeyspace().getName(),cassandraPartition.getTable().getName(),cassandraPartition.getName());
    partitionKey.add(columnName);
  }
  List<ColumnName> clusterKey=new ArrayList<>();
  List<com.datastax.driver.core.ColumnMetadata> clusterColumns=cassandraTableMetadata.getClusteringColumns();
  for (  com.datastax.driver.core.ColumnMetadata cassandraClusterKey : clusterColumns) {
    ColumnName columnName=new ColumnName(cassandraClusterKey.getTable().getKeyspace().getName(),cassandraClusterKey.getTable().getName(),cassandraClusterKey.getName());
    clusterKey.add(columnName);
  }
  TableName tableName=new TableName(cassandraTableMetadata.getKeyspace().getName(),cassandraTableMetadata.getName());
  return new TableMetadata(tableName,null,columns,indexes,clusterRef,partitionKey,clusterKey);
}