Program: 18535
Project: 18535
Buggy source:
/** 
 * Save metric snapshot.
 * @param timeSnapshot the time snapshot
 * @param snapshotCollection the snapshot collection
 * @throws ServiceException the service exception
 * @see org.ebayopensource.turmeric.runtime.common.monitoring.MetricsStorageProvider#saveMetricSnapshot(long,java.util.Collection)
 */
@Override public void saveMetricSnapshot(long timeSnapshot,Collection<MetricValueAggregator> snapshotCollection) throws ServiceException {
  try {
    System.out.println("String_Node_Str" + (snapshotCollection != null));
    if (snapshotCollection == null || snapshotCollection.isEmpty()) {
      System.out.println("String_Node_Str");
      return;
    }
    System.out.println("String_Node_Str" + snapshotCollection.size());
    for (    MetricValueAggregator metricValueAggregator : snapshotCollection) {
      System.out.println("String_Node_Str" + (metricValueAggregator != null));
      org.ebayopensource.turmeric.runtime.common.monitoring.MetricId metricId=metricValueAggregator.getMetricId();
      if (metricId.getOperationName() == null) {
        if (!storeServiceMetrics) {
          continue;
        }
      }
      metricValueAggregator=resolve(metricValueAggregator);
      MetricIdentifier<String> cmetricIdentifier=null;
      Collection<MetricClassifier> classifiers=metricValueAggregator.getClassifiers();
      System.out.println("String_Node_Str" + classifiers.size());
      for (      MetricClassifier metricClassifier : classifiers) {
        org.ebayopensource.turmeric.runtime.common.monitoring.value.MetricValue metricValue=metricValueAggregator.getValue(metricClassifier);
        org.ebayopensource.turmeric.runtime.common.monitoring.value.MetricComponentValue[] metricComponentValues=metricValue.getValues();
        if (valuesAreNonZero(metricComponentValues)) {
          if (cmetricIdentifier == null) {
            cmetricIdentifier=findMetricId(getKeyfromMetricId(metricId,serverSide));
            if (cmetricIdentifier == null) {
              createMetricId(metricId,metricValueAggregator);
              cmetricIdentifier=findMetricId(getKeyfromMetricId(metricId,serverSide));
            }
          }
          metricsDAO.saveServiceOperationByIpCF(getIPAddress(),cmetricIdentifier);
          metricsDAO.saveServiceConsumerByIpCF(getIPAddress(),cmetricIdentifier,metricClassifier.getUseCase());
        }
        metricsDAO.saveMetricValues(getIPAddress(),cmetricIdentifier,timeSnapshot,snapshotInterval,serverSide,metricValue,metricClassifier.getUseCase());
      }
      cmetricIdentifier=null;
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
 finally {
    previousSnapshot=snapshotCollection;
  }
}

Fixed version (ground truth):
/** 
 * Save metric snapshot.
 * @param timeSnapshot the time snapshot
 * @param snapshotCollection the snapshot collection
 * @throws ServiceException the service exception
 * @see org.ebayopensource.turmeric.runtime.common.monitoring.MetricsStorageProvider#saveMetricSnapshot(long,java.util.Collection)
 */
@Override public void saveMetricSnapshot(long timeSnapshot,Collection<MetricValueAggregator> snapshotCollection) throws ServiceException {
  try {
    System.out.println("String_Node_Str" + (snapshotCollection != null));
    if (snapshotCollection == null || snapshotCollection.isEmpty()) {
      System.out.println("String_Node_Str");
      return;
    }
    System.out.println("String_Node_Str" + snapshotCollection.size());
    for (    MetricValueAggregator metricValueAggregator : snapshotCollection) {
      System.out.println("String_Node_Str" + (metricValueAggregator != null));
      org.ebayopensource.turmeric.runtime.common.monitoring.MetricId metricId=metricValueAggregator.getMetricId();
      if (metricId.getOperationName() == null) {
        if (!storeServiceMetrics) {
          continue;
        }
      }
      metricValueAggregator=resolve(metricValueAggregator);
      MetricIdentifier<String> cmetricIdentifier=null;
      Collection<MetricClassifier> classifiers=metricValueAggregator.getClassifiers();
      System.out.println("String_Node_Str" + classifiers.size());
      for (      MetricClassifier metricClassifier : classifiers) {
        org.ebayopensource.turmeric.runtime.common.monitoring.value.MetricValue metricValue=metricValueAggregator.getValue(metricClassifier);
        org.ebayopensource.turmeric.runtime.common.monitoring.value.MetricComponentValue[] metricComponentValues=metricValue.getValues();
        if (valuesAreNonZero(metricComponentValues)) {
          if (cmetricIdentifier == null) {
            cmetricIdentifier=findMetricId(getKeyfromMetricId(metricId,serverSide));
            if (cmetricIdentifier == null) {
              createMetricId(metricId,metricValueAggregator);
              cmetricIdentifier=findMetricId(getKeyfromMetricId(metricId,serverSide));
            }
          }
          metricsDAO.saveServiceOperationByIpCF(getIPAddress(),cmetricIdentifier);
          metricsDAO.saveServiceConsumerByIpCF(getIPAddress(),cmetricIdentifier,metricClassifier.getUseCase());
          metricsDAO.saveMetricValues(getIPAddress(),cmetricIdentifier,timeSnapshot,snapshotInterval,serverSide,metricValue,metricClassifier.getUseCase());
        }
      }
      cmetricIdentifier=null;
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
 finally {
    previousSnapshot=snapshotCollection;
  }
}