Program: 176663
Project: 176663
Buggy source:
/** 
 * Prepare mutation.
 * @param entityMetadata the entity metadata
 * @param entity the entity
 * @param id the id
 * @param relationHolders the relation holders
 * @param mutationMap the mutation map
 * @return the map
 */
protected Map<ByteBuffer,Map<String,List<Mutation>>> prepareMutation(EntityMetadata entityMetadata,Object entity,Object id,List<RelationHolder> relationHolders,Map<ByteBuffer,Map<String,List<Mutation>>> mutationMap){
  if (!isOpen()) {
    throw new PersistenceException("String_Node_Str");
  }
  if (isUpdate && entityMetadata.isCounterColumnType()) {
    throw new UnsupportedOperationException("String_Node_Str");
  }
  ThriftRow tf=null;
  try {
    String columnFamily=entityMetadata.getTableName();
    tf=getDataHandler().toThriftRow(entity,id,entityMetadata,columnFamily);
  }
 catch (  Exception e) {
    log.error("String_Node_Str" + e);
    throw new KunderaException(e);
  }
  addRelationsToThriftRow(entityMetadata,tf,relationHolders);
  String columnFamily=entityMetadata.getTableName();
  List<Mutation> insertion_list=new ArrayList<Mutation>();
  if (entityMetadata.isCounterColumnType()) {
    List<CounterColumn> thriftCounterColumns=tf.getCounterColumns();
    List<CounterSuperColumn> thriftCounterSuperColumns=tf.getCounterSuperColumns();
    if (thriftCounterColumns != null && !thriftCounterColumns.isEmpty()) {
      for (      CounterColumn column : thriftCounterColumns) {
        Mutation mut=new Mutation();
        mut.setColumn_or_supercolumn(new ColumnOrSuperColumn().setCounter_column(column));
        insertion_list.add(mut);
      }
    }
    if (thriftCounterSuperColumns != null && !thriftCounterSuperColumns.isEmpty()) {
      for (      CounterSuperColumn sc : thriftCounterSuperColumns) {
        Mutation mut=new Mutation();
        mut.setColumn_or_supercolumn(new ColumnOrSuperColumn().setCounter_super_column(sc));
        insertion_list.add(mut);
      }
    }
  }
 else {
    List<Column> thriftColumns=tf.getColumns();
    List<SuperColumn> thriftSuperColumns=tf.getSuperColumns();
    if (thriftColumns != null && !thriftColumns.isEmpty()) {
      for (      Column column : thriftColumns) {
        Mutation mut=new Mutation();
        mut.setColumn_or_supercolumn(new ColumnOrSuperColumn().setColumn(column));
        insertion_list.add(mut);
      }
    }
    if (thriftSuperColumns != null && !thriftSuperColumns.isEmpty()) {
      for (      SuperColumn superColumn : thriftSuperColumns) {
        Mutation mut=new Mutation();
        mut.setColumn_or_supercolumn(new ColumnOrSuperColumn().setSuper_column(superColumn));
        insertion_list.add(mut);
      }
    }
  }
  Map<String,List<Mutation>> columnFamilyValues=new HashMap<String,List<Mutation>>();
  columnFamilyValues.put(columnFamily,insertion_list);
  Bytes b=CassandraUtilities.toBytes(tf.getId(),entityMetadata.getIdAttribute().getBindableJavaType());
  mutationMap.put(b.getBytes(),columnFamilyValues);
  return mutationMap;
}

Fixed version (ground truth):
/** 
 * Prepare mutation.
 * @param entityMetadata the entity metadata
 * @param entity the entity
 * @param id the id
 * @param relationHolders the relation holders
 * @param mutationMap the mutation map
 * @return the map
 */
protected Map<ByteBuffer,Map<String,List<Mutation>>> prepareMutation(EntityMetadata entityMetadata,Object entity,Object id,List<RelationHolder> relationHolders,Map<ByteBuffer,Map<String,List<Mutation>>> mutationMap){
  if (!isOpen()) {
    throw new PersistenceException("String_Node_Str");
  }
  if (isUpdate && entityMetadata.isCounterColumnType()) {
    throw new UnsupportedOperationException("String_Node_Str");
  }
  ThriftRow tf=null;
  try {
    String columnFamily=entityMetadata.getTableName();
    tf=getDataHandler().toThriftRow(entity,id,entityMetadata,columnFamily);
  }
 catch (  Exception e) {
    log.error("String_Node_Str" + e);
    throw new KunderaException(e);
  }
  addRelationsToThriftRow(entityMetadata,tf,relationHolders);
  String columnFamily=entityMetadata.getTableName();
  List<Mutation> mutationList=new ArrayList<Mutation>();
  if (entityMetadata.isCounterColumnType()) {
    List<CounterColumn> thriftCounterColumns=tf.getCounterColumns();
    List<CounterSuperColumn> thriftCounterSuperColumns=tf.getCounterSuperColumns();
    if (thriftCounterColumns != null && !thriftCounterColumns.isEmpty()) {
      for (      CounterColumn column : thriftCounterColumns) {
        Mutation mut=new Mutation();
        mut.setColumn_or_supercolumn(new ColumnOrSuperColumn().setCounter_column(column));
        mutationList.add(mut);
      }
    }
    if (thriftCounterSuperColumns != null && !thriftCounterSuperColumns.isEmpty()) {
      for (      CounterSuperColumn sc : thriftCounterSuperColumns) {
        Mutation mut=new Mutation();
        mut.setColumn_or_supercolumn(new ColumnOrSuperColumn().setCounter_super_column(sc));
        mutationList.add(mut);
      }
    }
  }
 else {
    List<Column> thriftColumns=tf.getColumns();
    List<SuperColumn> thriftSuperColumns=tf.getSuperColumns();
    if (thriftColumns != null && !thriftColumns.isEmpty()) {
      for (      Column column : thriftColumns) {
        Mutation mut=new Mutation();
        mut.setColumn_or_supercolumn(new ColumnOrSuperColumn().setColumn(column));
        mutationList.add(mut);
      }
    }
    if (thriftSuperColumns != null && !thriftSuperColumns.isEmpty()) {
      for (      SuperColumn superColumn : thriftSuperColumns) {
        Mutation mut=new Mutation();
        mut.setColumn_or_supercolumn(new ColumnOrSuperColumn().setSuper_column(superColumn));
        mutationList.add(mut);
      }
    }
  }
  Map<String,List<Mutation>> columnFamilyValues=new HashMap<String,List<Mutation>>();
  columnFamilyValues.put(columnFamily,mutationList);
  Bytes b=CassandraUtilities.toBytes(tf.getId(),entityMetadata.getIdAttribute().getBindableJavaType());
  mutationMap.put(b.getBytes(),columnFamilyValues);
  return mutationMap;
}