Program: 168641
Project: 168641
Buggy source:
@Override public List<Alarm> find(String tenantId,String alarmDefId,String metricName,Map<String,String> metricDimensions,AlarmState state,String lifecycleState,String link,DateTime stateUpdatedStart,String offset,int limit,boolean enforceLimit){
  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" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
      buildJoinClauseFor(metricDimensions,sbWhere);
      sbWhere.append("String_Node_Str");
    }
    if (state != null) {
      sbWhere.append("String_Node_Str");
    }
    if (lifecycleState != null) {
      sbWhere.append("String_Node_Str");
    }
    if (link != null) {
      sbWhere.append("String_Node_Str");
    }
    if (stateUpdatedStart != null) {
      sbWhere.append("String_Node_Str");
    }
    if (offset != null) {
      sbWhere.append("String_Node_Str");
    }
    String limitPart="String_Node_Str";
    if (enforceLimit && limit > 0) {
      limitPart="String_Node_Str";
    }
    String sql=String.format(ALARM_SQL,sbWhere,limitPart);
    final Query<Map<String,Object>> 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());
    }
    if (lifecycleState != null) {
      q.bind("String_Node_Str",lifecycleState);
    }
    if (link != null) {
      q.bind("String_Node_Str",link);
    }
    if (stateUpdatedStart != null) {
      q.bind("String_Node_Str",stateUpdatedStart.toString().replace('Z',' '));
    }
    if (offset != null) {
      q.bind("String_Node_Str",offset);
    }
    if (enforceLimit && limit > 0) {
      q.bind("String_Node_Str",limit + 1);
    }
    DimensionQueries.bindDimensionsToQuery(q,metricDimensions);
    final long start=System.currentTimeMillis();
    final List<Map<String,Object>> rows=q.list();
    logger.debug("String_Node_Str",System.currentTimeMillis() - start);
    final List<Alarm> alarms=createAlarms(tenantId,rows);
    return alarms;
  }
 }

Fixed version (ground truth):
@Override public List<Alarm> find(String tenantId,String alarmDefId,String metricName,Map<String,String> metricDimensions,AlarmState state,String lifecycleState,String link,DateTime stateUpdatedStart,String offset,int limit,boolean enforceLimit){
  StringBuilder sbWhere=new StringBuilder("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  if (alarmDefId != null) {
    sbWhere.append("String_Node_Str");
  }
  if (metricName != null) {
    sbWhere.append("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    buildJoinClauseFor(metricDimensions,sbWhere);
    sbWhere.append("String_Node_Str");
  }
 else   if (metricDimensions != null) {
    sbWhere.append("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
    buildJoinClauseFor(metricDimensions,sbWhere);
    sbWhere.append("String_Node_Str");
  }
  if (state != null) {
    sbWhere.append("String_Node_Str");
  }
  if (lifecycleState != null) {
    sbWhere.append("String_Node_Str");
  }
  if (link != null) {
    sbWhere.append("String_Node_Str");
  }
  if (stateUpdatedStart != null) {
    sbWhere.append("String_Node_Str");
  }
  if (offset != null) {
    sbWhere.append("String_Node_Str");
  }
  sbWhere.append("String_Node_Str");
  if (enforceLimit && limit > 0) {
    sbWhere.append("String_Node_Str");
  }
  sbWhere.append("String_Node_Str");
  String sql=String.format(FIND_ALARMS_SQL,sbWhere);
  try (Handle h=db.open()){
    final Query<Map<String,Object>> 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());
    }
    if (lifecycleState != null) {
      q.bind("String_Node_Str",lifecycleState);
    }
    if (link != null) {
      q.bind("String_Node_Str",link);
    }
    if (stateUpdatedStart != null) {
      q.bind("String_Node_Str",stateUpdatedStart.toString().replace('Z',' '));
    }
    if (offset != null) {
      q.bind("String_Node_Str",offset);
    }
    if (enforceLimit && limit > 0) {
      q.bind("String_Node_Str",limit + 1);
    }
    DimensionQueries.bindDimensionsToQuery(q,metricDimensions);
    final List<Map<String,Object>> rows=q.list();
    final List<Alarm> alarms=createAlarms(tenantId,rows);
    return alarms;
  }
 }