nus-yam/ex-repair huggingface dataset:
Program: 168678
Project: 168678
Buggy source:
private String buildQuery(String tenantId,String name,Map<String,String> dimensions,DateTime startTime,DateTime endTime,String offset,int limit,Boolean mergeMetricsFlag) throws Exception {
  String q;
  if (Boolean.TRUE.equals(mergeMetricsFlag)) {
    q=String.format("String_Node_Str" + "String_Node_Str",this.influxV9Utils.namePart(name,true),this.influxV9Utils.tenantIdPart(tenantId),this.influxV9Utils.regionPart(this.region),this.influxV9Utils.startTimePart(startTime),this.influxV9Utils.dimPart(dimensions),this.influxV9Utils.endTimePart(endTime),this.influxV9Utils.timeOffsetPart(offset),this.influxV9Utils.limitPart(limit));
  }
 else {
    if (!this.influxV9MetricDefinitionRepo.isAtMostOneSeries(tenantId,name,dimensions)) {
      throw new IllegalArgumentException(this.influxV9Utils.getMultipleMetricsErrorMsg());
    }
    q=String.format("String_Node_Str" + "String_Node_Str",this.influxV9Utils.namePart(name,true),this.influxV9Utils.tenantIdPart(tenantId),this.influxV9Utils.regionPart(this.region),this.influxV9Utils.startTimePart(startTime),this.influxV9Utils.dimPart(dimensions),this.influxV9Utils.endTimePart(endTime),this.influxV9Utils.timeOffsetPart(offset),this.influxV9Utils.groupByPart(),this.influxV9Utils.limitPart(limit));
  }
  logger.debug("String_Node_Str",q);
  return q;
}

Fixed version (ground truth):
private String buildQuery(String tenantId,String name,Map<String,String> dimensions,DateTime startTime,DateTime endTime,String offset,int limit,Boolean mergeMetricsFlag) throws Exception {
  String q;
  if (Boolean.TRUE.equals(mergeMetricsFlag)) {
    q=String.format("String_Node_Str" + "String_Node_Str",this.influxV9Utils.namePart(name,true),this.influxV9Utils.privateTenantIdPart(tenantId),this.influxV9Utils.privateRegionPart(this.region),this.influxV9Utils.startTimePart(startTime),this.influxV9Utils.dimPart(dimensions),this.influxV9Utils.endTimePart(endTime),this.influxV9Utils.timeOffsetPart(offset),this.influxV9Utils.limitPart(limit));
  }
 else {
    if (!this.influxV9MetricDefinitionRepo.isAtMostOneSeries(tenantId,name,dimensions)) {
      throw new IllegalArgumentException(this.influxV9Utils.getMultipleMetricsErrorMsg());
    }
    q=String.format("String_Node_Str" + "String_Node_Str",this.influxV9Utils.namePart(name,true),this.influxV9Utils.privateTenantIdPart(tenantId),this.influxV9Utils.privateRegionPart(this.region),this.influxV9Utils.startTimePart(startTime),this.influxV9Utils.dimPart(dimensions),this.influxV9Utils.endTimePart(endTime),this.influxV9Utils.timeOffsetPart(offset),this.influxV9Utils.groupByPart(),this.influxV9Utils.limitPart(limit));
  }
  logger.debug("String_Node_Str",q);
  return q;
}
Program: 168679
Project: 168679
Buggy source:
@Override public List<MetricName> findNames(String tenantId,Map<String,String> dimensions,String offset,int limit) throws Exception {
  int startIndex=this.influxV9Utils.startIndex(offset);
  String q=String.format("String_Node_Str" + "String_Node_Str",this.influxV9Utils.tenantIdPart(tenantId),this.influxV9Utils.regionPart(this.region),this.influxV9Utils.dimPart(dimensions),this.influxV9Utils.limitPart(limit),this.influxV9Utils.offsetPart(startIndex));
  logger.debug("String_Node_Str",q);
  String r=this.influxV9RepoReader.read(q);
  Series series=this.objectMapper.readValue(r,Series.class);
  List<MetricName> metricNameList=metricNameList(series,startIndex);
  logger.debug("String_Node_Str",metricNameList.size());
  return metricNameList;
}

Fixed version (ground truth):
@Override public List<MetricName> findNames(String tenantId,Map<String,String> dimensions,String offset,int limit) throws Exception {
  int startIndex=this.influxV9Utils.startIndex(offset);
  String q=String.format("String_Node_Str" + "String_Node_Str",this.influxV9Utils.privateTenantIdPart(tenantId),this.influxV9Utils.privateRegionPart(this.region),this.influxV9Utils.dimPart(dimensions),this.influxV9Utils.limitPart(limit),this.influxV9Utils.offsetPart(startIndex));
  logger.debug("String_Node_Str",q);
  String r=this.influxV9RepoReader.read(q);
  Series series=this.objectMapper.readValue(r,Series.class);
  List<MetricName> metricNameList=metricNameList(series,startIndex);
  logger.debug("String_Node_Str",metricNameList.size());
  return metricNameList;
}
Program: 168680
Project: 168680
Buggy source:
@Override public List<MetricDefinition> find(String tenantId,String name,Map<String,String> dimensions,String offset,int limit) throws Exception {
  int startIndex=this.influxV9Utils.startIndex(offset);
  String q=String.format("String_Node_Str" + "String_Node_Str",this.influxV9Utils.namePart(name,false),this.influxV9Utils.tenantIdPart(tenantId),this.influxV9Utils.regionPart(this.region),this.influxV9Utils.dimPart(dimensions),this.influxV9Utils.limitPart(limit),this.influxV9Utils.offsetPart(startIndex));
  logger.debug("String_Node_Str",q);
  String r=this.influxV9RepoReader.read(q);
  Series series=this.objectMapper.readValue(r,Series.class);
  List<MetricDefinition> metricDefinitionList=metricDefinitionList(series,startIndex);
  logger.debug("String_Node_Str",metricDefinitionList.size());
  return metricDefinitionList;
}

Fixed version (ground truth):
@Override public List<MetricDefinition> find(String tenantId,String name,Map<String,String> dimensions,String offset,int limit) throws Exception {
  int startIndex=this.influxV9Utils.startIndex(offset);
  String q=String.format("String_Node_Str" + "String_Node_Str",this.influxV9Utils.namePart(name,false),this.influxV9Utils.privateTenantIdPart(tenantId),this.influxV9Utils.privateRegionPart(this.region),this.influxV9Utils.dimPart(dimensions),this.influxV9Utils.limitPart(limit),this.influxV9Utils.offsetPart(startIndex));
  logger.debug("String_Node_Str",q);
  String r=this.influxV9RepoReader.read(q);
  Series series=this.objectMapper.readValue(r,Series.class);
  List<MetricDefinition> metricDefinitionList=metricDefinitionList(series,startIndex);
  logger.debug("String_Node_Str",metricDefinitionList.size());
  return metricDefinitionList;
}
Program: 168681
Project: 168681
Buggy source:
boolean isAtMostOneSeries(String tenantId,String name,Map<String,String> dimensions) throws Exception {
  String q=String.format("String_Node_Str" + "String_Node_Str",this.influxV9Utils.namePart(name,false),this.influxV9Utils.tenantIdPart(tenantId),this.influxV9Utils.regionPart(this.region),this.influxV9Utils.dimPart(dimensions));
  logger.debug("String_Node_Str",q);
  String r=this.influxV9RepoReader.read(q);
  Series series=this.objectMapper.readValue(r,Series.class);
  List<MetricDefinition> metricDefinitionList=metricDefinitionList(series,0);
  logger.debug("String_Node_Str",metricDefinitionList.size());
  return metricDefinitionList.size() > 1 ? false : true;
}

Fixed version (ground truth):
boolean isAtMostOneSeries(String tenantId,String name,Map<String,String> dimensions) throws Exception {
  String q=String.format("String_Node_Str" + "String_Node_Str",this.influxV9Utils.namePart(name,false),this.influxV9Utils.privateTenantIdPart(tenantId),this.influxV9Utils.privateRegionPart(this.region),this.influxV9Utils.dimPart(dimensions));
  logger.debug("String_Node_Str",q);
  String r=this.influxV9RepoReader.read(q);
  Series series=this.objectMapper.readValue(r,Series.class);
  List<MetricDefinition> metricDefinitionList=metricDefinitionList(series,0);
  logger.debug("String_Node_Str",metricDefinitionList.size());
  return metricDefinitionList.size() > 1 ? false : true;
}
Program: 168682
Project: 168682
Buggy source:
private String buildQuery(String tenantId,String name,Map<String,String> dimensions,DateTime startTime,DateTime endTime,List<String> statistics,int period,String offset,int limit,Boolean mergeMetricsFlag) throws Exception {
  String q;
  if (Boolean.TRUE.equals(mergeMetricsFlag)) {
    q=String.format("String_Node_Str" + "String_Node_Str",funcPart(statistics),this.influxV9Utils.namePart(name,true),this.influxV9Utils.tenantIdPart(tenantId),this.influxV9Utils.regionPart(this.region),this.influxV9Utils.startTimePart(startTime),this.influxV9Utils.dimPart(dimensions),this.influxV9Utils.endTimePart(endTime),this.influxV9Utils.timeOffsetPart(offset),this.influxV9Utils.periodPart(period),this.influxV9Utils.limitPart(limit));
  }
 else {
    if (!this.influxV9MetricDefinitionRepo.isAtMostOneSeries(tenantId,name,dimensions)) {
      throw new IllegalArgumentException(this.influxV9Utils.getMultipleMetricsErrorMsg());
    }
    q=String.format("String_Node_Str" + "String_Node_Str",funcPart(statistics),this.influxV9Utils.namePart(name,true),this.influxV9Utils.tenantIdPart(tenantId),this.influxV9Utils.regionPart(this.region),this.influxV9Utils.startTimePart(startTime),this.influxV9Utils.dimPart(dimensions),this.influxV9Utils.endTimePart(endTime),this.influxV9Utils.timeOffsetPart(offset),this.influxV9Utils.periodPartWithGroupBy(period),this.influxV9Utils.limitPart(limit));
  }
  logger.debug("String_Node_Str",q);
  return q;
}

Fixed version (ground truth):
private String buildQuery(String tenantId,String name,Map<String,String> dimensions,DateTime startTime,DateTime endTime,List<String> statistics,int period,String offset,int limit,Boolean mergeMetricsFlag) throws Exception {
  String q;
  if (Boolean.TRUE.equals(mergeMetricsFlag)) {
    q=String.format("String_Node_Str" + "String_Node_Str",funcPart(statistics),this.influxV9Utils.namePart(name,true),this.influxV9Utils.privateTenantIdPart(tenantId),this.influxV9Utils.privateRegionPart(this.region),this.influxV9Utils.startTimePart(startTime),this.influxV9Utils.dimPart(dimensions),this.influxV9Utils.endTimePart(endTime),this.influxV9Utils.timeOffsetPart(offset),this.influxV9Utils.periodPart(period),this.influxV9Utils.limitPart(limit));
  }
 else {
    if (!this.influxV9MetricDefinitionRepo.isAtMostOneSeries(tenantId,name,dimensions)) {
      throw new IllegalArgumentException(this.influxV9Utils.getMultipleMetricsErrorMsg());
    }
    q=String.format("String_Node_Str" + "String_Node_Str",funcPart(statistics),this.influxV9Utils.namePart(name,true),this.influxV9Utils.privateTenantIdPart(tenantId),this.influxV9Utils.privateRegionPart(this.region),this.influxV9Utils.startTimePart(startTime),this.influxV9Utils.dimPart(dimensions),this.influxV9Utils.endTimePart(endTime),this.influxV9Utils.timeOffsetPart(offset),this.influxV9Utils.periodPartWithGroupBy(period),this.influxV9Utils.limitPart(limit));
  }
  logger.debug("String_Node_Str",q);
  return q;
}
Program: 168683
Project: 168683
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public List<AlarmDefinition> find(String tenantId,String name,Map<String,String> dimensions,String offset,int limit){
  try (Handle h=db.open()){
    String query="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
    StringBuilder sbWhere=new StringBuilder();
    if (name != null) {
      sbWhere.append("String_Node_Str");
    }
    if (offset != null) {
      sbWhere.append("String_Node_Str");
    }
    String sql=String.format(query,SubAlarmDefinitionQueries.buildJoinClauseFor(dimensions),sbWhere);
    Query<?> q=h.createQuery(sql);
    q.bind("String_Node_Str",tenantId);
    if (name != null) {
      q.bind("String_Node_Str",name);
    }
    if (offset != null) {
      q.bind("String_Node_Str",offset);
    }
    q.bind("String_Node_Str",limit + 1);
    q.registerMapper(new AlarmDefinitionMapper());
    q=q.mapTo(AlarmDefinition.class);
    DimensionQueries.bindDimensionsToQuery(q,dimensions);
    List<AlarmDefinition> resultSet=(List<AlarmDefinition>)q.list();
    return resultSet;
  }
 }

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public List<AlarmDefinition> find(String tenantId,String name,Map<String,String> dimensions,String offset,int limit){
  try (Handle h=db.open()){
    String query="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
    StringBuilder sbWhere=new StringBuilder();
    if (name != null) {
      sbWhere.append("String_Node_Str");
    }
    if (offset != null) {
      sbWhere.append("String_Node_Str");
    }
    String limitPart="String_Node_Str";
    if (limit > 0) {
      limitPart="String_Node_Str";
    }
    String sql=String.format(query,SubAlarmDefinitionQueries.buildJoinClauseFor(dimensions),sbWhere,limitPart);
    Query<?> q=h.createQuery(sql);
    q.bind("String_Node_Str",tenantId);
    if (name != null) {
      q.bind("String_Node_Str",name);
    }
    if (offset != null) {
      q.bind("String_Node_Str",offset);
    }
    if (limit > 0) {
      q.bind("String_Node_Str",limit + 1);
    }
    q.registerMapper(new AlarmDefinitionMapper());
    q=q.mapTo(AlarmDefinition.class);
    DimensionQueries.bindDimensionsToQuery(q,dimensions);
    List<AlarmDefinition> resultSet=(List<AlarmDefinition>)q.list();
    return resultSet;
  }
 }
Program: 168685
Project: 168685
Buggy source:
@Override public List<NotificationMethod> find(String tenantId,String offset,int limit){
  try (Handle h=db.open()){
    String rawQuery="String_Node_Str" + "String_Node_Str" + "String_Node_Str";
    String offsetPart="String_Node_Str";
    if (offset != null) {
      offsetPart="String_Node_Str";
    }
    String query=String.format(rawQuery,offsetPart);
    Query<?> q=h.createQuery(query);
    q.bind("String_Node_Str",tenantId);
    if (offset != null) {
      q.bind("String_Node_Str",offset);
    }
    q.bind("String_Node_Str",limit + 1);
    return (List<NotificationMethod>)q.map(new BeanMapper<NotificationMethod>(NotificationMethod.class)).list();
  }
 }

Fixed version (ground truth):
@Override public List<NotificationMethod> find(String tenantId,String offset,int limit){
  try (Handle h=db.open()){
    String rawQuery="String_Node_Str" + "String_Node_Str" + "String_Node_Str";
    String offsetPart="String_Node_Str";
    if (offset != null) {
      offsetPart="String_Node_Str";
    }
    String limitPart="String_Node_Str";
    if (limit > 0) {
      limitPart="String_Node_Str";
    }
    String query=String.format(rawQuery,offsetPart,limitPart);
    Query<?> q=h.createQuery(query);
    q.bind("String_Node_Str",tenantId);
    if (offset != null) {
      q.bind("String_Node_Str",offset);
    }
    if (limit > 0) {
      q.bind("String_Node_Str",limit + 1);
    }
    return q.map(new BeanMapper<>(NotificationMethod.class)).list();
  }
 }
Program: 168686
Project: 168686
Buggy source:
private List<MetricDefinition> buildMetricDefList(List<Serie> result,String offset) throws Exception {
  String decodedOffset=urlDecodeUTF8(offset);
  List<MetricDefinition> metricDefinitionList=new ArrayList<>();
  for (  Serie serie : result) {
    for (    Map<String,Object> point : serie.getRows()) {
      String encodedMetricName=(String)point.get("String_Node_Str");
      if (offset != null) {
        if (encodedMetricName.compareTo(decodedOffset) <= 0) {
          continue;
        }
      }
      Utils.SerieNameDecoder serieNameDecoder;
      try {
        serieNameDecoder=new Utils.SerieNameDecoder(encodedMetricName);
      }
 catch (      Utils.SerieNameDecodeException e) {
        logger.warn("String_Node_Str",point.get("String_Node_Str"),e);
        continue;
      }
      MetricDefinition metricDefinition=new MetricDefinition(serieNameDecoder.getMetricName(),serieNameDecoder.getDimensions());
      metricDefinition.setId(urlEncodeUTF8(encodedMetricName));
      metricDefinitionList.add(metricDefinition);
      if (offset != null) {
        if (metricDefinitionList.size() >= Paged.LIMIT) {
          return metricDefinitionList;
        }
      }
    }
  }
  return metricDefinitionList;
}

Fixed version (ground truth):
private List<MetricDefinition> buildMetricDefList(List<Serie> result,String offset) throws Exception {
  String decodedOffset=null;
  if (offset != null) {
    decodedOffset=urlDecodeUTF8(offset);
  }
  List<MetricDefinition> metricDefinitionList=new ArrayList<>();
  for (  Serie serie : result) {
    for (    Map<String,Object> point : serie.getRows()) {
      String encodedMetricName=(String)point.get("String_Node_Str");
      if (offset != null) {
        if (encodedMetricName.compareTo(decodedOffset) <= 0) {
          continue;
        }
      }
      Utils.SerieNameDecoder serieNameDecoder;
      try {
        serieNameDecoder=new Utils.SerieNameDecoder(encodedMetricName);
      }
 catch (      Utils.SerieNameDecodeException e) {
        logger.warn("String_Node_Str",point.get("String_Node_Str"),e);
        continue;
      }
      MetricDefinition metricDefinition=new MetricDefinition(serieNameDecoder.getMetricName(),serieNameDecoder.getDimensions());
      metricDefinition.setId(urlEncodeUTF8(encodedMetricName));
      metricDefinitionList.add(metricDefinition);
      if (offset != null) {
        if (metricDefinitionList.size() >= Paged.LIMIT) {
          return metricDefinitionList;
        }
      }
    }
  }
  return metricDefinitionList;
}
Program: 168687
Project: 168687
Buggy source:
/** 
 * Patches the alarm for the   {@code tenantId} and {@code alarmId} to the state of the{@code fields}.
 * @throws EntityNotFoundException if the alarm cannot be found
 * @throws InvalidEntityException if one of the actions cannot be found
 */
public Alarm patch(String tenantId,String alarmId,AlarmState state){
  Alarm alarm=repo.findById(alarmId);
  state=state == null ? alarm.getState() : state;
  updateInternal(tenantId,alarm,alarm.getState(),state);
  alarm.setState(state);
  return alarm;
}

Fixed version (ground truth):
/** 
 * Patches the alarm for the   {@code tenantId} and {@code alarmId} to the state of the{@code fields}.
 * @throws EntityNotFoundException if the alarm cannot be found
 * @throws InvalidEntityException if one of the actions cannot be found
 */
public Alarm patch(String tenantId,String alarmId,AlarmState state){
  Alarm alarm=repo.findById(tenantId,alarmId);
  state=state == null ? alarm.getState() : state;
  updateInternal(tenantId,alarm,alarm.getState(),state);
  alarm.setState(state);
  return alarm;
}
Program: 168688
Project: 168688
Buggy source:
/** 
 * Updates the alarmed metric for the   {@code tenantId} and {@code alarmedMetricId} to the state ofthe  {@code command}.
 * @throws EntityNotFoundException if the alarmed metric cannot be found
 */
public Alarm update(String tenantId,String alarmId,UpdateAlarmCommand command){
  Alarm alarm=repo.findById(alarmId);
  updateInternal(tenantId,alarm,alarm.getState(),command.state);
  alarm.setState(command.state);
  return alarm;
}

Fixed version (ground truth):
/** 
 * Updates the alarmed metric for the   {@code tenantId} and {@code alarmedMetricId} to the state ofthe  {@code command}.
 * @throws EntityNotFoundException if the alarmed metric cannot be found
 */
public Alarm update(String tenantId,String alarmId,UpdateAlarmCommand command){
  Alarm alarm=repo.findById(tenantId,alarmId);
  updateInternal(tenantId,alarm,alarm.getState(),command.state);
  alarm.setState(command.state);
  return alarm;
}
Program: 168689
Project: 168689
Buggy source:
private void updateInternal(String tenantId,Alarm alarm,AlarmState oldState,AlarmState newState){
  try {
    LOG.debug("String_Node_Str",alarm.getId(),tenantId);
    repo.update(tenantId,alarm.getId(),newState);
    AlarmDefinition alarmDef=alarmDefRepo.findById(tenantId,alarm.getAlarmDefinition().getId());
    List<MetricDefinition> metrics=repo.findMetrics(alarm.getId());
    Map<String,AlarmSubExpression> subAlarms=repo.findAlarmSubExpressions(alarm.getId());
    String event=Serialization.toJson(new AlarmUpdatedEvent(alarm.getId(),alarm.getAlarmDefinition().getId(),tenantId,metrics,subAlarms,newState,oldState));
    producer.send(new KeyedMessage<>(config.eventsTopic,tenantId,event));
    if (!oldState.equals(newState)) {
      event=Serialization.toJson(new AlarmStateTransitionedEvent(tenantId,alarm.getId(),alarmDef.getId(),alarm.getMetrics(),alarmDef.getName(),alarmDef.getDescription(),oldState,newState,alarmDef.getSeverity(),alarmDef.isActionsEnabled(),stateChangeReasonFor(oldState,newState),System.currentTimeMillis() / 1000));
      producer.send(new KeyedMessage<>(config.alarmStateTransitionsTopic,tenantId,event));
    }
  }
 catch (  Exception e) {
    throw Exceptions.uncheck(e,"String_Node_Str",tenantId);
  }
}

Fixed version (ground truth):
private void updateInternal(String tenantId,Alarm alarm,AlarmState oldState,AlarmState newState){
  try {
    LOG.debug("String_Node_Str",alarm.getId(),tenantId);
    repo.update(tenantId,alarm.getId(),newState);
    AlarmDefinition alarmDef=alarmDefRepo.findById(tenantId,alarm.getAlarmDefinition().getId());
    List<MetricDefinition> metrics=repo.findMetrics(tenantId,alarm.getId());
    Map<String,AlarmSubExpression> subAlarms=repo.findAlarmSubExpressions(alarm.getId());
    String event=Serialization.toJson(new AlarmUpdatedEvent(alarm.getId(),alarm.getAlarmDefinition().getId(),tenantId,metrics,subAlarms,newState,oldState));
    producer.send(new KeyedMessage<>(config.eventsTopic,tenantId,event));
    if (!oldState.equals(newState)) {
      event=Serialization.toJson(new AlarmStateTransitionedEvent(tenantId,alarm.getId(),alarmDef.getId(),alarm.getMetrics(),alarmDef.getName(),alarmDef.getDescription(),oldState,newState,alarmDef.getSeverity(),alarmDef.isActionsEnabled(),stateChangeReasonFor(oldState,newState),System.currentTimeMillis() / 1000));
      producer.send(new KeyedMessage<>(config.alarmStateTransitionsTopic,tenantId,event));
    }
  }
 catch (  Exception e) {
    throw Exceptions.uncheck(e,"String_Node_Str",tenantId);
  }
}
Program: 168690
Project: 168690
Buggy source:
/** 
 * Deletes the alarm identified by the   {@code alarmId}.
 * @throws EntityNotFoundException if the alarm cannot be found
 */
public void delete(String tenantId,String alarmId){
  Alarm alarm=repo.findById(alarmId);
  Map<String,AlarmSubExpression> subAlarmMetricDefs=repo.findAlarmSubExpressions(alarmId);
  List<MetricDefinition> metrics=repo.findMetrics(alarmId);
  repo.deleteById(alarmId);
  String event=Serialization.toJson(new AlarmDeletedEvent(tenantId,alarmId,metrics,alarm.getAlarmDefinition().getId(),subAlarmMetricDefs));
  producer.send(new KeyedMessage<>(config.eventsTopic,tenantId,event));
}

Fixed version (ground truth):
/** 
 * Deletes the alarm identified by the   {@code alarmId}.
 * @throws EntityNotFoundException if the alarm cannot be found
 */
public void delete(String tenantId,String alarmId){
  Alarm alarm=repo.findById(tenantId,alarmId);
  Map<String,AlarmSubExpression> subAlarmMetricDefs=repo.findAlarmSubExpressions(alarmId);
  List<MetricDefinition> metrics=repo.findMetrics(tenantId,alarmId);
  repo.deleteById(tenantId,alarmId);
  String event=Serialization.toJson(new AlarmDeletedEvent(tenantId,alarmId,metrics,alarm.getAlarmDefinition().getId(),subAlarmMetricDefs));
  producer.send(new KeyedMessage<>(config.eventsTopic,tenantId,event));
}
Program: 168691
Project: 168691
Buggy source:
/** 
 * @throws EntityNotFoundException if an alarm cannot be found for the {@code id}
 */
Alarm findById(String id);

Fixed version (ground truth):
/** 
 * @throws EntityNotFoundException if an alarm cannot be found for the {@code id}
 */
Alarm findById(String tenantId,String id);
Program: 168692
Project: 168692
Buggy source:
List<MetricDefinition> findMetrics(String alarmId);

Fixed version (ground truth):
List<MetricDefinition> findMetrics(String tenantId,String alarmId);
Program: 168693
Project: 168693
Buggy source:
/** 
 * Deletes all alarms associated with the   {@code id}.
 */
void deleteById(String id);

Fixed version (ground truth):
/** 
 * Deletes all alarms associated with the   {@code id}.
 */
void deleteById(String tenantId,String id);
Program: 168694
Project: 168694
Buggy source:
@Override public List<MetricDefinition> findMetrics(String alarmId){
  try (Handle h=db.open()){
    return findMetrics(h,alarmId);
  }
 }

Fixed version (ground truth):
@Override public List<MetricDefinition> findMetrics(String tenantId,String alarmId){
  try (Handle h=db.open()){
    return findMetrics(h,tenantId,alarmId);
  }
 }
Program: 168695
Project: 168695
Buggy source:
@Override public List<Alarm> find(String tenantId,String alarmDefId,String metricName,Map<String,String> metricDimensions,AlarmState state){
  try (Handle h=db.open()){
    StringBuilder sbWhere=new StringBuilder();
    if (alarmDefId != null) {
      sbWhere.append("String_Node_Str");
    }
    if (metricName != null) {
      sbWhere.append("String_Node_Str");
    }
    if (state != null) {
      sbWhere.append("String_Node_Str");
    }
    String sql=String.format(ALARM_SQL,buildJoinClauseFor(metricDimensions),sbWhere);
    Query<?> q=h.createQuery(sql).bind("String_Node_Str",tenantId);
    if (alarmDefId != null) {
      q.bind("String_Node_Str",alarmDefId);
    }
    if (metricName != null) {
      q.bind("String_Node_Str",metricName);
    }
    if (state != null) {
      q.bind("String_Node_Str",state.name());
    }
    Query<Alarm> qAlarm=q.map(new AlarmMapper());
    DimensionQueries.bindDimensionsToQuery(q,metricDimensions);
    List<Alarm> alarms=qAlarm.list();
    for (    Alarm alarm : alarms) {
      alarm.setMetrics(findMetrics(h,alarm.getId()));
    }
    return alarms;
  }
 }

Fixed version (ground truth):
@Override public List<Alarm> find(String tenantId,String alarmDefId,String metricName,Map<String,String> metricDimensions,AlarmState state){
  try (Handle h=db.open()){
    StringBuilder sbWhere=new StringBuilder();
    if (alarmDefId != null) {
      sbWhere.append("String_Node_Str");
    }
    if (metricName != null) {
      sbWhere.append("String_Node_Str");
    }
    if (state != null) {
      sbWhere.append("String_Node_Str");
    }
    String sql=String.format(ALARM_SQL,buildJoinClauseFor(metricDimensions),sbWhere);
    Query<?> q=h.createQuery(sql).bind("String_Node_Str",tenantId);
    if (alarmDefId != null) {
      q.bind("String_Node_Str",alarmDefId);
    }
    if (metricName != null) {
      q.bind("String_Node_Str",metricName);
    }
    if (state != null) {
      q.bind("String_Node_Str",state.name());
    }
    Query<Alarm> qAlarm=q.map(new AlarmMapper());
    DimensionQueries.bindDimensionsToQuery(q,metricDimensions);
    List<Alarm> alarms=qAlarm.list();
    for (    Alarm alarm : alarms) {
      alarm.setMetrics(findMetrics(h,tenantId,alarm.getId()));
    }
    return alarms;
  }
 }
Program: 168696
Project: 168696
Buggy source:
@Override public Alarm findById(String alarmId){
  try (Handle h=db.open()){
    Alarm alarm=h.createQuery("String_Node_Str" + "String_Node_Str" + "String_Node_Str").bind("String_Node_Str",alarmId).map(new AlarmMapper()).first();
    if (alarm == null)     throw new EntityNotFoundException("String_Node_Str",alarmId);
    alarm.setMetrics(findMetrics(h,alarm.getId()));
    return alarm;
  }
 }

Fixed version (ground truth):
@Override public Alarm findById(String tenantId,String alarmId){
  try (Handle h=db.open()){
    Alarm alarm=h.createQuery("String_Node_Str" + "String_Node_Str" + "String_Node_Str").bind("String_Node_Str",alarmId).bind("String_Node_Str",tenantId).map(new AlarmMapper()).first();
    if (alarm == null)     throw new EntityNotFoundException("String_Node_Str",alarmId);
    alarm.setMetrics(findMetrics(h,tenantId,alarm.getId()));
    return alarm;
  }
 }
Program: 168697
Project: 168697
Buggy source:
@Override public void deleteById(String id){
  try (Handle h=db.open()){
    h.execute("String_Node_Str",id);
  }
 }

Fixed version (ground truth):
@Override public void deleteById(String tenantId,String id){
  String sql="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  try (Handle h=db.open()){
    h.execute(sql,tenantId,id);
  }
 }
Program: 168698
Project: 168698
Buggy source:
@GET @Timed @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value="String_Node_Str",response=Alarm.class) @ApiResponses(value={@ApiResponse(code=400,message="String_Node_Str"),@ApiResponse(code=404,message="String_Node_Str")}) public Alarm get(@ApiParam(value="String_Node_Str",required=true) @Context UriInfo uriInfo,@HeaderParam("String_Node_Str") String tenantId,@PathParam("String_Node_Str") String alarm_id){
  return fixAlarmLinks(uriInfo,repo.findById(alarm_id));
}

Fixed version (ground truth):
@GET @Timed @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value="String_Node_Str",response=Alarm.class) @ApiResponses(value={@ApiResponse(code=400,message="String_Node_Str"),@ApiResponse(code=404,message="String_Node_Str")}) public Alarm get(@ApiParam(value="String_Node_Str",required=true) @Context UriInfo uriInfo,@HeaderParam("String_Node_Str") String tenantId,@PathParam("String_Node_Str") String alarm_id){
  return fixAlarmLinks(uriInfo,repo.findById(tenantId,alarm_id));
}
Program: 168699
Project: 168699
Buggy source:
@Test(groups="String_Node_Str") public void shouldDelete(){
  repo.deleteById("String_Node_Str");
  try {
    assertNull(repo.findById("String_Node_Str"));
    fail();
  }
 catch (  EntityNotFoundException expected) {
  }
}

Fixed version (ground truth):
@Test(groups="String_Node_Str") public void shouldDelete(){
  repo.deleteById("String_Node_Str","String_Node_Str");
  try {
    assertNull(repo.findById("String_Node_Str","String_Node_Str"));
    fail();
  }
 catch (  EntityNotFoundException expected) {
  }
}
Program: 168700
Project: 168700
Buggy source:
@Test(groups="String_Node_Str") public void shouldFindById(){
  db=new DBI("String_Node_Str","String_Node_Str","String_Node_Str");
  handle=db.open();
  repo=new AlarmMySqlRepositoryImpl(db);
  beforeMethod();
  final String alarmId="String_Node_Str";
  Alarm alarm=repo.findById(alarmId);
  assertEquals(alarm.getId(),alarmId);
  assertEquals(alarm.getAlarmDefinition().getId(),"String_Node_Str");
  assertEquals(alarm.getState(),AlarmState.OK);
  assertEquals(alarm.getMetrics(),Arrays.asList(new MetricDefinition("String_Node_Str",ImmutableMap.<String,String>builder().put("String_Node_Str","String_Node_Str").put("String_Node_Str","String_Node_Str").build()),new MetricDefinition("String_Node_Str",ImmutableMap.<String,String>builder().put("String_Node_Str","String_Node_Str").put("String_Node_Str","String_Node_Str").build())));
}

Fixed version (ground truth):
@Test(groups="String_Node_Str") public void shouldFindById(){
  db=new DBI("String_Node_Str","String_Node_Str","String_Node_Str");
  handle=db.open();
  repo=new AlarmMySqlRepositoryImpl(db);
  beforeMethod();
  final String alarmId="String_Node_Str";
  Alarm alarm=repo.findById("String_Node_Str",alarmId);
  assertEquals(alarm.getId(),alarmId);
  assertEquals(alarm.getAlarmDefinition().getId(),"String_Node_Str");
  assertEquals(alarm.getState(),AlarmState.OK);
  assertEquals(alarm.getMetrics(),Arrays.asList(new MetricDefinition("String_Node_Str",ImmutableMap.<String,String>builder().put("String_Node_Str","String_Node_Str").put("String_Node_Str","String_Node_Str").build()),new MetricDefinition("String_Node_Str",ImmutableMap.<String,String>builder().put("String_Node_Str","String_Node_Str").put("String_Node_Str","String_Node_Str").build())));
}
Program: 168701
Project: 168701
Buggy source:
/** 
 * Patches the alarm for the   {@code tenantId} and {@code alarmId} to the state of the{@code fields}.
 * @throws EntityNotFoundException if the alarm cannot be found
 * @throws InvalidEntityException if one of the actions cannot be found
 */
public Alarm patch(String tenantId,String alarmId,AlarmState state){
  Alarm alarm=repo.findById(alarmId);
  state=state == null ? alarm.getState() : state;
  updateInternal(tenantId,alarm,alarm.getState(),state);
  alarm.setState(state);
  return alarm;
}

Fixed version (ground truth):
/** 
 * Patches the alarm for the   {@code tenantId} and {@code alarmId} to the state of the{@code fields}.
 * @throws EntityNotFoundException if the alarm cannot be found
 * @throws InvalidEntityException if one of the actions cannot be found
 */
public Alarm patch(String tenantId,String alarmId,AlarmState state){
  Alarm alarm=repo.findById(tenantId,alarmId);
  state=state == null ? alarm.getState() : state;
  updateInternal(tenantId,alarm,alarm.getState(),state);
  alarm.setState(state);
  return alarm;
}
Program: 168702
Project: 168702
Buggy source:
/** 
 * Updates the alarmed metric for the   {@code tenantId} and {@code alarmedMetricId} to the state ofthe  {@code command}.
 * @throws EntityNotFoundException if the alarmed metric cannot be found
 */
public Alarm update(String tenantId,String alarmId,UpdateAlarmCommand command){
  Alarm alarm=repo.findById(alarmId);
  updateInternal(tenantId,alarm,alarm.getState(),command.state);
  alarm.setState(command.state);
  return alarm;
}

Fixed version (ground truth):
/** 
 * Updates the alarmed metric for the   {@code tenantId} and {@code alarmedMetricId} to the state ofthe  {@code command}.
 * @throws EntityNotFoundException if the alarmed metric cannot be found
 */
public Alarm update(String tenantId,String alarmId,UpdateAlarmCommand command){
  Alarm alarm=repo.findById(tenantId,alarmId);
  updateInternal(tenantId,alarm,alarm.getState(),command.state);
  alarm.setState(command.state);
  return alarm;
}
Program: 168703
Project: 168703
Buggy source:
private void updateInternal(String tenantId,Alarm alarm,AlarmState oldState,AlarmState newState){
  try {
    LOG.debug("String_Node_Str",alarm.getId(),tenantId);
    repo.update(tenantId,alarm.getId(),newState);
    AlarmDefinition alarmDef=alarmDefRepo.findById(tenantId,alarm.getAlarmDefinition().getId());
    List<MetricDefinition> metrics=repo.findMetrics(alarm.getId());
    Map<String,AlarmSubExpression> subAlarms=repo.findAlarmSubExpressions(alarm.getId());
    String event=Serialization.toJson(new AlarmUpdatedEvent(alarm.getId(),alarm.getAlarmDefinition().getId(),tenantId,metrics,subAlarms,newState,oldState));
    producer.send(new KeyedMessage<>(config.eventsTopic,tenantId,event));
    if (!oldState.equals(newState)) {
      event=Serialization.toJson(new AlarmStateTransitionedEvent(tenantId,alarm.getId(),alarmDef.getId(),alarm.getMetrics(),alarmDef.getName(),alarmDef.getDescription(),oldState,newState,alarmDef.getSeverity(),alarmDef.isActionsEnabled(),stateChangeReasonFor(oldState,newState),System.currentTimeMillis() / 1000));
      producer.send(new KeyedMessage<>(config.alarmStateTransitionsTopic,tenantId,event));
    }
  }
 catch (  Exception e) {
    throw Exceptions.uncheck(e,"String_Node_Str",tenantId);
  }
}

Fixed version (ground truth):
private void updateInternal(String tenantId,Alarm alarm,AlarmState oldState,AlarmState newState){
  try {
    LOG.debug("String_Node_Str",alarm.getId(),tenantId);
    repo.update(tenantId,alarm.getId(),newState);
    AlarmDefinition alarmDef=alarmDefRepo.findById(tenantId,alarm.getAlarmDefinition().getId());
    List<MetricDefinition> metrics=repo.findMetrics(tenantId,alarm.getId());
    Map<String,AlarmSubExpression> subAlarms=repo.findAlarmSubExpressions(alarm.getId());
    String event=Serialization.toJson(new AlarmUpdatedEvent(alarm.getId(),alarm.getAlarmDefinition().getId(),tenantId,metrics,subAlarms,newState,oldState));
    producer.send(new KeyedMessage<>(config.eventsTopic,tenantId,event));
    if (!oldState.equals(newState)) {
      event=Serialization.toJson(new AlarmStateTransitionedEvent(tenantId,alarm.getId(),alarmDef.getId(),alarm.getMetrics(),alarmDef.getName(),alarmDef.getDescription(),oldState,newState,alarmDef.getSeverity(),alarmDef.isActionsEnabled(),stateChangeReasonFor(oldState,newState),System.currentTimeMillis() / 1000));
      producer.send(new KeyedMessage<>(config.alarmStateTransitionsTopic,tenantId,event));
    }
  }
 catch (  Exception e) {
    throw Exceptions.uncheck(e,"String_Node_Str",tenantId);
  }
}
Program: 168704
Project: 168704
Buggy source:
/** 
 * Deletes the alarm identified by the   {@code alarmId}.
 * @throws EntityNotFoundException if the alarm cannot be found
 */
public void delete(String tenantId,String alarmId){
  Alarm alarm=repo.findById(alarmId);
  Map<String,AlarmSubExpression> subAlarmMetricDefs=repo.findAlarmSubExpressions(alarmId);
  List<MetricDefinition> metrics=repo.findMetrics(alarmId);
  repo.deleteById(alarmId);
  String event=Serialization.toJson(new AlarmDeletedEvent(tenantId,alarmId,metrics,alarm.getAlarmDefinition().getId(),subAlarmMetricDefs));
  producer.send(new KeyedMessage<>(config.eventsTopic,tenantId,event));
}

Fixed version (ground truth):
/** 
 * Deletes the alarm identified by the   {@code alarmId}.
 * @throws EntityNotFoundException if the alarm cannot be found
 */
public void delete(String tenantId,String alarmId){
  Alarm alarm=repo.findById(tenantId,alarmId);
  Map<String,AlarmSubExpression> subAlarmMetricDefs=repo.findAlarmSubExpressions(alarmId);
  List<MetricDefinition> metrics=repo.findMetrics(tenantId,alarmId);
  repo.deleteById(tenantId,alarmId);
  String event=Serialization.toJson(new AlarmDeletedEvent(tenantId,alarmId,metrics,alarm.getAlarmDefinition().getId(),subAlarmMetricDefs));
  producer.send(new KeyedMessage<>(config.eventsTopic,tenantId,event));
}
Program: 168705
Project: 168705
Buggy source:
/** 
 * @throws EntityNotFoundException if an alarm cannot be found for the {@code id}
 */
Alarm findById(String id);

Fixed version (ground truth):
/** 
 * @throws EntityNotFoundException if an alarm cannot be found for the {@code id}
 */
Alarm findById(String tenantId,String id);
Program: 168706
Project: 168706
Buggy source:
List<MetricDefinition> findMetrics(String alarmId);

Fixed version (ground truth):
List<MetricDefinition> findMetrics(String tenantId,String alarmId);
Program: 168707
Project: 168707
Buggy source:
/** 
 * Deletes all alarms associated with the   {@code id}.
 */
void deleteById(String id);

Fixed version (ground truth):
/** 
 * Deletes all alarms associated with the   {@code id}.
 */
void deleteById(String tenantId,String id);
Program: 168708
Project: 168708
Buggy source:
@Override public List<MetricDefinition> findMetrics(String alarmId){
  try (Handle h=db.open()){
    return findMetrics(h,alarmId);
  }
 }

Fixed version (ground truth):
@Override public List<MetricDefinition> findMetrics(String tenantId,String alarmId){
  try (Handle h=db.open()){
    return findMetrics(h,tenantId,alarmId);
  }
 }
Program: 168709
Project: 168709
Buggy source:
@Override public List<Alarm> find(String tenantId,String alarmDefId,String metricName,Map<String,String> metricDimensions,AlarmState state){
  try (Handle h=db.open()){
    StringBuilder sbWhere=new StringBuilder();
    if (alarmDefId != null) {
      sbWhere.append("String_Node_Str");
    }
    if (metricName != null) {
      sbWhere.append("String_Node_Str");
    }
    if (state != null) {
      sbWhere.append("String_Node_Str");
    }
    String sql=String.format(ALARM_SQL,buildJoinClauseFor(metricDimensions),sbWhere);
    Query<?> q=h.createQuery(sql).bind("String_Node_Str",tenantId);
    if (alarmDefId != null) {
      q.bind("String_Node_Str",alarmDefId);
    }
    if (metricName != null) {
      q.bind("String_Node_Str",metricName);
    }
    if (state != null) {
      q.bind("String_Node_Str",state.name());
    }
    Query<Alarm> qAlarm=q.map(new AlarmMapper());
    DimensionQueries.bindDimensionsToQuery(q,metricDimensions);
    List<Alarm> alarms=qAlarm.list();
    for (    Alarm alarm : alarms) {
      alarm.setMetrics(findMetrics(h,alarm.getId()));
    }
    return alarms;
  }
 }

Fixed version (ground truth):
@Override public List<Alarm> find(String tenantId,String alarmDefId,String metricName,Map<String,String> metricDimensions,AlarmState state){
  try (Handle h=db.open()){
    StringBuilder sbWhere=new StringBuilder();
    if (alarmDefId != null) {
      sbWhere.append("String_Node_Str");
    }
    if (metricName != null) {
      sbWhere.append("String_Node_Str");
    }
    if (state != null) {
      sbWhere.append("String_Node_Str");
    }
    String sql=String.format(ALARM_SQL,buildJoinClauseFor(metricDimensions),sbWhere);
    Query<?> q=h.createQuery(sql).bind("String_Node_Str",tenantId);
    if (alarmDefId != null) {
      q.bind("String_Node_Str",alarmDefId);
    }
    if (metricName != null) {
      q.bind("String_Node_Str",metricName);
    }
    if (state != null) {
      q.bind("String_Node_Str",state.name());
    }
    Query<Alarm> qAlarm=q.map(new AlarmMapper());
    DimensionQueries.bindDimensionsToQuery(q,metricDimensions);
    List<Alarm> alarms=qAlarm.list();
    for (    Alarm alarm : alarms) {
      alarm.setMetrics(findMetrics(h,tenantId,alarm.getId()));
    }
    return alarms;
  }
 }
Program: 168710
Project: 168710
Buggy source:
@Override public Alarm findById(String alarmId){
  try (Handle h=db.open()){
    Alarm alarm=h.createQuery("String_Node_Str" + "String_Node_Str" + "String_Node_Str").bind("String_Node_Str",alarmId).map(new AlarmMapper()).first();
    if (alarm == null)     throw new EntityNotFoundException("String_Node_Str",alarmId);
    alarm.setMetrics(findMetrics(h,alarm.getId()));
    return alarm;
  }
 }

Fixed version (ground truth):
@Override public Alarm findById(String tenantId,String alarmId){
  try (Handle h=db.open()){
    Alarm alarm=h.createQuery("String_Node_Str" + "String_Node_Str" + "String_Node_Str").bind("String_Node_Str",alarmId).bind("String_Node_Str",tenantId).map(new AlarmMapper()).first();
    if (alarm == null)     throw new EntityNotFoundException("String_Node_Str",alarmId);
    alarm.setMetrics(findMetrics(h,tenantId,alarm.getId()));
    return alarm;
  }
 }
Program: 168711
Project: 168711
Buggy source:
@Override public void deleteById(String id){
  try (Handle h=db.open()){
    h.execute("String_Node_Str",id);
  }
 }

Fixed version (ground truth):
@Override public void deleteById(String tenantId,String id){
  String sql="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  try (Handle h=db.open()){
    h.execute(sql,tenantId,id);
  }
 }
Program: 168712
Project: 168712
Buggy source:
@GET @Timed @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value="String_Node_Str",response=Alarm.class) @ApiResponses(value={@ApiResponse(code=400,message="String_Node_Str"),@ApiResponse(code=404,message="String_Node_Str")}) public Alarm get(@ApiParam(value="String_Node_Str",required=true) @Context UriInfo uriInfo,@HeaderParam("String_Node_Str") String tenantId,@PathParam("String_Node_Str") String alarm_id){
  return fixAlarmLinks(uriInfo,repo.findById(alarm_id));
}

Fixed version (ground truth):
@GET @Timed @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value="String_Node_Str",response=Alarm.class) @ApiResponses(value={@ApiResponse(code=400,message="String_Node_Str"),@ApiResponse(code=404,message="String_Node_Str")}) public Alarm get(@ApiParam(value="String_Node_Str",required=true) @Context UriInfo uriInfo,@HeaderParam("String_Node_Str") String tenantId,@PathParam("String_Node_Str") String alarm_id){
  return fixAlarmLinks(uriInfo,repo.findById(tenantId,alarm_id));
}
Program: 168713
Project: 168713
Buggy source:
@Test(groups="String_Node_Str") public void shouldDelete(){
  repo.deleteById("String_Node_Str");
  try {
    assertNull(repo.findById("String_Node_Str"));
    fail();
  }
 catch (  EntityNotFoundException expected) {
  }
}

Fixed version (ground truth):
@Test(groups="String_Node_Str") public void shouldDelete(){
  repo.deleteById("String_Node_Str","String_Node_Str");
  try {
    assertNull(repo.findById("String_Node_Str","String_Node_Str"));
    fail();
  }
 catch (  EntityNotFoundException expected) {
  }
}
Program: 168714
Project: 168714
Buggy source:
@Test(groups="String_Node_Str") public void shouldFindById(){
  db=new DBI("String_Node_Str","String_Node_Str","String_Node_Str");
  handle=db.open();
  repo=new AlarmMySqlRepositoryImpl(db);
  beforeMethod();
  final String alarmId="String_Node_Str";
  Alarm alarm=repo.findById(alarmId);
  assertEquals(alarm.getId(),alarmId);
  assertEquals(alarm.getAlarmDefinition().getId(),"String_Node_Str");
  assertEquals(alarm.getState(),AlarmState.OK);
  assertEquals(alarm.getMetrics(),Arrays.asList(new MetricDefinition("String_Node_Str",ImmutableMap.<String,String>builder().put("String_Node_Str","String_Node_Str").put("String_Node_Str","String_Node_Str").build()),new MetricDefinition("String_Node_Str",ImmutableMap.<String,String>builder().put("String_Node_Str","String_Node_Str").put("String_Node_Str","String_Node_Str").build())));
}

Fixed version (ground truth):
@Test(groups="String_Node_Str") public void shouldFindById(){
  db=new DBI("String_Node_Str","String_Node_Str","String_Node_Str");
  handle=db.open();
  repo=new AlarmMySqlRepositoryImpl(db);
  beforeMethod();
  final String alarmId="String_Node_Str";
  Alarm alarm=repo.findById("String_Node_Str",alarmId);
  assertEquals(alarm.getId(),alarmId);
  assertEquals(alarm.getAlarmDefinition().getId(),"String_Node_Str");
  assertEquals(alarm.getState(),AlarmState.OK);
  assertEquals(alarm.getMetrics(),Arrays.asList(new MetricDefinition("String_Node_Str",ImmutableMap.<String,String>builder().put("String_Node_Str","String_Node_Str").put("String_Node_Str","String_Node_Str").build()),new MetricDefinition("String_Node_Str",ImmutableMap.<String,String>builder().put("String_Node_Str","String_Node_Str").put("String_Node_Str","String_Node_Str").build())));
}
Program: 168716
Project: 168716
Buggy source:
@Override public List<MetricDefinition> find(String tenantId,String name,Map<String,String> dimensions) throws Exception {
  String serieNameRegex=buildSerieNameRegex(tenantId,name,dimensions);
  String query=String.format("String_Node_Str",serieNameRegex);
  logger.debug("String_Node_Str",query);
  List<MetricDefinition> metricDefinitionList=new ArrayList<>();
  List<Serie> result=this.influxDB.Query(this.config.influxDB.getName(),query,TimeUnit.SECONDS);
  for (  Serie serie : result) {
    for (    Map point : serie.getRows()) {
      String serieName=(String)point.get("String_Node_Str");
      Matcher m=p.matcher(serieName);
      if (!m.matches()) {
        logger.warn("String_Node_Str",serieName);
        continue;
      }
      Utils.SerieNameConverter serieNameConverter=new Utils.SerieNameConverter(serieName);
      MetricDefinition metricDefinition=new MetricDefinition(serieNameConverter.getMetricName(),serieNameConverter.getDimensions());
      metricDefinitionList.add(metricDefinition);
    }
  }
  return metricDefinitionList;
}

Fixed version (ground truth):
@Override public List<MetricDefinition> find(String tenantId,String name,Map<String,String> dimensions) throws Exception {
  String serieNameRegex=buildSerieNameRegex(tenantId,name,dimensions);
  String query=String.format("String_Node_Str",serieNameRegex);
  logger.debug("String_Node_Str",query);
  List<MetricDefinition> metricDefinitionList=new ArrayList<>();
  List<Serie> result=this.influxDB.Query(this.config.influxDB.getName(),query,TimeUnit.SECONDS);
  for (  Serie serie : result) {
    for (    Map point : serie.getRows()) {
      String serieName=(String)point.get("String_Node_Str");
      if (!serieNameMatcher(serieName)) {
        logger.warn("String_Node_Str",serieName);
        continue;
      }
      Utils.SerieNameConverter serieNameConverter=new Utils.SerieNameConverter(serieName);
      MetricDefinition metricDefinition=new MetricDefinition(serieNameConverter.getMetricName(),serieNameConverter.getDimensions());
      metricDefinitionList.add(metricDefinition);
    }
  }
  return metricDefinitionList;
}