Program: 144245
Project: 144245
Buggy source:
public ClinicalDocument buildHistoryOfPastIllnessSection(ClinicalDocument cd){
  Section section=CDAFactory.eINSTANCE.createSection();
  HistoryOfPastIllnessSection ccs=new HistoryOfPastIllnessSection();
  section.getTemplateIds().add(buildTemplateID(ccs.getTemplateid(),null,null));
  section.setCode(buildCodeCE(ccs.getCode(),ccs.getCodeSystem(),ccs.getSectionName(),ccs.getCodeSystemName()));
  section.setTitle(buildTitle(ccs.getSectionDescription()));
  StrucDocText text=CDAFactory.eINSTANCE.createStrucDocText();
  text.addText("String_Node_Str");
  section.setText(text);
  Entry e=CDAFactory.eINSTANCE.createEntry();
  Act act=CDAFactory.eINSTANCE.createAct();
  act.setClassCode(x_ActClassDocumentEntryAct.ACT);
  act.setMoodCode(x_DocumentActMood.EVN);
  act.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  act.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  act.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  act.getIds().add(buildID("String_Node_Str",null));
  CD code=DatatypesFactory.eINSTANCE.createCD();
  CS cs=DatatypesFactory.eINSTANCE.createCS();
  cs.setCode("String_Node_Str");
  code.setNullFlavor(NullFlavor.NA);
  act.setCode(code);
  act.setStatusCode(cs);
  IVL_TS effectiveTime=DatatypesFactory.eINSTANCE.createIVL_TS();
  IVXB_TS low=DatatypesFactory.eINSTANCE.createIVXB_TS();
  low.setValue("String_Node_Str");
  IVXB_TS high=DatatypesFactory.eINSTANCE.createIVXB_TS();
  high.setValue("String_Node_Str");
  effectiveTime.setLow(low);
  effectiveTime.setLow(high);
  act.setEffectiveTime(effectiveTime);
  EntryRelationship entryRelationship1=CDAFactory.eINSTANCE.createEntryRelationship();
  entryRelationship1.setTypeCode(x_ActRelationshipEntryRelationship.SUBJ);
  entryRelationship1.setInversionInd(false);
  Observation observation1=CDAFactory.eINSTANCE.createObservation();
  observation1.setClassCode(ActClassObservation.OBS);
  observation1.setMoodCode(x_ActMoodDocumentObservation.EVN);
  observation1.setNegationInd(false);
  observation1.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  observation1.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  observation1.getIds().add(buildID("String_Node_Str",null));
  observation1.setCode(buildCodeCD("String_Node_Str","String_Node_Str",null,null));
  cs.setCode("String_Node_Str");
  observation1.setStatusCode(cs);
  IVL_TS effectiveTime1=DatatypesFactory.eINSTANCE.createIVL_TS();
  IVXB_TS low1=DatatypesFactory.eINSTANCE.createIVXB_TS();
  low1.setNullFlavor(NullFlavor.UNK);
  observation1.setEffectiveTime(effectiveTime1);
  CD codecd=DatatypesFactory.eINSTANCE.createCD();
  codecd.setCode("String_Node_Str");
  codecd.setCodeSystem("String_Node_Str");
  codecd.setDisplayName("String_Node_Str");
  codecd.setCodeSystemName("String_Node_Str");
  observation1.getValues().add(codecd);
  entryRelationship1.setObservation(observation1);
  EntryRelationship entryRelationship2=CDAFactory.eINSTANCE.createEntryRelationship();
  entryRelationship2.setTypeCode(x_ActRelationshipEntryRelationship.REFR);
  entryRelationship2.setInversionInd(false);
  Observation observation2=CDAFactory.eINSTANCE.createObservation();
  observation2.setClassCode(ActClassObservation.OBS);
  observation2.setMoodCode(x_ActMoodDocumentObservation.EVN);
  observation2.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  observation2.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  observation2.setCode(buildCodeCD("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  observation2.setText(buildEDText("String_Node_Str"));
  observation2.setStatusCode(cs);
  observation2.getValues().add(buildCodeCE("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  entryRelationship2.setObservation(observation2);
  EntryRelationship entryRelationship3=CDAFactory.eINSTANCE.createEntryRelationship();
  entryRelationship3.setTypeCode(x_ActRelationshipEntryRelationship.SUBJ);
  entryRelationship3.setInversionInd(true);
  Observation observation3=CDAFactory.eINSTANCE.createObservation();
  observation3.setClassCode(ActClassObservation.OBS);
  observation3.setMoodCode(x_ActMoodDocumentObservation.EVN);
  observation3.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  observation3.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  observation3.setCode(buildCodeCD("String_Node_Str","String_Node_Str",null,null));
  observation3.setText(buildEDText("String_Node_Str"));
  observation3.setStatusCode(cs);
  observation3.getValues().add(buildCodeCD("String_Node_Str","String_Node_Str",null,null));
  entryRelationship3.setObservation(observation3);
  EntryRelationship entryRelationship4=CDAFactory.eINSTANCE.createEntryRelationship();
  entryRelationship4.setTypeCode(x_ActRelationshipEntryRelationship.REFR);
  Observation observation4=CDAFactory.eINSTANCE.createObservation();
  observation4.setClassCode(ActClassObservation.OBS);
  observation4.setMoodCode(x_ActMoodDocumentObservation.EVN);
  observation4.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  observation4.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  observation4.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  observation4.setCode(buildCodeCE("String_Node_Str","String_Node_Str",null,null));
  observation4.setText(buildEDText("String_Node_Str"));
  observation4.setStatusCode(cs);
  observation4.getValues().add(buildCodeCE("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  entryRelationship4.setObservation(observation4);
  EntryRelationship entryRelationship5=CDAFactory.eINSTANCE.createEntryRelationship();
  Act act1=CDAFactory.eINSTANCE.createAct();
  act1.setClassCode(x_ActClassDocumentEntryAct.ACT);
  act1.setMoodCode(x_DocumentActMood.EVN);
  act1.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  act1.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  act1.setCode(buildCodeCD("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  act1.setText(buildEDText("String_Node_Str"));
  act1.setStatusCode(cs);
  Author author=CDAFactory.eINSTANCE.createAuthor();
  author.setTime(buildEffectiveTime(new Date()));
  AssignedAuthor assignedAuthor=CDAFactory.eINSTANCE.createAssignedAuthor();
  AD assignedAuthorAddress=DatatypesFactory.eINSTANCE.createAD();
  assignedAuthorAddress.addCountry("String_Node_Str");
  TEL assignedAuthorTelecon=DatatypesFactory.eINSTANCE.createTEL();
  assignedAuthorTelecon.setNullFlavor(NullFlavor.UNK);
  assignedAuthor.getAddrs().add(assignedAuthorAddress);
  assignedAuthor.getTelecoms().add(assignedAuthorTelecon);
  Person assignedPerson=CDAFactory.eINSTANCE.createPerson();
  PN assignedPersonName=DatatypesFactory.eINSTANCE.createPN();
  assignedPerson.getNames().add(assignedPersonName);
  assignedAuthor.setAssignedPerson(assignedPerson);
  Organization representedOrganization=CDAFactory.eINSTANCE.createOrganization();
  ON representedOrganizationName=DatatypesFactory.eINSTANCE.createON();
  representedOrganizationName.addText(Context.getAdministrationService().getImplementationId().getName());
  representedOrganization.getNames().add(representedOrganizationName);
  AD representedOrganizationAddress=DatatypesFactory.eINSTANCE.createAD();
  representedOrganizationAddress.addCounty("String_Node_Str");
  representedOrganization.getAddrs().add(representedOrganizationAddress);
  TEL representedOrganizationTelecon=DatatypesFactory.eINSTANCE.createTEL();
  representedOrganizationTelecon.setNullFlavor(NullFlavor.UNK);
  representedOrganization.getTelecoms().add(representedOrganizationTelecon);
  assignedAuthor.setRepresentedOrganization(representedOrganization);
  author.setAssignedAuthor(assignedAuthor);
  act1.getAuthors().add(author);
  entryRelationship5.setAct(act1);
  EntryRelationship entryRelationship6=CDAFactory.eINSTANCE.createEntryRelationship();
  entryRelationship6.setTypeCode(x_ActRelationshipEntryRelationship.SUBJ);
  Observation observation5=CDAFactory.eINSTANCE.createObservation();
  observation5.setClassCode(ActClassObservation.OBS);
  observation5.setMoodCode(x_ActMoodDocumentObservation.EVN);
  observation5.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  observation5.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  entryRelationship6.setObservation(observation5);
  act.getEntryRelationships().add(entryRelationship1);
  act.getEntryRelationships().add(entryRelationship2);
  act.getEntryRelationships().add(entryRelationship3);
  act.getEntryRelationships().add(entryRelationship4);
  act.getEntryRelationships().add(entryRelationship5);
  act.getEntryRelationships().add(entryRelationship6);
  e.setAct(act);
  section.getEntries().add(e);
  cd.addSection(section);
  return cd;
}

Fixed version (ground truth):
public ClinicalDocument buildHistoryOfPastIllnessSection(ClinicalDocument cd){
  Section section=CDAFactory.eINSTANCE.createSection();
  HistoryOfPastIllnessSection ccs=new HistoryOfPastIllnessSection();
  section.getTemplateIds().add(buildTemplateID(ccs.getTemplateid(),null,null));
  section.setCode(buildCodeCE(ccs.getCode(),ccs.getCodeSystem(),ccs.getSectionName(),ccs.getCodeSystemName()));
  section.setTitle(buildTitle(ccs.getSectionDescription()));
  StrucDocText text=CDAFactory.eINSTANCE.createStrucDocText();
  text.addText("String_Node_Str");
  section.setText(text);
  Entry e=CDAFactory.eINSTANCE.createEntry();
  Act act=CDAFactory.eINSTANCE.createAct();
  act.setClassCode(x_ActClassDocumentEntryAct.ACT);
  act.setMoodCode(x_DocumentActMood.EVN);
  act.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  act.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  act.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  act.getIds().add(buildID("String_Node_Str",null));
  CD code=DatatypesFactory.eINSTANCE.createCD();
  CS cs=DatatypesFactory.eINSTANCE.createCS();
  cs.setCode("String_Node_Str");
  code.setNullFlavor(NullFlavor.NA);
  act.setCode(code);
  act.setStatusCode(cs);
  IVL_TS effectiveTime=DatatypesFactory.eINSTANCE.createIVL_TS();
  IVXB_TS low=DatatypesFactory.eINSTANCE.createIVXB_TS();
  low.setValue("String_Node_Str");
  IVXB_TS high=DatatypesFactory.eINSTANCE.createIVXB_TS();
  high.setValue("String_Node_Str");
  effectiveTime.setLow(low);
  effectiveTime.setLow(high);
  act.setEffectiveTime(effectiveTime);
  EntryRelationship entryRelationship1=CDAFactory.eINSTANCE.createEntryRelationship();
  entryRelationship1.setTypeCode(x_ActRelationshipEntryRelationship.SUBJ);
  entryRelationship1.setInversionInd(false);
  Observation observation1=CDAFactory.eINSTANCE.createObservation();
  observation1.setClassCode(ActClassObservation.OBS);
  observation1.setMoodCode(x_ActMoodDocumentObservation.EVN);
  observation1.setNegationInd(false);
  observation1.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  observation1.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  observation1.getIds().add(buildID("String_Node_Str",null));
  observation1.setCode(buildCodeCD("String_Node_Str","String_Node_Str",null,null));
  cs.setCode("String_Node_Str");
  observation1.setStatusCode(cs);
  IVL_TS effectiveTime1=DatatypesFactory.eINSTANCE.createIVL_TS();
  IVXB_TS low1=DatatypesFactory.eINSTANCE.createIVXB_TS();
  low1.setNullFlavor(NullFlavor.UNK);
  observation1.setEffectiveTime(effectiveTime1);
  CD codecd=DatatypesFactory.eINSTANCE.createCD();
  codecd.setCode("String_Node_Str");
  codecd.setCodeSystem("String_Node_Str");
  codecd.setDisplayName("String_Node_Str");
  codecd.setCodeSystemName("String_Node_Str");
  observation1.getValues().add(codecd);
  entryRelationship1.setObservation(observation1);
  EntryRelationship entryRelationship2=CDAFactory.eINSTANCE.createEntryRelationship();
  entryRelationship2.setTypeCode(x_ActRelationshipEntryRelationship.REFR);
  entryRelationship2.setInversionInd(false);
  Observation observation2=CDAFactory.eINSTANCE.createObservation();
  observation2.setClassCode(ActClassObservation.OBS);
  observation2.setMoodCode(x_ActMoodDocumentObservation.EVN);
  observation2.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  observation2.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  observation2.setCode(buildCodeCD("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  observation2.setText(buildEDText("String_Node_Str"));
  observation2.setStatusCode(cs);
  observation2.getValues().add(buildCodeCE("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  entryRelationship2.setObservation(observation2);
  EntryRelationship entryRelationship3=CDAFactory.eINSTANCE.createEntryRelationship();
  entryRelationship3.setTypeCode(x_ActRelationshipEntryRelationship.SUBJ);
  entryRelationship3.setInversionInd(true);
  Observation observation3=CDAFactory.eINSTANCE.createObservation();
  observation3.setClassCode(ActClassObservation.OBS);
  observation3.setMoodCode(x_ActMoodDocumentObservation.EVN);
  observation3.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  observation3.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  observation3.setCode(buildCodeCD("String_Node_Str","String_Node_Str",null,null));
  observation3.setText(buildEDText("String_Node_Str"));
  observation3.setStatusCode(cs);
  observation3.getValues().add(buildCodeCD("String_Node_Str","String_Node_Str",null,null));
  entryRelationship3.setObservation(observation3);
  EntryRelationship entryRelationship4=CDAFactory.eINSTANCE.createEntryRelationship();
  entryRelationship4.setTypeCode(x_ActRelationshipEntryRelationship.REFR);
  Observation observation4=CDAFactory.eINSTANCE.createObservation();
  observation4.setClassCode(ActClassObservation.OBS);
  observation4.setMoodCode(x_ActMoodDocumentObservation.EVN);
  observation4.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  observation4.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  observation4.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  observation4.setCode(buildCodeCE("String_Node_Str","String_Node_Str",null,null));
  observation4.setText(buildEDText("String_Node_Str"));
  observation4.setStatusCode(cs);
  observation4.getValues().add(buildCodeCE("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  entryRelationship4.setObservation(observation4);
  EntryRelationship entryRelationship5=CDAFactory.eINSTANCE.createEntryRelationship();
  entryRelationship5.setTypeCode(x_ActRelationshipEntryRelationship.SUBJ);
  Act act1=CDAFactory.eINSTANCE.createAct();
  act1.setClassCode(x_ActClassDocumentEntryAct.ACT);
  act1.setMoodCode(x_DocumentActMood.EVN);
  act1.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  act1.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  act1.setCode(buildCodeCD("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  act1.setText(buildEDText("String_Node_Str"));
  act1.setStatusCode(cs);
  Author author=CDAFactory.eINSTANCE.createAuthor();
  author.setTime(buildEffectiveTime(new Date()));
  AssignedAuthor assignedAuthor=CDAFactory.eINSTANCE.createAssignedAuthor();
  II authorId=DatatypesFactory.eINSTANCE.createII();
  authorId.setRoot(Context.getAdministrationService().getImplementationId().getImplementationId());
  assignedAuthor.getIds().add(authorId);
  AD assignedAuthorAddress=DatatypesFactory.eINSTANCE.createAD();
  assignedAuthorAddress.addCountry("String_Node_Str");
  TEL assignedAuthorTelecon=DatatypesFactory.eINSTANCE.createTEL();
  assignedAuthorTelecon.setNullFlavor(NullFlavor.UNK);
  assignedAuthor.getAddrs().add(assignedAuthorAddress);
  assignedAuthor.getTelecoms().add(assignedAuthorTelecon);
  Person assignedPerson=CDAFactory.eINSTANCE.createPerson();
  PN assignedPersonName=DatatypesFactory.eINSTANCE.createPN();
  assignedPerson.getNames().add(assignedPersonName);
  assignedAuthor.setAssignedPerson(assignedPerson);
  Organization representedOrganization=CDAFactory.eINSTANCE.createOrganization();
  ON representedOrganizationName=DatatypesFactory.eINSTANCE.createON();
  representedOrganizationName.addText(Context.getAdministrationService().getImplementationId().getName());
  representedOrganization.getNames().add(representedOrganizationName);
  AD representedOrganizationAddress=DatatypesFactory.eINSTANCE.createAD();
  representedOrganizationAddress.addCounty("String_Node_Str");
  representedOrganization.getAddrs().add(representedOrganizationAddress);
  TEL representedOrganizationTelecon=DatatypesFactory.eINSTANCE.createTEL();
  representedOrganizationTelecon.setNullFlavor(NullFlavor.UNK);
  representedOrganization.getTelecoms().add(representedOrganizationTelecon);
  assignedAuthor.setRepresentedOrganization(representedOrganization);
  author.setAssignedAuthor(assignedAuthor);
  act1.getAuthors().add(author);
  entryRelationship5.setAct(act1);
  EntryRelationship entryRelationship6=CDAFactory.eINSTANCE.createEntryRelationship();
  entryRelationship6.setTypeCode(x_ActRelationshipEntryRelationship.SUBJ);
  Observation observation5=CDAFactory.eINSTANCE.createObservation();
  observation5.setClassCode(ActClassObservation.OBS);
  observation5.setMoodCode(x_ActMoodDocumentObservation.EVN);
  observation5.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  observation5.getTemplateIds().add(buildTemplateID("String_Node_Str",null,null));
  entryRelationship6.setObservation(observation5);
  act.getEntryRelationships().add(entryRelationship1);
  act.getEntryRelationships().add(entryRelationship2);
  act.getEntryRelationships().add(entryRelationship3);
  act.getEntryRelationships().add(entryRelationship4);
  act.getEntryRelationships().add(entryRelationship5);
  act.getEntryRelationships().add(entryRelationship6);
  e.setAct(act);
  section.getEntries().add(e);
  cd.addSection(section);
  return cd;
}