nus-yam/ex-repair huggingface dataset:
Program: 168636
Project: 168636
Buggy source:
public void shouldErrorOnCreateWithoutName() throws Exception {
  String json=jsonFixture("String_Node_Str");
  ClientResponse response=createResponseFor(json);
  ErrorMessages.assertThat(response.getEntity(String.class)).matches("String_Node_Str",422,"String_Node_Str");
}

Fixed version (ground truth):
public void shouldErrorOnCreateWithoutName() throws Exception {
  String json=jsonFixture("String_Node_Str");
  CreateMetricCommand metric=fromJson(json,CreateMetricCommand.class);
  metric.timestamp=timestamp;
  ClientResponse response=createResponseFor(metric);
  ErrorMessages.assertThat(response.getEntity(String.class)).matches("String_Node_Str",422,"String_Node_Str");
}
Program: 168638
Project: 168638
Buggy source:
@Override public Map<String,AlarmSubExpression> findAlarmSubExpressions(String alarmId){
  try (Handle h=db.open()){
    final List<SubAlarm> result=h.createQuery("String_Node_Str").bind("String_Node_Str",alarmId).map(new BeanMapper<SubAlarm>(SubAlarm.class)).list();
    final Map<String,AlarmSubExpression> subAlarms=new HashMap<>(result.size());
    for (    SubAlarm row : result) {
      subAlarms.put(row.id,AlarmSubExpression.of(row.expression));
    }
    return subAlarms;
  }
 }

Fixed version (ground truth):
@Override public Map<String,AlarmSubExpression> findAlarmSubExpressions(String alarmId){
  try (Handle h=db.open()){
    final List<SubAlarm> result=h.createQuery("String_Node_Str").bind("String_Node_Str",alarmId).map(new BeanMapper<>(SubAlarm.class)).list();
    final Map<String,AlarmSubExpression> subAlarms=new HashMap<>(result.size());
    for (    SubAlarm row : result) {
      subAlarms.put(row.id,AlarmSubExpression.of(row.expression));
    }
    return subAlarms;
  }
 }
Program: 168640
Project: 168640
Buggy source:
private Alarm findAlarm(String tenantId,String alarmId,Handle h){
  final String sql=String.format(ALARM_SQL,"String_Node_Str","String_Node_Str");
  final List<Map<String,Object>> rows=h.createQuery(sql).bind("String_Node_Str",alarmId).bind("String_Node_Str",tenantId).list();
  if (rows.isEmpty()) {
    throw new EntityNotFoundException("String_Node_Str",alarmId);
  }
  return createAlarms(tenantId,rows).get(0);
}

Fixed version (ground truth):
private Alarm findAlarm(String tenantId,String alarmId,Handle h){
  final String sql=String.format(FIND_ALARM_BY_ID_SQL,"String_Node_Str","String_Node_Str");
  final List<Map<String,Object>> rows=h.createQuery(sql).bind("String_Node_Str",alarmId).bind("String_Node_Str",tenantId).list();
  if (rows.isEmpty()) {
    throw new EntityNotFoundException("String_Node_Str",alarmId);
  }
  return createAlarms(tenantId,rows).get(0);
}
Program: 168642
Project: 168642
Buggy source:
private AlarmStateHistory getAlarmStateHistory(Map<String,Object> row){
  AlarmStateHistory alarmStateHistory=new AlarmStateHistory();
  Date date;
  try {
    date=parseTimestamp(((Timestamp)row.get("String_Node_Str")).toString() + "String_Node_Str");
  }
 catch (  ParseException e) {
    logger.error("String_Node_Str",e);
    return null;
  }
  DateTime dateTime=new DateTime(date.getTime(),DateTimeZone.UTC);
  alarmStateHistory.setTimestamp(dateTime);
  alarmStateHistory.setAlarmId((String)row.get("String_Node_Str"));
  List<MetricDefinition> metricDefinitionList;
  try {
    metricDefinitionList=this.objectMapper.readValue((String)row.get("String_Node_Str"),METRICS_TYPE);
  }
 catch (  IOException e) {
    logger.error("String_Node_Str",e);
    metricDefinitionList=new ArrayList<>();
  }
  alarmStateHistory.setMetrics(metricDefinitionList);
  alarmStateHistory.setOldState(AlarmState.valueOf((String)row.get("String_Node_Str")));
  alarmStateHistory.setNewState(AlarmState.valueOf((String)row.get("String_Node_Str")));
  alarmStateHistory.setReason((String)row.get("String_Node_Str"));
  alarmStateHistory.setReasonData((String)row.get("String_Node_Str"));
  List<AlarmTransitionSubAlarm> subAlarmList;
  try {
    subAlarmList=this.objectMapper.readValue((String)row.get("String_Node_Str"),SUB_ALARMS_TYPE);
  }
 catch (  IOException e) {
    logger.error("String_Node_Str",e);
    subAlarmList=new ArrayList<>();
  }
  alarmStateHistory.setSubAlarms(subAlarmList);
  return alarmStateHistory;
}

Fixed version (ground truth):
private AlarmStateHistory getAlarmStateHistory(Map<String,Object> row){
  AlarmStateHistory alarmStateHistory=new AlarmStateHistory();
  Date date;
  try {
    date=parseTimestamp(row.get("String_Node_Str").toString() + "String_Node_Str");
  }
 catch (  ParseException e) {
    logger.error("String_Node_Str",e);
    return null;
  }
  DateTime dateTime=new DateTime(date.getTime(),DateTimeZone.UTC);
  alarmStateHistory.setTimestamp(dateTime);
  alarmStateHistory.setAlarmId((String)row.get("String_Node_Str"));
  List<MetricDefinition> metricDefinitionList;
  try {
    metricDefinitionList=this.objectMapper.readValue((String)row.get("String_Node_Str"),METRICS_TYPE);
  }
 catch (  IOException e) {
    logger.error("String_Node_Str",e);
    metricDefinitionList=new ArrayList<>();
  }
  alarmStateHistory.setMetrics(metricDefinitionList);
  alarmStateHistory.setOldState(AlarmState.valueOf((String)row.get("String_Node_Str")));
  alarmStateHistory.setNewState(AlarmState.valueOf((String)row.get("String_Node_Str")));
  alarmStateHistory.setReason((String)row.get("String_Node_Str"));
  alarmStateHistory.setReasonData((String)row.get("String_Node_Str"));
  List<AlarmTransitionSubAlarm> subAlarmList;
  try {
    subAlarmList=this.objectMapper.readValue((String)row.get("String_Node_Str"),SUB_ALARMS_TYPE);
  }
 catch (  IOException e) {
    logger.error("String_Node_Str",e);
    subAlarmList=new ArrayList<>();
  }
  alarmStateHistory.setSubAlarms(subAlarmList);
  return alarmStateHistory;
}
Program: 168643
Project: 168643
Buggy source:
private Date parseTimestamp(String timestampString) throws ParseException {
  try {
    return this.simpleDateFormat.parse(timestampString);
  }
 catch (  ParseException pe) {
    return this.oldSimpleDateFormat.parse(timestampString);
  }
}

Fixed version (ground truth):
private Date parseTimestamp(String timestampString) throws ParseException {
  try {
    return this.simpleDateFormat.parse(timestampString);
  }
 catch (  ParseException pe0) {
    try {
      return this.simpleDateFormatOneMilli.parse(timestampString);
    }
 catch (    ParseException pe1) {
      return this.oldSimpleDateFormat.parse(timestampString);
    }
  }
}
Program: 168645
Project: 168645
Buggy source:
private List<Map<String,Object>> executeMetricNamesQuery(String tenantId,Map<String,String> dimensions,String offset,int limit){
  StringBuilder sb=new StringBuilder();
  if (offset != null && !offset.isEmpty()) {
    sb.append("String_Node_Str");
  }
  String sql=String.format(FIND_METRIC_NAMES_SQL,MetricQueries.buildJoinClauseFor(dimensions),sb);
  try (Handle h=db.open()){
    Query<Map<String,Object>> query=h.createQuery(sql).bind("String_Node_Str",tenantId).bind("String_Node_Str",limit + 1);
    if (offset != null && !offset.isEmpty()) {
      logger.debug("String_Node_Str",offset);
      try {
        query.bind("String_Node_Str",Hex.decodeHex(offset.toCharArray()));
      }
 catch (      DecoderException e) {
        throw Exceptions.badRequest("String_Node_Str" + offset,e);
      }
    }
    DimensionQueries.bindDimensionsToQuery(query,dimensions);
    return query.list();
  }
 }

Fixed version (ground truth):
private List<Map<String,Object>> executeMetricNamesQuery(String tenantId,Map<String,String> dimensions,String offset,int limit){
  String offsetPart="String_Node_Str";
  if (offset != null && !offset.isEmpty()) {
    offsetPart="String_Node_Str";
  }
  String limitPart="String_Node_Str" + Integer.toString(limit + 1);
  String defSubSelect=String.format(METRIC_NAMES_SUB_SELECT,MetricQueries.buildJoinClauseFor(dimensions,TABLE_TO_JOIN_DIMENSIONS_ON),offsetPart,limitPart);
  String sql=String.format(FIND_METRIC_NAMES_SQL,defSubSelect);
  try (Handle h=db.open()){
    Query<Map<String,Object>> query=h.createQuery(sql).bind("String_Node_Str",tenantId);
    if (offset != null && !offset.isEmpty()) {
      logger.debug("String_Node_Str",offset);
      try {
        query.bind("String_Node_Str",Hex.decodeHex(offset.toCharArray()));
      }
 catch (      DecoderException e) {
        throw Exceptions.badRequest("String_Node_Str" + offset,e);
      }
    }
    DimensionQueries.bindDimensionsToQuery(query,dimensions);
    return query.list();
  }
 }
Program: 168646
Project: 168646
Buggy source:
private List<Map<String,Object>> executeMetricDefsQuery(String tenantId,String name,Map<String,String> dimensions,String offset,int limit){
  StringBuilder sb=new StringBuilder();
  if (name != null && !name.isEmpty()) {
    sb.append("String_Node_Str");
  }
  if (offset != null && !offset.isEmpty()) {
    sb.append("String_Node_Str");
  }
  String sql=String.format(FIND_METRIC_DEFS_SQL,MetricQueries.buildJoinClauseFor(dimensions),sb);
  try (Handle h=db.open()){
    Query<Map<String,Object>> query=h.createQuery(sql).bind("String_Node_Str",tenantId).bind("String_Node_Str",limit + 1);
    if (name != null && !name.isEmpty()) {
      logger.debug("String_Node_Str",name);
      query.bind("String_Node_Str",name);
    }
    if (offset != null && !offset.isEmpty()) {
      logger.debug("String_Node_Str",offset);
      try {
        query.bind("String_Node_Str",Hex.decodeHex(offset.toCharArray()));
      }
 catch (      DecoderException e) {
        throw Exceptions.badRequest("String_Node_Str" + offset,e);
      }
    }
    DimensionQueries.bindDimensionsToQuery(query,dimensions);
    return query.list();
  }
 }

Fixed version (ground truth):
private List<Map<String,Object>> executeMetricDefsQuery(String tenantId,String name,Map<String,String> dimensions,String offset,int limit){
  String namePart="String_Node_Str";
  if (name != null && !name.isEmpty()) {
    namePart="String_Node_Str";
  }
  String offsetPart="String_Node_Str";
  if (offset != null && !offset.isEmpty()) {
    offsetPart="String_Node_Str";
  }
  String limitPart="String_Node_Str" + Integer.toString(limit + 1);
  String defSubSelect=String.format(METRIC_DEFINITIONS_SUB_SELECT,MetricQueries.buildJoinClauseFor(dimensions,TABLE_TO_JOIN_DIMENSIONS_ON),namePart,offsetPart,limitPart);
  String sql=String.format(FIND_METRIC_DEFS_SQL,defSubSelect);
  try (Handle h=db.open()){
    Query<Map<String,Object>> query=h.createQuery(sql).bind("String_Node_Str",tenantId);
    if (name != null && !name.isEmpty()) {
      logger.debug("String_Node_Str",name);
      query.bind("String_Node_Str",name);
    }
    if (offset != null && !offset.isEmpty()) {
      logger.debug("String_Node_Str",offset);
      try {
        query.bind("String_Node_Str",Hex.decodeHex(offset.toCharArray()));
      }
 catch (      DecoderException e) {
        throw Exceptions.badRequest("String_Node_Str" + offset,e);
      }
    }
    DimensionQueries.bindDimensionsToQuery(query,dimensions);
    return query.list();
  }
 }
Program: 168647
Project: 168647
Buggy source:
static String buildJoinClauseFor(Map<String,String> dimensions){
  StringBuilder sb=null;
  if (dimensions != null) {
    sb=new StringBuilder();
    for (int i=0; i < dimensions.size(); i++) {
      sb.append("String_Node_Str").append(i).append("String_Node_Str").append(i).append("String_Node_Str").append(i).append("String_Node_Str").append(i).append("String_Node_Str" + "String_Node_Str").append(i).append("String_Node_Str").append(i).append("String_Node_Str");
    }
  }
  return sb == null ? "String_Node_Str" : sb.toString();
}

Fixed version (ground truth):
static String buildJoinClauseFor(Map<String,String> dimensions,String tableToJoinName){
  StringBuilder sb=null;
  if (dimensions != null) {
    sb=new StringBuilder();
    for (int i=0; i < dimensions.size(); i++) {
      sb.append("String_Node_Str").append(i).append("String_Node_Str").append(i).append("String_Node_Str").append(i).append("String_Node_Str").append(i).append("String_Node_Str" + "String_Node_Str").append(i).append("String_Node_Str" + tableToJoinName + "String_Node_Str").append(i).append("String_Node_Str");
    }
  }
  return sb == null ? "String_Node_Str" : sb.toString();
}
Program: 168648
Project: 168648
Buggy source:
private Map<byte[],Statistics> findDefIds(Handle h,String tenantId,String name,Map<String,String> dimensions){
  List<byte[]> bytes=new ArrayList<>();
  StringBuilder sb=new StringBuilder();
  if (name != null && !name.isEmpty()) {
    sb.append("String_Node_Str");
  }
  String sql=String.format(FIND_BY_METRIC_DEF_SQL,MetricQueries.buildJoinClauseFor(dimensions),sb);
  Query<Map<String,Object>> query=h.createQuery(sql).bind("String_Node_Str",tenantId);
  if (name != null && !name.isEmpty()) {
    logger.debug("String_Node_Str",name);
    query.bind("String_Node_Str",name);
  }
  DimensionQueries.bindDimensionsToQuery(query,dimensions);
  List<Map<String,Object>> rows=query.list();
  Map<byte[],Statistics> byteIdMap=new HashMap<>();
  byte[] currentDefDimId=null;
  Map<String,String> dims=null;
  for (  Map<String,Object> row : rows) {
    byte[] defDimId=(byte[])row.get("String_Node_Str");
    String defName=(String)row.get("String_Node_Str");
    String dimName=(String)row.get("String_Node_Str");
    String dimValue=(String)row.get("String_Node_Str");
    if (defDimId == null || !Arrays.equals(currentDefDimId,defDimId)) {
      currentDefDimId=defDimId;
      dims=new HashMap<>();
      dims.put(dimName,dimValue);
      Statistics statistics=new Statistics();
      statistics.setName(defName);
      statistics.setDimensions(dims);
      byteIdMap.put(currentDefDimId,statistics);
    }
 else {
      dims.put(dimName,dimValue);
    }
  }
  bytes.add(currentDefDimId);
  return byteIdMap;
}

Fixed version (ground truth):
private Map<byte[],Statistics> findDefIds(Handle h,String tenantId,String name,Map<String,String> dimensions){
  List<byte[]> bytes=new ArrayList<>();
  StringBuilder sb=new StringBuilder();
  if (name != null && !name.isEmpty()) {
    sb.append("String_Node_Str");
  }
  String sql=String.format(FIND_BY_METRIC_DEF_SQL,MetricQueries.buildJoinClauseFor(dimensions,TABLE_TO_JOIN_DIMENSIONS_ON),sb);
  Query<Map<String,Object>> query=h.createQuery(sql).bind("String_Node_Str",tenantId);
  if (name != null && !name.isEmpty()) {
    logger.debug("String_Node_Str",name);
    query.bind("String_Node_Str",name);
  }
  DimensionQueries.bindDimensionsToQuery(query,dimensions);
  List<Map<String,Object>> rows=query.list();
  Map<byte[],Statistics> byteIdMap=new HashMap<>();
  byte[] currentDefDimId=null;
  Map<String,String> dims=null;
  for (  Map<String,Object> row : rows) {
    byte[] defDimId=(byte[])row.get("String_Node_Str");
    String defName=(String)row.get("String_Node_Str");
    String dimName=(String)row.get("String_Node_Str");
    String dimValue=(String)row.get("String_Node_Str");
    if (defDimId == null || !Arrays.equals(currentDefDimId,defDimId)) {
      currentDefDimId=defDimId;
      dims=new HashMap<>();
      dims.put(dimName,dimValue);
      Statistics statistics=new Statistics();
      statistics.setName(defName);
      statistics.setDimensions(dims);
      byteIdMap.put(currentDefDimId,statistics);
    }
 else {
      dims.put(dimName,dimValue);
    }
  }
  bytes.add(currentDefDimId);
  return byteIdMap;
}
Program: 168649
Project: 168649
Buggy source:
public void metricQueriesBuildJoinClauseForTest3(){
  String expectedResult="String_Node_Str";
  Map<String,String> dimsMap=null;
  assertEquals(expectedResult,MetricQueries.buildJoinClauseFor(dimsMap));
}

Fixed version (ground truth):
public void metricQueriesBuildJoinClauseForTest3(){
  String expectedResult="String_Node_Str";
  Map<String,String> dimsMap=null;
  assertEquals(expectedResult,MetricQueries.buildJoinClauseFor(dimsMap,TABLE_TO_JOIN_DIMENSIONS_ON));
}
Program: 168650
Project: 168650
Buggy source:
public void metricQueriesBuildJoinClauseForTest2(){
  String expectedResult="String_Node_Str";
  Map<String,String> dimsMap=new HashMap<>();
  assertEquals(expectedResult,MetricQueries.buildJoinClauseFor(dimsMap));
}

Fixed version (ground truth):
public void metricQueriesBuildJoinClauseForTest2(){
  String expectedResult="String_Node_Str";
  Map<String,String> dimsMap=new HashMap<>();
  assertEquals(expectedResult,MetricQueries.buildJoinClauseFor(dimsMap,TABLE_TO_JOIN_DIMENSIONS_ON));
}
Program: 168651
Project: 168651
Buggy source:
public void metricQueriesBuildJoinClauseForTest1(){
  String expectedResult="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  Map<String,String> dimsMap=new HashMap<>();
  dimsMap.put("String_Node_Str","String_Node_Str");
  dimsMap.put("String_Node_Str","String_Node_Str");
  String s=MetricQueries.buildJoinClauseFor(dimsMap);
  assertEquals(expectedResult,s);
}

Fixed version (ground truth):
public void metricQueriesBuildJoinClauseForTest1(){
  String expectedResult="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  Map<String,String> dimsMap=new HashMap<>();
  dimsMap.put("String_Node_Str","String_Node_Str");
  dimsMap.put("String_Node_Str","String_Node_Str");
  String s=MetricQueries.buildJoinClauseFor(dimsMap,TABLE_TO_JOIN_DIMENSIONS_ON);
  assertEquals(expectedResult,s);
}
Program: 168652
Project: 168652
Buggy source:
private AlarmStateHistory getAlarmStateHistory(Map<String,Object> row){
  AlarmStateHistory alarmStateHistory=new AlarmStateHistory();
  Date date;
  try {
    date=parseTimestamp(((Timestamp)row.get("String_Node_Str")).toString() + "String_Node_Str");
  }
 catch (  ParseException e) {
    logger.error("String_Node_Str",e);
    return null;
  }
  DateTime dateTime=new DateTime(date.getTime(),DateTimeZone.UTC);
  alarmStateHistory.setTimestamp(dateTime);
  alarmStateHistory.setAlarmId((String)row.get("String_Node_Str"));
  List<MetricDefinition> metricDefinitionList;
  try {
    metricDefinitionList=this.objectMapper.readValue((String)row.get("String_Node_Str"),METRICS_TYPE);
  }
 catch (  IOException e) {
    logger.error("String_Node_Str",e);
    metricDefinitionList=new ArrayList<>();
  }
  alarmStateHistory.setMetrics(metricDefinitionList);
  alarmStateHistory.setOldState(AlarmState.valueOf((String)row.get("String_Node_Str")));
  alarmStateHistory.setNewState(AlarmState.valueOf((String)row.get("String_Node_Str")));
  alarmStateHistory.setReason((String)row.get("String_Node_Str"));
  alarmStateHistory.setReasonData((String)row.get("String_Node_Str"));
  List<AlarmTransitionSubAlarm> subAlarmList;
  try {
    subAlarmList=this.objectMapper.readValue((String)row.get("String_Node_Str"),SUB_ALARMS_TYPE);
  }
 catch (  IOException e) {
    logger.error("String_Node_Str",e);
    subAlarmList=new ArrayList<>();
  }
  alarmStateHistory.setSubAlarms(subAlarmList);
  return alarmStateHistory;
}

Fixed version (ground truth):
private AlarmStateHistory getAlarmStateHistory(Map<String,Object> row){
  AlarmStateHistory alarmStateHistory=new AlarmStateHistory();
  Date date;
  try {
    date=parseTimestamp(row.get("String_Node_Str").toString() + "String_Node_Str");
  }
 catch (  ParseException e) {
    logger.error("String_Node_Str",e);
    return null;
  }
  DateTime dateTime=new DateTime(date.getTime(),DateTimeZone.UTC);
  alarmStateHistory.setTimestamp(dateTime);
  alarmStateHistory.setAlarmId((String)row.get("String_Node_Str"));
  List<MetricDefinition> metricDefinitionList;
  try {
    metricDefinitionList=this.objectMapper.readValue((String)row.get("String_Node_Str"),METRICS_TYPE);
  }
 catch (  IOException e) {
    logger.error("String_Node_Str",e);
    metricDefinitionList=new ArrayList<>();
  }
  alarmStateHistory.setMetrics(metricDefinitionList);
  alarmStateHistory.setOldState(AlarmState.valueOf((String)row.get("String_Node_Str")));
  alarmStateHistory.setNewState(AlarmState.valueOf((String)row.get("String_Node_Str")));
  alarmStateHistory.setReason((String)row.get("String_Node_Str"));
  alarmStateHistory.setReasonData((String)row.get("String_Node_Str"));
  List<AlarmTransitionSubAlarm> subAlarmList;
  try {
    subAlarmList=this.objectMapper.readValue((String)row.get("String_Node_Str"),SUB_ALARMS_TYPE);
  }
 catch (  IOException e) {
    logger.error("String_Node_Str",e);
    subAlarmList=new ArrayList<>();
  }
  alarmStateHistory.setSubAlarms(subAlarmList);
  return alarmStateHistory;
}
Program: 168653
Project: 168653
Buggy source:
private Date parseTimestamp(String timestampString) throws ParseException {
  try {
    return this.simpleDateFormat.parse(timestampString);
  }
 catch (  ParseException pe) {
    return this.oldSimpleDateFormat.parse(timestampString);
  }
}

Fixed version (ground truth):
private Date parseTimestamp(String timestampString) throws ParseException {
  try {
    return this.simpleDateFormat.parse(timestampString);
  }
 catch (  ParseException pe0) {
    try {
      return this.simpleDateFormatOneMilli.parse(timestampString);
    }
 catch (    ParseException pe1) {
      return this.oldSimpleDateFormat.parse(timestampString);
    }
  }
}
Program: 168654
Project: 168654
Buggy source:
private Alarm findAlarm(String tenantId,String alarmId,Handle h){
  final String sql=String.format(ALARM_SQL,"String_Node_Str","String_Node_Str");
  final List<Map<String,Object>> rows=h.createQuery(sql).bind("String_Node_Str",alarmId).bind("String_Node_Str",tenantId).list();
  if (rows.isEmpty()) {
    throw new EntityNotFoundException("String_Node_Str",alarmId);
  }
  return createAlarms(tenantId,rows).get(0);
}

Fixed version (ground truth):
private Alarm findAlarm(String tenantId,String alarmId,Handle h){
  final String sql=String.format(FIND_ALARM_BY_ID_SQL,"String_Node_Str","String_Node_Str");
  final List<Map<String,Object>> rows=h.createQuery(sql).bind("String_Node_Str",alarmId).bind("String_Node_Str",tenantId).list();
  if (rows.isEmpty()) {
    throw new EntityNotFoundException("String_Node_Str",alarmId);
  }
  return createAlarms(tenantId,rows).get(0);
}
Program: 168656
Project: 168656
Buggy source:
@GET @Timed @Produces(MediaType.APPLICATION_JSON) public Object get(@Context UriInfo uriInfo,@HeaderParam("String_Node_Str") String tenantId,@QueryParam("String_Node_Str") String name,@QueryParam("String_Node_Str") String dimensionsStr,@QueryParam("String_Node_Str") String startTimeStr,@QueryParam("String_Node_Str") String endTimeStr,@QueryParam("String_Node_Str") String offset,@QueryParam("String_Node_Str") String limit,@QueryParam("String_Node_Str") Boolean mergeMetricsFlag) throws Exception {
  DateTime startTime=Validation.parseAndValidateDate(startTimeStr,"String_Node_Str",true);
  DateTime endTime=Validation.parseAndValidateDate(endTimeStr,"String_Node_Str",false);
  Validation.validateTimes(startTime,endTime);
  Map<String,String> dimensions=Strings.isNullOrEmpty(dimensionsStr) ? null : Validation.parseAndValidateNameAndDimensions(name,dimensionsStr,true);
  return Links.paginateMeasurements(this.persistUtils.getLimit(limit),repo.find(tenantId,name,dimensions,startTime,endTime,offset,this.persistUtils.getLimit(limit),mergeMetricsFlag),uriInfo);
}

Fixed version (ground truth):
@GET @Timed @Produces(MediaType.APPLICATION_JSON) public Object get(@Context UriInfo uriInfo,@HeaderParam("String_Node_Str") String tenantId,@QueryParam("String_Node_Str") String name,@QueryParam("String_Node_Str") String dimensionsStr,@QueryParam("String_Node_Str") String startTimeStr,@QueryParam("String_Node_Str") String endTimeStr,@QueryParam("String_Node_Str") String offset,@QueryParam("String_Node_Str") String limit,@QueryParam("String_Node_Str") String mergeMetricsFlag) throws Exception {
  DateTime startTime=Validation.parseAndValidateDate(startTimeStr,"String_Node_Str",true);
  DateTime endTime=Validation.parseAndValidateDate(endTimeStr,"String_Node_Str",false);
  Validation.validateTimes(startTime,endTime);
  Map<String,String> dimensions=Strings.isNullOrEmpty(dimensionsStr) ? null : Validation.parseAndValidateNameAndDimensions(name,dimensionsStr,true);
  Boolean mergeMetricsFlagBool=Validation.validateAndParseMergeMetricsFlag(mergeMetricsFlag);
  return Links.paginateMeasurements(this.persistUtils.getLimit(limit),repo.find(tenantId,name,dimensions,startTime,endTime,offset,this.persistUtils.getLimit(limit),mergeMetricsFlagBool),uriInfo);
}
Program: 168657
Project: 168657
Buggy source:
@GET @Timed @Produces(MediaType.APPLICATION_JSON) public Object get(@Context UriInfo uriInfo,@HeaderParam("String_Node_Str") String tenantId,@QueryParam("String_Node_Str") String name,@QueryParam("String_Node_Str") String dimensionsStr,@QueryParam("String_Node_Str") String startTimeStr,@QueryParam("String_Node_Str") String endTimeStr,@QueryParam("String_Node_Str") String statisticsStr,@DefaultValue("String_Node_Str") @QueryParam("String_Node_Str") String periodStr,@QueryParam("String_Node_Str") String offset,@QueryParam("String_Node_Str") String limit,@QueryParam("String_Node_Str") Boolean mergeMetricsFlag) throws Exception {
  DateTime startTime=Validation.parseAndValidateDate(startTimeStr,"String_Node_Str",true);
  DateTime endTime=Validation.parseAndValidateDate(endTimeStr,"String_Node_Str",false);
  Validation.validateTimes(startTime,endTime);
  Validation.validateNotNullOrEmpty(statisticsStr,"String_Node_Str");
  int period=Validation.parseAndValidateNumber(periodStr,"String_Node_Str");
  List<String> statistics=Validation.parseValidateAndNormalizeStatistics(COMMA_SPLITTER.split(statisticsStr));
  Map<String,String> dimensions=Strings.isNullOrEmpty(dimensionsStr) ? null : Validation.parseAndValidateNameAndDimensions(name,dimensionsStr,true);
  return Links.paginateStatistics(this.persistUtils.getLimit(limit),repo.find(tenantId,name,dimensions,startTime,endTime,statistics,period,offset,this.persistUtils.getLimit(limit),mergeMetricsFlag),uriInfo);
}

Fixed version (ground truth):
@GET @Timed @Produces(MediaType.APPLICATION_JSON) public Object get(@Context UriInfo uriInfo,@HeaderParam("String_Node_Str") String tenantId,@QueryParam("String_Node_Str") String name,@QueryParam("String_Node_Str") String dimensionsStr,@QueryParam("String_Node_Str") String startTimeStr,@QueryParam("String_Node_Str") String endTimeStr,@QueryParam("String_Node_Str") String statisticsStr,@DefaultValue("String_Node_Str") @QueryParam("String_Node_Str") String periodStr,@QueryParam("String_Node_Str") String offset,@QueryParam("String_Node_Str") String limit,@QueryParam("String_Node_Str") String mergeMetricsFlag) throws Exception {
  DateTime startTime=Validation.parseAndValidateDate(startTimeStr,"String_Node_Str",true);
  DateTime endTime=Validation.parseAndValidateDate(endTimeStr,"String_Node_Str",false);
  Validation.validateTimes(startTime,endTime);
  Validation.validateNotNullOrEmpty(statisticsStr,"String_Node_Str");
  int period=Validation.parseAndValidateNumber(periodStr,"String_Node_Str");
  List<String> statistics=Validation.parseValidateAndNormalizeStatistics(COMMA_SPLITTER.split(statisticsStr));
  Map<String,String> dimensions=Strings.isNullOrEmpty(dimensionsStr) ? null : Validation.parseAndValidateNameAndDimensions(name,dimensionsStr,true);
  Boolean mergeMetricsFlagBool=Validation.validateAndParseMergeMetricsFlag(mergeMetricsFlag);
  return Links.paginateStatistics(this.persistUtils.getLimit(limit),repo.find(tenantId,name,dimensions,startTime,endTime,statistics,period,offset,this.persistUtils.getLimit(limit),mergeMetricsFlagBool),uriInfo);
}
Program: 168658
Project: 168658
Buggy source:
public String privateRegionPart(String region) throws Exception {
  if (region == null || region.isEmpty()) {
    throw new Exception(String.format("String_Node_Str",region));
  }
  return "String_Node_Str" + "String_Node_Str" + sanitize(region) + "String_Node_Str";
}

Fixed version (ground truth):
public String privateRegionPart(String region){
  if (region == null || region.isEmpty()) {
    throw new IllegalArgumentException(String.format("String_Node_Str",region));
  }
  return "String_Node_Str" + "String_Node_Str" + sanitize(region) + "String_Node_Str";
}
Program: 168659
Project: 168659
Buggy source:
public String namePart(String name,boolean isRequired) throws Exception {
  if (isRequired) {
    if (name == null || name.isEmpty()) {
      throw new Exception(String.format("String_Node_Str",name));
    }
  }
  if (name == null || name.isEmpty()) {
    return "String_Node_Str";
  }
 else {
    return String.format("String_Node_Str",sanitize(name));
  }
}

Fixed version (ground truth):
public String namePart(String name,boolean isRequired){
  if (isRequired) {
    if (name == null || name.isEmpty()) {
      throw new IllegalArgumentException(String.format("String_Node_Str",name));
    }
  }
  if (name == null || name.isEmpty()) {
    return "String_Node_Str";
  }
 else {
    return String.format("String_Node_Str",sanitize(name));
  }
}
Program: 168660
Project: 168660
Buggy source:
public String publicTenantIdPart(String tenantId) throws Exception {
  if (tenantId == null || tenantId.isEmpty()) {
    throw new Exception(String.format("String_Node_Str",tenantId));
  }
  return "String_Node_Str" + "String_Node_Str" + sanitize(tenantId) + "String_Node_Str";
}

Fixed version (ground truth):
public String publicTenantIdPart(String tenantId){
  if (tenantId == null || tenantId.isEmpty()) {
    throw new IllegalArgumentException(String.format("String_Node_Str",tenantId));
  }
  return "String_Node_Str" + "String_Node_Str" + sanitize(tenantId) + "String_Node_Str";
}
Program: 168661
Project: 168661
Buggy source:
public int startIndex(String offset){
  if (offset == null || offset.isEmpty()) {
    return 0;
  }
  return Integer.parseInt(offset) + 1;
}

Fixed version (ground truth):
public int startIndex(String offset){
  if (offset == null || offset.isEmpty()) {
    return 0;
  }
  int intOffset;
  try {
    intOffset=Integer.parseInt(offset);
  }
 catch (  NumberFormatException nfe) {
    throw new IllegalArgumentException(String.format("String_Node_Str",offset));
  }
  if (intOffset < 0) {
    throw new IllegalArgumentException(String.format("String_Node_Str",offset));
  }
  return intOffset + 1;
}
Program: 168662
Project: 168662
Buggy source:
public String privateTenantIdPart(String tenantId) throws Exception {
  if (tenantId == null || tenantId.isEmpty()) {
    throw new Exception(String.format("String_Node_Str",tenantId));
  }
  return "String_Node_Str" + "String_Node_Str" + sanitize(tenantId) + "String_Node_Str";
}

Fixed version (ground truth):
public String privateTenantIdPart(String tenantId){
  if (tenantId == null || tenantId.isEmpty()) {
    throw new IllegalArgumentException(String.format("String_Node_Str",tenantId));
  }
  return "String_Node_Str" + "String_Node_Str" + sanitize(tenantId) + "String_Node_Str";
}
Program: 168663
Project: 168663
Buggy source:
public String dimPart(Map<String,String> dims) throws Exception {
  StringBuilder sb=new StringBuilder();
  if (dims != null && !dims.isEmpty()) {
    for (    String k : dims.keySet()) {
      String v=dims.get(k);
      if (k != null && !k.isEmpty() && v != null && !v.isEmpty()) {
        sb.append("String_Node_Str" + sanitize(k) + "String_Node_Str"+ "String_Node_Str"+ sanitize(v)+ "String_Node_Str");
      }
    }
  }
  return sb.toString();
}

Fixed version (ground truth):
public String dimPart(Map<String,String> dims){
  StringBuilder sb=new StringBuilder();
  if (dims != null && !dims.isEmpty()) {
    for (    String k : dims.keySet()) {
      String v=dims.get(k);
      if (k != null && !k.isEmpty() && v != null && !v.isEmpty()) {
        sb.append("String_Node_Str" + sanitize(k) + "String_Node_Str"+ "String_Node_Str"+ sanitize(v)+ "String_Node_Str");
      }
    }
  }
  return sb.toString();
}
Program: 168664
Project: 168664
Buggy source:
public String sanitize(final String taintedString) throws Exception {
  Matcher m=sqlUnsafePattern.matcher(taintedString);
  if (m.matches()) {
    throw new Exception(String.format("String_Node_Str" + "String_Node_Str",taintedString));
  }
  return taintedString;
}

Fixed version (ground truth):
public String sanitize(final String taintedString){
  Matcher m=sqlUnsafePattern.matcher(taintedString);
  if (m.matches()) {
    throw new IllegalArgumentException(String.format("String_Node_Str" + "String_Node_Str",taintedString));
  }
  return taintedString;
}
Program: 168665
Project: 168665
Buggy source:
@GET @Timed @Produces(MediaType.APPLICATION_JSON) public Object get(@Context UriInfo uriInfo,@HeaderParam("String_Node_Str") String tenantId,@QueryParam("String_Node_Str") String name,@QueryParam("String_Node_Str") String dimensionsStr,@QueryParam("String_Node_Str") String startTimeStr,@QueryParam("String_Node_Str") String endTimeStr,@QueryParam("String_Node_Str") String offset,@QueryParam("String_Node_Str") String limit,@QueryParam("String_Node_Str") Boolean mergeMetricsFlag) throws Exception {
  DateTime startTime=Validation.parseAndValidateDate(startTimeStr,"String_Node_Str",true);
  DateTime endTime=Validation.parseAndValidateDate(endTimeStr,"String_Node_Str",false);
  Validation.validateTimes(startTime,endTime);
  Map<String,String> dimensions=Strings.isNullOrEmpty(dimensionsStr) ? null : Validation.parseAndValidateNameAndDimensions(name,dimensionsStr,true);
  return Links.paginateMeasurements(this.persistUtils.getLimit(limit),repo.find(tenantId,name,dimensions,startTime,endTime,offset,this.persistUtils.getLimit(limit),mergeMetricsFlag),uriInfo);
}

Fixed version (ground truth):
@GET @Timed @Produces(MediaType.APPLICATION_JSON) public Object get(@Context UriInfo uriInfo,@HeaderParam("String_Node_Str") String tenantId,@QueryParam("String_Node_Str") String name,@QueryParam("String_Node_Str") String dimensionsStr,@QueryParam("String_Node_Str") String startTimeStr,@QueryParam("String_Node_Str") String endTimeStr,@QueryParam("String_Node_Str") String offset,@QueryParam("String_Node_Str") String limit,@QueryParam("String_Node_Str") String mergeMetricsFlag) throws Exception {
  DateTime startTime=Validation.parseAndValidateDate(startTimeStr,"String_Node_Str",true);
  DateTime endTime=Validation.parseAndValidateDate(endTimeStr,"String_Node_Str",false);
  Validation.validateTimes(startTime,endTime);
  Map<String,String> dimensions=Strings.isNullOrEmpty(dimensionsStr) ? null : Validation.parseAndValidateNameAndDimensions(name,dimensionsStr,true);
  Boolean mergeMetricsFlagBool=Validation.validateAndParseMergeMetricsFlag(mergeMetricsFlag);
  return Links.paginateMeasurements(this.persistUtils.getLimit(limit),repo.find(tenantId,name,dimensions,startTime,endTime,offset,this.persistUtils.getLimit(limit),mergeMetricsFlagBool),uriInfo);
}
Program: 168666
Project: 168666
Buggy source:
@GET @Timed @Produces(MediaType.APPLICATION_JSON) public Object get(@Context UriInfo uriInfo,@HeaderParam("String_Node_Str") String tenantId,@QueryParam("String_Node_Str") String name,@QueryParam("String_Node_Str") String dimensionsStr,@QueryParam("String_Node_Str") String startTimeStr,@QueryParam("String_Node_Str") String endTimeStr,@QueryParam("String_Node_Str") String statisticsStr,@DefaultValue("String_Node_Str") @QueryParam("String_Node_Str") String periodStr,@QueryParam("String_Node_Str") String offset,@QueryParam("String_Node_Str") String limit,@QueryParam("String_Node_Str") Boolean mergeMetricsFlag) throws Exception {
  DateTime startTime=Validation.parseAndValidateDate(startTimeStr,"String_Node_Str",true);
  DateTime endTime=Validation.parseAndValidateDate(endTimeStr,"String_Node_Str",false);
  Validation.validateTimes(startTime,endTime);
  Validation.validateNotNullOrEmpty(statisticsStr,"String_Node_Str");
  int period=Validation.parseAndValidateNumber(periodStr,"String_Node_Str");
  List<String> statistics=Validation.parseValidateAndNormalizeStatistics(COMMA_SPLITTER.split(statisticsStr));
  Map<String,String> dimensions=Strings.isNullOrEmpty(dimensionsStr) ? null : Validation.parseAndValidateNameAndDimensions(name,dimensionsStr,true);
  return Links.paginateStatistics(this.persistUtils.getLimit(limit),repo.find(tenantId,name,dimensions,startTime,endTime,statistics,period,offset,this.persistUtils.getLimit(limit),mergeMetricsFlag),uriInfo);
}

Fixed version (ground truth):
@GET @Timed @Produces(MediaType.APPLICATION_JSON) public Object get(@Context UriInfo uriInfo,@HeaderParam("String_Node_Str") String tenantId,@QueryParam("String_Node_Str") String name,@QueryParam("String_Node_Str") String dimensionsStr,@QueryParam("String_Node_Str") String startTimeStr,@QueryParam("String_Node_Str") String endTimeStr,@QueryParam("String_Node_Str") String statisticsStr,@DefaultValue("String_Node_Str") @QueryParam("String_Node_Str") String periodStr,@QueryParam("String_Node_Str") String offset,@QueryParam("String_Node_Str") String limit,@QueryParam("String_Node_Str") String mergeMetricsFlag) throws Exception {
  DateTime startTime=Validation.parseAndValidateDate(startTimeStr,"String_Node_Str",true);
  DateTime endTime=Validation.parseAndValidateDate(endTimeStr,"String_Node_Str",false);
  Validation.validateTimes(startTime,endTime);
  Validation.validateNotNullOrEmpty(statisticsStr,"String_Node_Str");
  int period=Validation.parseAndValidateNumber(periodStr,"String_Node_Str");
  List<String> statistics=Validation.parseValidateAndNormalizeStatistics(COMMA_SPLITTER.split(statisticsStr));
  Map<String,String> dimensions=Strings.isNullOrEmpty(dimensionsStr) ? null : Validation.parseAndValidateNameAndDimensions(name,dimensionsStr,true);
  Boolean mergeMetricsFlagBool=Validation.validateAndParseMergeMetricsFlag(mergeMetricsFlag);
  return Links.paginateStatistics(this.persistUtils.getLimit(limit),repo.find(tenantId,name,dimensions,startTime,endTime,statistics,period,offset,this.persistUtils.getLimit(limit),mergeMetricsFlagBool),uriInfo);
}
Program: 168667
Project: 168667
Buggy source:
public String privateRegionPart(String region) throws Exception {
  if (region == null || region.isEmpty()) {
    throw new Exception(String.format("String_Node_Str",region));
  }
  return "String_Node_Str" + "String_Node_Str" + sanitize(region) + "String_Node_Str";
}

Fixed version (ground truth):
public String privateRegionPart(String region){
  if (region == null || region.isEmpty()) {
    throw new IllegalArgumentException(String.format("String_Node_Str",region));
  }
  return "String_Node_Str" + "String_Node_Str" + sanitize(region) + "String_Node_Str";
}
Program: 168668
Project: 168668
Buggy source:
public String namePart(String name,boolean isRequired) throws Exception {
  if (isRequired) {
    if (name == null || name.isEmpty()) {
      throw new Exception(String.format("String_Node_Str",name));
    }
  }
  if (name == null || name.isEmpty()) {
    return "String_Node_Str";
  }
 else {
    return String.format("String_Node_Str",sanitize(name));
  }
}

Fixed version (ground truth):
public String namePart(String name,boolean isRequired){
  if (isRequired) {
    if (name == null || name.isEmpty()) {
      throw new IllegalArgumentException(String.format("String_Node_Str",name));
    }
  }
  if (name == null || name.isEmpty()) {
    return "String_Node_Str";
  }
 else {
    return String.format("String_Node_Str",sanitize(name));
  }
}
Program: 168669
Project: 168669
Buggy source:
public String publicTenantIdPart(String tenantId) throws Exception {
  if (tenantId == null || tenantId.isEmpty()) {
    throw new Exception(String.format("String_Node_Str",tenantId));
  }
  return "String_Node_Str" + "String_Node_Str" + sanitize(tenantId) + "String_Node_Str";
}

Fixed version (ground truth):
public String publicTenantIdPart(String tenantId){
  if (tenantId == null || tenantId.isEmpty()) {
    throw new IllegalArgumentException(String.format("String_Node_Str",tenantId));
  }
  return "String_Node_Str" + "String_Node_Str" + sanitize(tenantId) + "String_Node_Str";
}
Program: 168670
Project: 168670
Buggy source:
public int startIndex(String offset){
  if (offset == null || offset.isEmpty()) {
    return 0;
  }
  return Integer.parseInt(offset) + 1;
}

Fixed version (ground truth):
public int startIndex(String offset){
  if (offset == null || offset.isEmpty()) {
    return 0;
  }
  int intOffset;
  try {
    intOffset=Integer.parseInt(offset);
  }
 catch (  NumberFormatException nfe) {
    throw new IllegalArgumentException(String.format("String_Node_Str",offset));
  }
  if (intOffset < 0) {
    throw new IllegalArgumentException(String.format("String_Node_Str",offset));
  }
  return intOffset + 1;
}
Program: 168671
Project: 168671
Buggy source:
public String privateTenantIdPart(String tenantId) throws Exception {
  if (tenantId == null || tenantId.isEmpty()) {
    throw new Exception(String.format("String_Node_Str",tenantId));
  }
  return "String_Node_Str" + "String_Node_Str" + sanitize(tenantId) + "String_Node_Str";
}

Fixed version (ground truth):
public String privateTenantIdPart(String tenantId){
  if (tenantId == null || tenantId.isEmpty()) {
    throw new IllegalArgumentException(String.format("String_Node_Str",tenantId));
  }
  return "String_Node_Str" + "String_Node_Str" + sanitize(tenantId) + "String_Node_Str";
}
Program: 168672
Project: 168672
Buggy source:
public String dimPart(Map<String,String> dims) throws Exception {
  StringBuilder sb=new StringBuilder();
  if (dims != null && !dims.isEmpty()) {
    for (    String k : dims.keySet()) {
      String v=dims.get(k);
      if (k != null && !k.isEmpty() && v != null && !v.isEmpty()) {
        sb.append("String_Node_Str" + sanitize(k) + "String_Node_Str"+ "String_Node_Str"+ sanitize(v)+ "String_Node_Str");
      }
    }
  }
  return sb.toString();
}

Fixed version (ground truth):
public String dimPart(Map<String,String> dims){
  StringBuilder sb=new StringBuilder();
  if (dims != null && !dims.isEmpty()) {
    for (    String k : dims.keySet()) {
      String v=dims.get(k);
      if (k != null && !k.isEmpty() && v != null && !v.isEmpty()) {
        sb.append("String_Node_Str" + sanitize(k) + "String_Node_Str"+ "String_Node_Str"+ sanitize(v)+ "String_Node_Str");
      }
    }
  }
  return sb.toString();
}
Program: 168673
Project: 168673
Buggy source:
public String sanitize(final String taintedString) throws Exception {
  Matcher m=sqlUnsafePattern.matcher(taintedString);
  if (m.matches()) {
    throw new Exception(String.format("String_Node_Str" + "String_Node_Str",taintedString));
  }
  return taintedString;
}

Fixed version (ground truth):
public String sanitize(final String taintedString){
  Matcher m=sqlUnsafePattern.matcher(taintedString);
  if (m.matches()) {
    throw new IllegalArgumentException(String.format("String_Node_Str" + "String_Node_Str",taintedString));
  }
  return taintedString;
}
Program: 168674
Project: 168674
Buggy source:
public int getLimit(String limit){
  if (limit == null || limit.isEmpty()) {
    return this.maxQueryLimit;
  }
  int limitInt;
  try {
    limitInt=Integer.parseInt(limit);
  }
 catch (  NumberFormatException e) {
    throw new IllegalArgumentException(String.format("String_Node_Str",limit));
  }
  if (limitInt <= this.maxQueryLimit) {
    return limitInt;
  }
 else {
    return this.maxQueryLimit;
  }
}

Fixed version (ground truth):
public int getLimit(String limit){
  if (limit == null || limit.isEmpty()) {
    return this.maxQueryLimit;
  }
  int limitInt;
  try {
    limitInt=Integer.parseInt(limit);
  }
 catch (  NumberFormatException e) {
    throw new IllegalArgumentException(String.format("String_Node_Str",limit));
  }
  if (limitInt <= 0) {
    throw new IllegalArgumentException(String.format("String_Node_Str",limit));
  }
  if (limitInt <= this.maxQueryLimit) {
    return limitInt;
  }
 else {
    return this.maxQueryLimit;
  }
}
Program: 168675
Project: 168675
Buggy source:
public int getLimit(String limit){
  if (limit == null || limit.isEmpty()) {
    return this.maxQueryLimit;
  }
  int limitInt;
  try {
    limitInt=Integer.parseInt(limit);
  }
 catch (  NumberFormatException e) {
    throw new IllegalArgumentException(String.format("String_Node_Str",limit));
  }
  if (limitInt <= this.maxQueryLimit) {
    return limitInt;
  }
 else {
    return this.maxQueryLimit;
  }
}

Fixed version (ground truth):
public int getLimit(String limit){
  if (limit == null || limit.isEmpty()) {
    return this.maxQueryLimit;
  }
  int limitInt;
  try {
    limitInt=Integer.parseInt(limit);
  }
 catch (  NumberFormatException e) {
    throw new IllegalArgumentException(String.format("String_Node_Str",limit));
  }
  if (limitInt <= 0) {
    throw new IllegalArgumentException(String.format("String_Node_Str",limit));
  }
  if (limitInt <= this.maxQueryLimit) {
    return limitInt;
  }
 else {
    return this.maxQueryLimit;
  }
}
Program: 168676
Project: 168676
Buggy source:
@Override public List<AlarmStateHistory> find(String tenantId,Map<String,String> dimensions,DateTime startTime,@Nullable DateTime endTime,@Nullable String offset,int limit) throws Exception {
  List<String> alarmIdList=findAlarmIds(this.mysql,tenantId,dimensions);
  if (alarmIdList == null || alarmIdList.isEmpty()) {
    return new ArrayList<>();
  }
  String q=String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",this.influxV9Utils.tenantIdPart(tenantId),this.influxV9Utils.startTimeEndTimePart(startTime,endTime),this.influxV9Utils.alarmIdsPart(alarmIdList),this.influxV9Utils.timeOffsetPart(offset),this.influxV9Utils.limitPart(limit));
  logger.debug("String_Node_Str",q);
  String r=this.influxV9RepoReader.read(q);
  Series series=this.objectMapper.readValue(r,Series.class);
  List<AlarmStateHistory> alarmStateHistoryList=alarmStateHistoryList(series);
  logger.debug("String_Node_Str",alarmStateHistoryList.size());
  return alarmStateHistoryList;
}

Fixed version (ground truth):
@Override public List<AlarmStateHistory> find(String tenantId,Map<String,String> dimensions,DateTime startTime,@Nullable DateTime endTime,@Nullable String offset,int limit) throws Exception {
  List<String> alarmIdList=findAlarmIds(this.mysql,tenantId,dimensions);
  if (alarmIdList == null || alarmIdList.isEmpty()) {
    return new ArrayList<>();
  }
  String q=String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",this.influxV9Utils.publicTenantIdPart(tenantId),this.influxV9Utils.startTimeEndTimePart(startTime,endTime),this.influxV9Utils.alarmIdsPart(alarmIdList),this.influxV9Utils.timeOffsetPart(offset),this.influxV9Utils.limitPart(limit));
  logger.debug("String_Node_Str",q);
  String r=this.influxV9RepoReader.read(q);
  Series series=this.objectMapper.readValue(r,Series.class);
  List<AlarmStateHistory> alarmStateHistoryList=alarmStateHistoryList(series);
  logger.debug("String_Node_Str",alarmStateHistoryList.size());
  return alarmStateHistoryList;
}
Program: 168677
Project: 168677
Buggy source:
@Override public List<AlarmStateHistory> findById(String tenantId,String alarmId,String offset,int limit) throws Exception {
  String q=String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",this.influxV9Utils.tenantIdPart(tenantId),this.influxV9Utils.alarmIdPart(alarmId),this.influxV9Utils.timeOffsetPart(offset),this.influxV9Utils.limitPart(limit));
  logger.debug("String_Node_Str",q);
  String r=this.influxV9RepoReader.read(q);
  Series series=this.objectMapper.readValue(r,Series.class);
  List<AlarmStateHistory> alarmStateHistoryList=alarmStateHistoryList(series);
  logger.debug("String_Node_Str",alarmStateHistoryList.size());
  return alarmStateHistoryList;
}

Fixed version (ground truth):
@Override public List<AlarmStateHistory> findById(String tenantId,String alarmId,String offset,int limit) throws Exception {
  String q=String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",this.influxV9Utils.publicTenantIdPart(tenantId),this.influxV9Utils.alarmIdPart(alarmId),this.influxV9Utils.timeOffsetPart(offset),this.influxV9Utils.limitPart(limit));
  logger.debug("String_Node_Str",q);
  String r=this.influxV9RepoReader.read(q);
  Series series=this.objectMapper.readValue(r,Series.class);
  List<AlarmStateHistory> alarmStateHistoryList=alarmStateHistoryList(series);
  logger.debug("String_Node_Str",alarmStateHistoryList.size());
  return alarmStateHistoryList;
}