Program: 176691
Project: 176691
Buggy source:
/** 
 * Execute batch.
 * @return the int
 */
public int executeBatch(){
  String persistenceUnit=null;
  Cassandra.Client conn=null;
  Object pooledConnection=null;
  Map<ByteBuffer,Map<String,List<Mutation>>> mutationMap=new HashMap<ByteBuffer,Map<String,List<Mutation>>>();
  try {
    for (    Node node : nodes) {
      if (node.isDirty()) {
        Object entity=node.getData();
        Object id=node.getEntityId();
        EntityMetadata metadata=KunderaMetadataManager.getEntityMetadata(node.getDataClass());
        persistenceUnit=metadata.getPersistenceUnit();
        isUpdate=node.isUpdate();
        MetamodelImpl metaModel=(MetamodelImpl)KunderaMetadata.INSTANCE.getApplicationMetadata().getMetamodel(metadata.getPersistenceUnit());
        if (node.isInState(RemovedState.class)) {
          delete(entity,id);
        }
 else         if (metaModel.isEmbeddable(metadata.getIdAttribute().getBindableJavaType())) {
          List<RelationHolder> relationHolders=getRelationHolders(node);
          onPersist(metadata,entity,id,relationHolders);
        }
 else {
          List<RelationHolder> relationHolders=getRelationHolders(node);
          mutationMap=prepareMutation(metadata,entity,id,relationHolders,mutationMap);
          indexNode(node,metadata);
        }
      }
    }
    if (!mutationMap.isEmpty()) {
      pooledConnection=getPooledConection(persistenceUnit);
      conn=getConnection(pooledConnection);
      conn.batch_mutate(mutationMap,consistencyLevel);
    }
  }
 catch (  InvalidRequestException e) {
    log.error("String_Node_Str" + e);
    throw new KunderaException(e);
  }
catch (  TException e) {
    log.error("String_Node_Str" + e);
    throw new KunderaException(e);
  }
catch (  UnavailableException e) {
    log.error("String_Node_Str" + e);
    throw new KunderaException(e);
  }
catch (  TimedOutException e) {
    log.error("String_Node_Str" + e);
    throw new KunderaException(e);
  }
 finally {
    releaseConnection(pooledConnection);
  }
  return mutationMap.size();
}

Fixed version (ground truth):
/** 
 * Execute batch.
 * @return the int
 */
public int executeBatch(){
  String persistenceUnit=null;
  Cassandra.Client conn=null;
  Object pooledConnection=null;
  Map<ByteBuffer,Map<String,List<Mutation>>> mutationMap=new HashMap<ByteBuffer,Map<String,List<Mutation>>>();
  try {
    for (    Node node : nodes) {
      if (node.isDirty()) {
        Object entity=node.getData();
        Object id=node.getEntityId();
        EntityMetadata metadata=KunderaMetadataManager.getEntityMetadata(node.getDataClass());
        persistenceUnit=metadata.getPersistenceUnit();
        isUpdate=node.isUpdate();
        MetamodelImpl metaModel=(MetamodelImpl)KunderaMetadata.INSTANCE.getApplicationMetadata().getMetamodel(metadata.getPersistenceUnit());
        if (node.isInState(RemovedState.class)) {
          delete(entity,id);
        }
 else         if (metaModel.isEmbeddable(metadata.getIdAttribute().getBindableJavaType())) {
          List<RelationHolder> relationHolders=getRelationHolders(node);
          onPersist(metadata,entity,id,relationHolders);
        }
 else {
          List<RelationHolder> relationHolders=getRelationHolders(node);
          mutationMap=prepareMutation(metadata,entity,id,relationHolders,mutationMap);
          indexNode(node,metadata);
        }
      }
    }
    if (!mutationMap.isEmpty()) {
      pooledConnection=getPooledConection(persistenceUnit);
      conn=getConnection(pooledConnection);
      conn.batch_mutate(mutationMap,consistencyLevel);
    }
  }
 catch (  InvalidRequestException e) {
    log.error("String_Node_Str" + e);
    throw new KunderaException(e);
  }
catch (  TException e) {
    log.error("String_Node_Str" + e);
    throw new KunderaException(e);
  }
catch (  UnavailableException e) {
    log.error("String_Node_Str" + e);
    throw new KunderaException(e);
  }
catch (  TimedOutException e) {
    log.error("String_Node_Str" + e);
    throw new KunderaException(e);
  }
 finally {
    clear();
    releaseConnection(pooledConnection);
  }
  return mutationMap.size();
}