Program: 112208
Project: 112208
Buggy source:
private OperationOutcome doTestValidateResourceContainingProfileDeclaration(String methodName,EncodingEnum enc) throws IOException {
  Bundle vss=loadResourceFromClasspath(Bundle.class,"String_Node_Str");
  myValueSetDao.update((ValueSet)findResourceByIdInBundle(vss,"String_Node_Str"),mySrd);
  myValueSetDao.update((ValueSet)findResourceByIdInBundle(vss,"String_Node_Str"),mySrd);
  myValueSetDao.update((ValueSet)findResourceByIdInBundle(vss,"String_Node_Str"),mySrd);
  myValueSetDao.update((ValueSet)findResourceByIdInBundle(vss,"String_Node_Str"),mySrd);
  myValueSetDao.update((ValueSet)findResourceByIdInBundle(vss,"String_Node_Str"),mySrd);
  myValueSetDao.update((ValueSet)findResourceByIdInBundle(vss,"String_Node_Str"),mySrd);
  myValueSetDao.update((ValueSet)findResourceByIdInBundle(vss,"String_Node_Str"),mySrd);
  myValueSetDao.update((ValueSet)findResourceByIdInBundle(vss,"String_Node_Str"),mySrd);
  myValueSetDao.update((ValueSet)findResourceByIdInBundle(vss,"String_Node_Str"),mySrd);
  StructureDefinition sd=loadResourceFromClasspath(StructureDefinition.class,"String_Node_Str");
  sd.setId(new IdDt());
  sd.setUrl("String_Node_Str" + methodName);
  myStructureDefinitionDao.create(sd,mySrd);
  Observation input=new Observation();
  ResourceMetadataKeyEnum.PROFILES.put(input,Arrays.asList(new IdDt(sd.getUrl())));
  input.addIdentifier().setSystem("String_Node_Str").setValue("String_Node_Str");
  input.getEncounter().setReference("String_Node_Str");
  input.setStatus(ObservationStatusEnum.FINAL);
  input.getCode().addCoding().setSystem("String_Node_Str").setCode("String_Node_Str");
  String encoded=null;
  MethodOutcome outcome=null;
  ValidationModeEnum mode=ValidationModeEnum.CREATE;
switch (enc) {
case JSON:
    encoded=myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(input);
  ourLog.info(encoded);
try {
  myObservationDao.validate(input,null,encoded,EncodingEnum.JSON,mode,null,mySrd);
  fail();
}
 catch (PreconditionFailedException e) {
  return (OperationOutcome)e.getOperationOutcome();
}
case XML:
encoded=myFhirCtx.newXmlParser().encodeResourceToString(input);
try {
myObservationDao.validate(input,null,encoded,EncodingEnum.XML,mode,null,mySrd);
fail();
}
 catch (PreconditionFailedException e) {
return (OperationOutcome)e.getOperationOutcome();
}
}
throw new IllegalStateException();
}

Fixed version (ground truth):
private OperationOutcome doTestValidateResourceContainingProfileDeclaration(String methodName,EncodingEnum enc) throws IOException {
  Bundle vss=loadResourceFromClasspath(Bundle.class,"String_Node_Str");
  myValueSetDao.update((ValueSet)findResourceByIdInBundle(vss,"String_Node_Str"),mySrd);
  myValueSetDao.update((ValueSet)findResourceByIdInBundle(vss,"String_Node_Str"),mySrd);
  myValueSetDao.update((ValueSet)findResourceByIdInBundle(vss,"String_Node_Str"),mySrd);
  myValueSetDao.update((ValueSet)findResourceByIdInBundle(vss,"String_Node_Str"),mySrd);
  myValueSetDao.update((ValueSet)findResourceByIdInBundle(vss,"String_Node_Str"),mySrd);
  myValueSetDao.update((ValueSet)findResourceByIdInBundle(vss,"String_Node_Str"),mySrd);
  myValueSetDao.update((ValueSet)findResourceByIdInBundle(vss,"String_Node_Str"),mySrd);
  myValueSetDao.update((ValueSet)findResourceByIdInBundle(vss,"String_Node_Str"),mySrd);
  myValueSetDao.update((ValueSet)findResourceByIdInBundle(vss,"String_Node_Str"),mySrd);
  StructureDefinition sd=loadResourceFromClasspath(StructureDefinition.class,"String_Node_Str");
  sd.setId(new IdDt());
  sd.setUrl("String_Node_Str" + methodName);
  myStructureDefinitionDao.create(sd,mySrd);
  Observation input=new Observation();
  ResourceMetadataKeyEnum.PROFILES.put(input,Arrays.asList(new IdDt(sd.getUrl())));
  input.addIdentifier().setSystem("String_Node_Str").setValue("String_Node_Str");
  input.getEncounter().setReference("String_Node_Str");
  input.setStatus(ObservationStatusEnum.FINAL);
  input.getCode().addCoding().setSystem("String_Node_Str").setCode("String_Node_Str");
  String encoded=null;
  MethodOutcome outcome=null;
  ValidationModeEnum mode=ValidationModeEnum.CREATE;
switch (enc) {
case JSON:
    encoded=myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(input);
  ourLog.info(encoded);
try {
  myObservationDao.validate(input,null,encoded,EncodingEnum.JSON,mode,null,mySrd);
  fail();
}
 catch (PreconditionFailedException e) {
  return (OperationOutcome)e.getOperationOutcome();
}
break;
case XML:
encoded=myFhirCtx.newXmlParser().encodeResourceToString(input);
try {
myObservationDao.validate(input,null,encoded,EncodingEnum.XML,mode,null,mySrd);
fail();
}
 catch (PreconditionFailedException e) {
return (OperationOutcome)e.getOperationOutcome();
}
break;
}
throw new IllegalStateException();
}