Program: 170348
Project: 170348
Buggy source:
private int processEnvelope(MetricEnvelope metricEnvelope){
  int metricCount=0;
  Metric metric=metricEnvelope.metric;
  Map<String,Object> meta=metricEnvelope.meta;
  logger.debug("String_Node_Str",ordinal);
  logger.debug("String_Node_Str",metric);
  logger.debug("String_Node_Str",meta);
  String tenantId="String_Node_Str";
  if (meta.containsKey(TENANT_ID)) {
    tenantId=(String)meta.get(TENANT_ID);
  }
 else {
    logger.warn("String_Node_Str");
    logger.warn("String_Node_Str",metric.toString());
    logger.warn("String_Node_Str",meta.toString());
  }
  String region="String_Node_Str";
  if (meta.containsKey(REGION)) {
    region=(String)meta.get(REGION);
  }
 else {
    logger.warn("String_Node_Str");
    logger.warn("String_Node_Str",metric.toString());
    logger.warn("String_Node_Str",meta.toString());
  }
  StringBuilder definitionIdStringToHash=new StringBuilder(trunc(metric.getName(),MAX_COLUMN_LENGTH));
  definitionIdStringToHash.append(trunc(tenantId,MAX_COLUMN_LENGTH));
  definitionIdStringToHash.append(trunc(region,MAX_COLUMN_LENGTH));
  byte[] definitionIdSha1Hash=DigestUtils.sha(definitionIdStringToHash.toString());
  Sha1HashId definitionSha1HashId=new Sha1HashId((definitionIdSha1Hash));
  metricRepo.addDefinitionToBatch(definitionSha1HashId,trunc(metric.getName(),MAX_COLUMN_LENGTH),trunc(tenantId,MAX_COLUMN_LENGTH),trunc(region,MAX_COLUMN_LENGTH));
  definitionCounter.inc();
  StringBuilder dimensionIdStringToHash=new StringBuilder();
  Map<String,String> preppedDimMap=prepDimensions(metric.getDimensions());
  for (  Map.Entry<String,String> entry : preppedDimMap.entrySet()) {
    dimensionIdStringToHash.append(entry.getKey());
    dimensionIdStringToHash.append(entry.getValue());
  }
  byte[] dimensionIdSha1Hash=DigestUtils.sha(dimensionIdStringToHash.toString());
  Sha1HashId dimensionsSha1HashId=new Sha1HashId(dimensionIdSha1Hash);
  for (  Map.Entry<String,String> entry : preppedDimMap.entrySet()) {
    metricRepo.addDimensionToBatch(dimensionsSha1HashId,entry.getKey(),entry.getValue());
    dimensionCounter.inc();
  }
  StringBuilder definitionDimensionsIdStringToHash=new StringBuilder(definitionSha1HashId.toHexString());
  definitionDimensionsIdStringToHash.append(dimensionsSha1HashId.toHexString());
  byte[] definitionDimensionsIdSha1Hash=DigestUtils.sha(definitionDimensionsIdStringToHash.toString());
  Sha1HashId definitionDimensionsSha1HashId=new Sha1HashId(definitionDimensionsIdSha1Hash);
  metricRepo.addDefinitionDimensionToBatch(definitionDimensionsSha1HashId,definitionSha1HashId,dimensionsSha1HashId);
  definitionDimensionsCounter.inc();
  String timeStamp=simpleDateFormat.format(new Date(metric.getTimestamp()));
  double value=metric.getValue();
  metricRepo.addMetricToBatch(definitionDimensionsSha1HashId,timeStamp,value,metric.getValueMeta());
  metricCounter.inc();
  metricCount++;
  return metricCount;
}

Fixed version (ground truth):
private int processEnvelope(MetricEnvelope metricEnvelope){
  int metricCount=0;
  Metric metric=metricEnvelope.metric;
  Map<String,Object> meta=metricEnvelope.meta;
  logger.debug("String_Node_Str",ordinal);
  logger.debug("String_Node_Str",metric);
  logger.debug("String_Node_Str",meta);
  String tenantId="String_Node_Str";
  if (meta.containsKey(TENANT_ID)) {
    tenantId=(String)meta.get(TENANT_ID);
  }
 else {
    logger.warn("String_Node_Str");
    logger.warn("String_Node_Str",metric.toString());
    logger.warn("String_Node_Str",meta.toString());
  }
  String region="String_Node_Str";
  if (meta.containsKey(REGION)) {
    region=(String)meta.get(REGION);
  }
 else {
    logger.warn("String_Node_Str");
    logger.warn("String_Node_Str",metric.toString());
    logger.warn("String_Node_Str",meta.toString());
  }
  StringBuilder definitionIdStringToHash=new StringBuilder(trunc(metric.getName(),MAX_COLUMN_LENGTH));
  definitionIdStringToHash.append(trunc(tenantId,MAX_COLUMN_LENGTH));
  definitionIdStringToHash.append(trunc(region,MAX_COLUMN_LENGTH));
  byte[] definitionIdSha1Hash=DigestUtils.sha(definitionIdStringToHash.toString());
  Sha1HashId definitionSha1HashId=new Sha1HashId((definitionIdSha1Hash));
  metricRepo.addDefinitionToBatch(definitionSha1HashId,trunc(metric.getName(),MAX_COLUMN_LENGTH),trunc(tenantId,MAX_COLUMN_LENGTH),trunc(region,MAX_COLUMN_LENGTH));
  definitionCounter.inc();
  StringBuilder dimensionIdStringToHash=new StringBuilder();
  Map<String,String> preppedDimMap=prepDimensions(metric.getDimensions());
  for (  Map.Entry<String,String> entry : preppedDimMap.entrySet()) {
    dimensionIdStringToHash.append(entry.getKey());
    dimensionIdStringToHash.append(entry.getValue());
  }
  byte[] dimensionIdSha1Hash=DigestUtils.sha(dimensionIdStringToHash.toString());
  Sha1HashId dimensionsSha1HashId=new Sha1HashId(dimensionIdSha1Hash);
  metricRepo.addDimensionsToBatch(dimensionsSha1HashId,preppedDimMap);
  StringBuilder definitionDimensionsIdStringToHash=new StringBuilder(definitionSha1HashId.toHexString());
  definitionDimensionsIdStringToHash.append(dimensionsSha1HashId.toHexString());
  byte[] definitionDimensionsIdSha1Hash=DigestUtils.sha(definitionDimensionsIdStringToHash.toString());
  Sha1HashId definitionDimensionsSha1HashId=new Sha1HashId(definitionDimensionsIdSha1Hash);
  metricRepo.addDefinitionDimensionToBatch(definitionDimensionsSha1HashId,definitionSha1HashId,dimensionsSha1HashId);
  definitionDimensionsCounter.inc();
  String timeStamp=simpleDateFormat.format(new Date(metric.getTimestamp()));
  double value=metric.getValue();
  metricRepo.addMetricToBatch(definitionDimensionsSha1HashId,timeStamp,value,metric.getValueMeta());
  metricCounter.inc();
  metricCount++;
  return metricCount;
}