Program: 176483
Project: 176483
Buggy source:
@Override protected void onPersist(EntityMetadata metadata,Object entity,Object id,List<RelationHolder> rlHolders){
  if (!isOpen()) {
    throw new PersistenceException("String_Node_Str");
  }
  if (isUpdate && metadata.isCounterColumnType()) {
    throw new UnsupportedOperationException("String_Node_Str");
  }
  String insert_Query=null;
  if (isCql3Enabled(metadata)) {
    Cassandra.Client client=getRawClient(metadata.getPersistenceUnit(),metadata.getSchema());
    try {
      client.set_keyspace(metadata.getSchema());
      insert_Query=createInsertQuery(metadata,entity,client,rlHolders,getTtlValues().get(metadata.getTableName()));
      executeCQLQuery(insert_Query);
    }
 catch (    InvalidRequestException e) {
      log.error("String_Node_Str",insert_Query,e);
      throw new KunderaException(e);
    }
catch (    TException e) {
      log.error("String_Node_Str",insert_Query,e);
      throw new KunderaException(e);
    }
catch (    UnavailableException e) {
      log.error("String_Node_Str",insert_Query,e);
      throw new KunderaException(e);
    }
catch (    TimedOutException e) {
      log.error("String_Node_Str",insert_Query,e);
      throw new KunderaException(e);
    }
catch (    SchemaDisagreementException e) {
      log.error("String_Node_Str",insert_Query,e);
      throw new KunderaException(e);
    }
  }
 else {
    ThriftRow tf=null;
    try {
      String columnFamily=metadata.getTableName();
      tf=dataHandler.toThriftRow(entity,id,metadata,columnFamily,getTtlValues().get(columnFamily));
    }
 catch (    Exception e) {
      log.error("String_Node_Str",e);
      throw new KunderaException(e);
    }
    addRelationsToThriftRow(metadata,tf,rlHolders);
    Mutator mutator=clientFactory.getMutator(pool);
    if (metadata.isCounterColumnType()) {
      if (log.isInfoEnabled()) {
        log.info("String_Node_Str",tf.getId());
      }
      List<CounterColumn> thriftCounterColumns=tf.getCounterColumns();
      List<CounterSuperColumn> thriftCounterSuperColumns=tf.getCounterSuperColumns();
      if (thriftCounterColumns != null && !thriftCounterColumns.isEmpty()) {
        mutator.writeCounterColumns(metadata.getTableName(),CassandraUtilities.toBytes(tf.getId(),tf.getId().getClass()),Arrays.asList(tf.getCounterColumns().toArray(new CounterColumn[0])));
      }
      if (thriftCounterSuperColumns != null && !thriftCounterSuperColumns.isEmpty()) {
        for (        CounterSuperColumn sc : thriftCounterSuperColumns) {
          mutator.writeSubCounterColumns(metadata.getTableName(),CassandraUtilities.toBytes(tf.getId(),tf.getId().getClass()),Bytes.fromByteArray(sc.getName()),sc.getColumns());
        }
      }
    }
 else {
      List<Column> thriftColumns=tf.getColumns();
      List<SuperColumn> thriftSuperColumns=tf.getSuperColumns();
      if (thriftColumns != null && !thriftColumns.isEmpty()) {
        if (log.isInfoEnabled()) {
          log.info("String_Node_Str",tf.getId());
        }
        mutator.writeColumns(metadata.getTableName(),CassandraUtilities.toBytes(tf.getId(),tf.getId().getClass()),Arrays.asList(tf.getColumns().toArray(new Column[0])));
      }
      if (thriftSuperColumns != null && !thriftSuperColumns.isEmpty()) {
        for (        SuperColumn sc : thriftSuperColumns) {
          if (log.isInfoEnabled()) {
            log.info("String_Node_Str",tf.getId());
          }
          mutator.writeSubColumns(metadata.getTableName(),CassandraUtilities.toBytes(tf.getId(),tf.getId().getClass()),Bytes.fromByteArray(sc.getName()),sc.getColumns());
        }
      }
    }
    mutator.execute(getConsistencyLevel());
    tf=null;
    if (isTtlPerRequest()) {
      getTtlValues().clear();
    }
  }
}

Fixed version (ground truth):
@Override protected void onPersist(EntityMetadata metadata,Object entity,Object id,List<RelationHolder> rlHolders){
  if (!isOpen()) {
    throw new PersistenceException("String_Node_Str");
  }
  if (isUpdate && metadata.isCounterColumnType()) {
    throw new UnsupportedOperationException("String_Node_Str");
  }
  String insert_Query=null;
  if (isCql3Enabled(metadata)) {
    Cassandra.Client client=getRawClient(metadata.getPersistenceUnit(),metadata.getSchema());
    try {
      client.set_keyspace(metadata.getSchema());
      insert_Query=createInsertQuery(metadata,entity,client,rlHolders,getTtlValues().get(metadata.getTableName()));
      executeCQLQuery(insert_Query,true);
    }
 catch (    InvalidRequestException e) {
      log.error("String_Node_Str",insert_Query,e);
      throw new KunderaException(e);
    }
catch (    TException e) {
      log.error("String_Node_Str",insert_Query,e);
      throw new KunderaException(e);
    }
catch (    UnavailableException e) {
      log.error("String_Node_Str",insert_Query,e);
      throw new KunderaException(e);
    }
catch (    TimedOutException e) {
      log.error("String_Node_Str",insert_Query,e);
      throw new KunderaException(e);
    }
catch (    SchemaDisagreementException e) {
      log.error("String_Node_Str",insert_Query,e);
      throw new KunderaException(e);
    }
  }
 else {
    ThriftRow tf=null;
    try {
      String columnFamily=metadata.getTableName();
      tf=dataHandler.toThriftRow(entity,id,metadata,columnFamily,getTtlValues().get(columnFamily));
    }
 catch (    Exception e) {
      log.error("String_Node_Str",e);
      throw new KunderaException(e);
    }
    addRelationsToThriftRow(metadata,tf,rlHolders);
    Mutator mutator=clientFactory.getMutator(pool);
    if (metadata.isCounterColumnType()) {
      if (log.isInfoEnabled()) {
        log.info("String_Node_Str",tf.getId());
      }
      List<CounterColumn> thriftCounterColumns=tf.getCounterColumns();
      List<CounterSuperColumn> thriftCounterSuperColumns=tf.getCounterSuperColumns();
      if (thriftCounterColumns != null && !thriftCounterColumns.isEmpty()) {
        mutator.writeCounterColumns(metadata.getTableName(),CassandraUtilities.toBytes(tf.getId(),tf.getId().getClass()),Arrays.asList(tf.getCounterColumns().toArray(new CounterColumn[0])));
      }
      if (thriftCounterSuperColumns != null && !thriftCounterSuperColumns.isEmpty()) {
        for (        CounterSuperColumn sc : thriftCounterSuperColumns) {
          mutator.writeSubCounterColumns(metadata.getTableName(),CassandraUtilities.toBytes(tf.getId(),tf.getId().getClass()),Bytes.fromByteArray(sc.getName()),sc.getColumns());
        }
      }
    }
 else {
      List<Column> thriftColumns=tf.getColumns();
      List<SuperColumn> thriftSuperColumns=tf.getSuperColumns();
      if (thriftColumns != null && !thriftColumns.isEmpty()) {
        if (log.isInfoEnabled()) {
          log.info("String_Node_Str",tf.getId());
        }
        mutator.writeColumns(metadata.getTableName(),CassandraUtilities.toBytes(tf.getId(),tf.getId().getClass()),Arrays.asList(tf.getColumns().toArray(new Column[0])));
      }
      if (thriftSuperColumns != null && !thriftSuperColumns.isEmpty()) {
        for (        SuperColumn sc : thriftSuperColumns) {
          if (log.isInfoEnabled()) {
            log.info("String_Node_Str",tf.getId());
          }
          mutator.writeSubColumns(metadata.getTableName(),CassandraUtilities.toBytes(tf.getId(),tf.getId().getClass()),Bytes.fromByteArray(sc.getName()),sc.getColumns());
        }
      }
    }
    mutator.execute(getConsistencyLevel());
    tf=null;
    if (isTtlPerRequest()) {
      getTtlValues().clear();
    }
  }
}