Program: 168624
Project: 168624
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,List<String> sortBy,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");
  }
  StringBuilder sortByClause=new StringBuilder();
  if (sortBy != null && !sortBy.isEmpty()) {
    sortByClause.append("String_Node_Str");
    sortByClause.append(COMMA_JOINER.join(sortBy));
    if (sortByClause.indexOf("String_Node_Str") == -1) {
      sortByClause.append("String_Node_Str");
    }
    sortByClause.append(' ');
  }
 else {
    sortByClause.append("String_Node_Str");
  }
  if (enforceLimit && limit > 0) {
    sbWhere.append("String_Node_Str");
  }
  if (offset != null) {
    sbWhere.append("String_Node_Str");
    sbWhere.append(offset);
    sbWhere.append(' ');
  }
  sbWhere.append("String_Node_Str");
  String sql=String.format(FIND_ALARMS_SQL,sbWhere,sortByClause);
  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());
    }
    if (enforceLimit && limit > 0) {
      q.bind("String_Node_Str",limit + 1);
    }
    DimensionQueries.bindDimensionsToQuery(q,metricDimensions);
    final List<Map<String,Object>> rows=q.list();
    return createAlarms(tenantId,rows);
  }
 }

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,List<String> sortBy,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");
  }
  StringBuilder orderClause=new StringBuilder();
  if (sortBy != null && !sortBy.isEmpty()) {
    replaceFieldName(sortBy,"String_Node_Str","String_Node_Str");
    replaceFieldName(sortBy,"String_Node_Str","String_Node_Str");
    replaceFieldName(sortBy,"String_Node_Str","String_Node_Str");
    replaceFieldName(sortBy,"String_Node_Str","String_Node_Str");
    replaceFieldName(sortBy,"String_Node_Str","String_Node_Str");
    replaceFieldName(sortBy,"String_Node_Str","String_Node_Str");
    orderClause.append("String_Node_Str");
    orderClause.append(COMMA_JOINER.join(sortBy));
    if (orderClause.indexOf("String_Node_Str") == -1) {
      orderClause.append("String_Node_Str");
    }
    orderClause.append(' ');
  }
 else {
    orderClause.append("String_Node_Str");
  }
  sbWhere.append(orderClause);
  if (enforceLimit && limit > 0) {
    sbWhere.append("String_Node_Str");
  }
  if (offset != null) {
    sbWhere.append("String_Node_Str");
    sbWhere.append(offset);
    sbWhere.append(' ');
  }
  sbWhere.append("String_Node_Str");
  String sql=String.format(FIND_ALARMS_SQL,sbWhere,orderClause);
  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());
    }
    if (enforceLimit && limit > 0) {
      q.bind("String_Node_Str",limit + 1);
    }
    DimensionQueries.bindDimensionsToQuery(q,metricDimensions);
    final List<Map<String,Object>> rows=q.list();
    return createAlarms(tenantId,rows);
  }
 }