Program: 188329
Project: 188329
Buggy source:
public static IndexedAIP solrDocumentToIndexedAIP(SolrDocument doc){
  final String id=objectToString(doc.get(RodaConstants.INDEX_UUID),null);
  AIPState state=null;
  if (doc.containsKey(RodaConstants.STATE)) {
    state=AIPState.valueOf(objectToString(doc.get(RodaConstants.STATE),AIPState.getDefault().toString()));
  }
  final String parentId=objectToString(doc.get(RodaConstants.AIP_PARENT_ID),null);
  final List<String> ingestSIPIds=objectToListString(doc.get(RodaConstants.INGEST_SIP_IDS));
  final String ingestJobId=objectToString(doc.get(RodaConstants.INGEST_JOB_ID),"String_Node_Str");
  final List<String> ingestUpdateJobIds=objectToListString(doc.get(RodaConstants.INGEST_UPDATE_JOB_IDS));
  final List<String> ancestors=objectToListString(doc.get(RodaConstants.AIP_ANCESTORS));
  final List<String> levels=objectToListString(doc.get(RodaConstants.AIP_LEVEL));
  final List<String> titles=objectToListString(doc.get(RodaConstants.AIP_TITLE));
  final List<String> descriptions=objectToListString(doc.get(RodaConstants.AIP_DESCRIPTION));
  final Date dateInitial=objectToDate(doc.get(RodaConstants.AIP_DATE_INITIAL));
  final Date dateFinal=objectToDate(doc.get(RodaConstants.AIP_DATE_FINAL));
  final Long numberOfSubmissionFiles=objectToLong(doc.get(RodaConstants.AIP_NUMBER_OF_SUBMISSION_FILES),0L);
  final Long numberOfDocumentationFiles=objectToLong(doc.get(RodaConstants.AIP_NUMBER_OF_DOCUMENTATION_FILES),0L);
  final Long numberOfSchemaFiles=objectToLong(doc.get(RodaConstants.AIP_NUMBER_OF_SCHEMA_FILES),0L);
  final Boolean hasRepresentations=objectToBoolean(doc.get(RodaConstants.AIP_HAS_REPRESENTATIONS),Boolean.FALSE);
  final Boolean ghost=objectToBoolean(doc.get(RodaConstants.AIP_GHOST),Boolean.FALSE);
  Permissions permissions=getPermissions(doc);
  final String title=titles.isEmpty() ? null : titles.get(0);
  final String description=descriptions.isEmpty() ? null : descriptions.get(0);
  String level;
  if (ghost) {
    level=RodaConstants.AIP_GHOST;
  }
 else   level=levels.isEmpty() ? null : levels.get(0);
  return new IndexedAIP(id,state,level,title,dateInitial,dateFinal,description,parentId,ancestors,permissions,numberOfSubmissionFiles,numberOfDocumentationFiles,numberOfSchemaFiles,hasRepresentations,ghost).setIngestSIPIds(ingestSIPIds).setIngestJobId(ingestJobId).setIngestUpdateJobIds(ingestUpdateJobIds);
}

Fixed version (ground truth):
public static IndexedAIP solrDocumentToIndexedAIP(SolrDocument doc){
  final String id=objectToString(doc.get(RodaConstants.INDEX_UUID),null);
  AIPState state=null;
  if (doc.containsKey(RodaConstants.STATE)) {
    state=AIPState.valueOf(objectToString(doc.get(RodaConstants.STATE),AIPState.getDefault().toString()));
  }
  final String parentId=objectToString(doc.get(RodaConstants.AIP_PARENT_ID),null);
  final List<String> ingestSIPIds=objectToListString(doc.get(RodaConstants.INGEST_SIP_IDS));
  final String ingestJobId=objectToString(doc.get(RodaConstants.INGEST_JOB_ID),"String_Node_Str");
  final List<String> ingestUpdateJobIds=objectToListString(doc.get(RodaConstants.INGEST_UPDATE_JOB_IDS));
  final List<String> ancestors=objectToListString(doc.get(RodaConstants.AIP_ANCESTORS));
  final List<String> levels=objectToListString(doc.get(RodaConstants.AIP_LEVEL));
  final List<String> titles=objectToListString(doc.get(RodaConstants.AIP_TITLE));
  final List<String> descriptions=objectToListString(doc.get(RodaConstants.AIP_DESCRIPTION));
  final Date dateInitial=objectToDate(doc.get(RodaConstants.AIP_DATE_INITIAL));
  final Date dateFinal=objectToDate(doc.get(RodaConstants.AIP_DATE_FINAL));
  final Long numberOfSubmissionFiles=objectToLong(doc.get(RodaConstants.AIP_NUMBER_OF_SUBMISSION_FILES),0L);
  final Long numberOfDocumentationFiles=objectToLong(doc.get(RodaConstants.AIP_NUMBER_OF_DOCUMENTATION_FILES),0L);
  final Long numberOfSchemaFiles=objectToLong(doc.get(RodaConstants.AIP_NUMBER_OF_SCHEMA_FILES),0L);
  final Boolean hasRepresentations=objectToBoolean(doc.get(RodaConstants.AIP_HAS_REPRESENTATIONS),Boolean.FALSE);
  final Boolean ghost=objectToBoolean(doc.get(RodaConstants.AIP_GHOST),Boolean.FALSE);
  Permissions permissions=getPermissions(doc);
  final String title=titles.isEmpty() ? null : titles.get(0);
  final String description=descriptions.isEmpty() ? null : descriptions.get(0);
  String level;
  if (ghost) {
    level=RodaConstants.AIP_GHOST;
  }
 else {
    level=levels.isEmpty() ? null : levels.get(0);
  }
  return new IndexedAIP(id,state,level,title,dateInitial,dateFinal,description,parentId,ancestors,permissions,numberOfSubmissionFiles,numberOfDocumentationFiles,numberOfSchemaFiles,hasRepresentations,ghost).setIngestSIPIds(ingestSIPIds).setIngestJobId(ingestJobId).setIngestUpdateJobIds(ingestUpdateJobIds);
}