Program: 176351
Project: 176351
Buggy source:
@Override public int executeBatch(){
  Map<HTableInterface,List<HBaseDataWrapper>> data=new HashMap<HTableInterface,List<HBaseDataWrapper>>();
  try {
    for (    Node node : nodes) {
      if (node.isDirty()) {
        node.handlePreEvent();
        HTableInterface hTable=null;
        Object rowKey=node.getEntityId();
        Object entity=node.getData();
        if (node.isInState(RemovedState.class)) {
          delete(entity,rowKey);
        }
 else {
          EntityMetadata metadata=KunderaMetadataManager.getEntityMetadata(node.getDataClass());
          HBaseDataWrapper columnWrapper=new HBaseDataHandler.HBaseDataWrapper(rowKey,new java.util.HashSet<Attribute>(),entity,metadata.getTableName());
          MetamodelImpl metaModel=(MetamodelImpl)KunderaMetadata.INSTANCE.getApplicationMetadata().getMetamodel(metadata.getPersistenceUnit());
          EntityType entityType=metaModel.entity(node.getDataClass());
          List<HBaseDataWrapper> embeddableData=new ArrayList<HBaseDataHandler.HBaseDataWrapper>();
          hTable=((HBaseDataHandler)handler).gethTable(metadata.getTableName());
          ((HBaseDataHandler)handler).preparePersistentData(metadata.getTableName(),entity,rowKey,metaModel,entityType.getAttributes(),columnWrapper,embeddableData);
          List<HBaseDataWrapper> dataSet=null;
          if (data.containsKey(hTable)) {
            dataSet=data.get(metadata.getTableName());
            addRecords(columnWrapper,embeddableData,dataSet);
          }
 else {
            dataSet=new ArrayList<HBaseDataHandler.HBaseDataWrapper>();
            addRecords(columnWrapper,embeddableData,dataSet);
            data.put(hTable,dataSet);
          }
        }
        node.handlePostEvent();
      }
    }
    if (!data.isEmpty()) {
      ((HBaseDataHandler)handler).batch_insert(data);
    }
    return data.size();
  }
 catch (  IOException ioex) {
    log.error("String_Node_Str",ioex);
    throw new KunderaException(ioex);
  }
}

Fixed version (ground truth):
@Override public int executeBatch(){
  Map<HTableInterface,List<HBaseDataWrapper>> data=new HashMap<HTableInterface,List<HBaseDataWrapper>>();
  try {
    for (    Node node : nodes) {
      if (node.isDirty()) {
        node.handlePreEvent();
        HTableInterface hTable=null;
        Object rowKey=node.getEntityId();
        Object entity=node.getData();
        if (node.isInState(RemovedState.class)) {
          delete(entity,rowKey);
        }
 else {
          EntityMetadata metadata=KunderaMetadataManager.getEntityMetadata(node.getDataClass());
          HBaseDataWrapper columnWrapper=new HBaseDataHandler.HBaseDataWrapper(rowKey,new java.util.HashSet<Attribute>(),entity,metadata.getTableName());
          MetamodelImpl metaModel=(MetamodelImpl)KunderaMetadata.INSTANCE.getApplicationMetadata().getMetamodel(metadata.getPersistenceUnit());
          EntityType entityType=metaModel.entity(node.getDataClass());
          List<HBaseDataWrapper> embeddableData=new ArrayList<HBaseDataHandler.HBaseDataWrapper>();
          hTable=((HBaseDataHandler)handler).gethTable(metadata.getSchema());
          ((HBaseDataHandler)handler).preparePersistentData(metadata.getSchema(),metadata.getTableName(),entity,rowKey,metaModel,entityType.getAttributes(),columnWrapper,embeddableData);
          List<HBaseDataWrapper> dataSet=null;
          if (data.containsKey(hTable)) {
            dataSet=data.get(metadata.getTableName());
            addRecords(columnWrapper,embeddableData,dataSet);
          }
 else {
            dataSet=new ArrayList<HBaseDataHandler.HBaseDataWrapper>();
            addRecords(columnWrapper,embeddableData,dataSet);
            data.put(hTable,dataSet);
          }
        }
        node.handlePostEvent();
      }
    }
    if (!data.isEmpty()) {
      ((HBaseDataHandler)handler).batch_insert(data);
    }
    return data.size();
  }
 catch (  IOException ioex) {
    log.error("String_Node_Str",ioex);
    throw new KunderaException(ioex);
  }
}