Program: 188201
Project: 188201
Buggy source:
public static SolrInputDocument riskToSolrDocument(Risk risk,int incidences){
  SolrInputDocument doc=new SolrInputDocument();
  doc.addField(RodaConstants.INDEX_UUID,risk.getId());
  doc.addField(RodaConstants.RISK_ID,risk.getId());
  doc.addField(RodaConstants.RISK_NAME,risk.getName());
  doc.addField(RodaConstants.RISK_DESCRIPTION,risk.getDescription());
  doc.addField(RodaConstants.RISK_IDENTIFIED_ON,risk.getIdentifiedOn());
  doc.addField(RodaConstants.RISK_IDENTIFIED_BY,risk.getIdentifiedBy());
  doc.addField(RodaConstants.RISK_CATEGORY,risk.getCategory());
  doc.addField(RodaConstants.RISK_NOTES,risk.getNotes());
  doc.addField(RodaConstants.RISK_PRE_MITIGATION_PROBABILITY,risk.getPreMitigationProbability());
  doc.addField(RodaConstants.RISK_PRE_MITIGATION_IMPACT,risk.getPreMitigationImpact());
  doc.addField(RodaConstants.RISK_PRE_MITIGATION_SEVERITY,risk.getPreMitigationSeverity());
  doc.addField(RodaConstants.RISK_PRE_MITIGATION_SEVERITY_LEVEL,risk.getPreMitigationSeverityLevel().toString());
  doc.addField(RodaConstants.RISK_PRE_MITIGATION_NOTES,risk.getPreMitigationNotes());
  doc.addField(RodaConstants.RISK_POST_MITIGATION_PROBABILITY,risk.getPostMitigationProbability());
  doc.addField(RodaConstants.RISK_POST_MITIGATION_IMPACT,risk.getPostMitigationImpact());
  doc.addField(RodaConstants.RISK_POST_MITIGATION_SEVERITY,risk.getPostMitigationSeverity());
  if (risk.getPostMitigationSeverityLevel() != null) {
    doc.addField(RodaConstants.RISK_POST_MITIGATION_SEVERITY_LEVEL,risk.getPostMitigationSeverityLevel().toString());
  }
  doc.addField(RodaConstants.RISK_CURRENT_SEVERITY_LEVEL,risk.getCurrentSeverityLevel());
  doc.addField(RodaConstants.RISK_POST_MITIGATION_NOTES,risk.getPostMitigationNotes());
  doc.addField(RodaConstants.RISK_MITIGATION_STRATEGY,risk.getMitigationStrategy());
  doc.addField(RodaConstants.RISK_MITIGATION_OWNER_TYPE,risk.getMitigationOwnerType());
  doc.addField(RodaConstants.RISK_MITIGATION_OWNER,risk.getMitigationOwner());
  doc.addField(RodaConstants.RISK_MITIGATION_RELATED_EVENT_IDENTIFIER_TYPE,risk.getMitigationRelatedEventIdentifierType());
  doc.addField(RodaConstants.RISK_MITIGATION_RELATED_EVENT_IDENTIFIER_VALUE,risk.getMitigationRelatedEventIdentifierValue());
  doc.addField(RodaConstants.RISK_CREATED_ON,risk.getCreatedOn());
  doc.addField(RodaConstants.RISK_CREATED_BY,risk.getCreatedBy());
  doc.addField(RodaConstants.RISK_UPDATED_ON,risk.getUpdatedOn());
  doc.addField(RodaConstants.RISK_UPDATED_BY,risk.getUpdatedBy());
  if (risk instanceof IndexedRisk) {
    doc.addField(RodaConstants.RISK_INCIDENCES_COUNT,((IndexedRisk)risk).getIncidencesCount());
    doc.addField(RodaConstants.RISK_UNMITIGATED_INCIDENCES_COUNT,((IndexedRisk)risk).getUnmitigatedIncidencesCount());
  }
 else {
    doc.addField(RodaConstants.RISK_INCIDENCES_COUNT,incidences);
    doc.addField(RodaConstants.RISK_UNMITIGATED_INCIDENCES_COUNT,incidences);
  }
  return doc;
}

Fixed version (ground truth):
public static SolrInputDocument riskToSolrDocument(Risk risk,int incidences){
  SolrInputDocument doc=new SolrInputDocument();
  doc.addField(RodaConstants.INDEX_UUID,risk.getId());
  doc.addField(RodaConstants.RISK_ID,risk.getId());
  doc.addField(RodaConstants.RISK_NAME,risk.getName());
  doc.addField(RodaConstants.RISK_DESCRIPTION,risk.getDescription());
  doc.addField(RodaConstants.RISK_IDENTIFIED_ON,risk.getIdentifiedOn());
  doc.addField(RodaConstants.RISK_IDENTIFIED_BY,risk.getIdentifiedBy());
  doc.addField(RodaConstants.RISK_CATEGORY,risk.getCategory());
  doc.addField(RodaConstants.RISK_NOTES,risk.getNotes());
  doc.addField(RodaConstants.RISK_PRE_MITIGATION_PROBABILITY,risk.getPreMitigationProbability());
  doc.addField(RodaConstants.RISK_PRE_MITIGATION_IMPACT,risk.getPreMitigationImpact());
  doc.addField(RodaConstants.RISK_PRE_MITIGATION_SEVERITY,risk.getPreMitigationSeverity());
  doc.addField(RodaConstants.RISK_PRE_MITIGATION_SEVERITY_LEVEL,risk.getPreMitigationSeverityLevel().toString());
  doc.addField(RodaConstants.RISK_PRE_MITIGATION_NOTES,risk.getPreMitigationNotes());
  doc.addField(RodaConstants.RISK_POST_MITIGATION_PROBABILITY,risk.getPostMitigationProbability());
  doc.addField(RodaConstants.RISK_POST_MITIGATION_IMPACT,risk.getPostMitigationImpact());
  doc.addField(RodaConstants.RISK_POST_MITIGATION_SEVERITY,risk.getPostMitigationSeverity());
  if (risk.getPostMitigationSeverityLevel() != null) {
    doc.addField(RodaConstants.RISK_POST_MITIGATION_SEVERITY_LEVEL,risk.getPostMitigationSeverityLevel().toString());
  }
  doc.addField(RodaConstants.RISK_CURRENT_SEVERITY_LEVEL,risk.getCurrentSeverityLevel().toString());
  doc.addField(RodaConstants.RISK_POST_MITIGATION_NOTES,risk.getPostMitigationNotes());
  doc.addField(RodaConstants.RISK_MITIGATION_STRATEGY,risk.getMitigationStrategy());
  doc.addField(RodaConstants.RISK_MITIGATION_OWNER_TYPE,risk.getMitigationOwnerType());
  doc.addField(RodaConstants.RISK_MITIGATION_OWNER,risk.getMitigationOwner());
  doc.addField(RodaConstants.RISK_MITIGATION_RELATED_EVENT_IDENTIFIER_TYPE,risk.getMitigationRelatedEventIdentifierType());
  doc.addField(RodaConstants.RISK_MITIGATION_RELATED_EVENT_IDENTIFIER_VALUE,risk.getMitigationRelatedEventIdentifierValue());
  doc.addField(RodaConstants.RISK_CREATED_ON,risk.getCreatedOn());
  doc.addField(RodaConstants.RISK_CREATED_BY,risk.getCreatedBy());
  doc.addField(RodaConstants.RISK_UPDATED_ON,risk.getUpdatedOn());
  doc.addField(RodaConstants.RISK_UPDATED_BY,risk.getUpdatedBy());
  if (risk instanceof IndexedRisk) {
    doc.addField(RodaConstants.RISK_INCIDENCES_COUNT,((IndexedRisk)risk).getIncidencesCount());
    doc.addField(RodaConstants.RISK_UNMITIGATED_INCIDENCES_COUNT,((IndexedRisk)risk).getUnmitigatedIncidencesCount());
  }
 else {
    doc.addField(RodaConstants.RISK_INCIDENCES_COUNT,incidences);
    doc.addField(RodaConstants.RISK_UNMITIGATED_INCIDENCES_COUNT,incidences);
  }
  return doc;
}