Program: 112190
Project: 112190
Buggy source:
/** 
 * Create the jax-rs request
 * @return the jax-rs request
 */
public JaxRsRequest build(){
  JaxRsRequest result=new JaxRsRequest(myServer,myResource,myRequestType,myRestOperation);
  if ((StringUtils.isNotBlank(myVersion) || StringUtils.isNotBlank(myCompartment)) && StringUtils.isBlank(myId)) {
    throw new InvalidRequestException("String_Node_Str" + myServer.getUriInfo().getRequestUri().toASCIIString());
  }
  FhirVersionEnum fhirContextVersion=myServer.getFhirContext().getVersion().getVersion();
  if (StringUtils.isNotBlank(myVersion)) {
    if (FhirVersionEnum.DSTU3.equals(fhirContextVersion) || FhirVersionEnum.DSTU2_HL7ORG.equals(fhirContextVersion)) {
      result.setId(new IdType(myServer.getBaseForRequest(),UrlUtil.unescape(myId),UrlUtil.unescape(myVersion)));
    }
 else     if (FhirVersionEnum.DSTU2.equals(fhirContextVersion)) {
      result.setId(new IdDt(myServer.getBaseForRequest(),UrlUtil.unescape(myId),UrlUtil.unescape(myVersion)));
    }
  }
 else   if (StringUtils.isNotBlank(myId)) {
    if (FhirVersionEnum.DSTU3.equals(fhirContextVersion) || FhirVersionEnum.DSTU2_HL7ORG.equals(fhirContextVersion)) {
      result.setId(new IdType(myServer.getBaseForRequest(),UrlUtil.unescape(myId)));
    }
 else     if (FhirVersionEnum.DSTU2.equals(fhirContextVersion)) {
      result.setId(new IdDt(myServer.getBaseForRequest(),UrlUtil.unescape(myId)));
    }
  }
  if (myRestOperation == RestOperationTypeEnum.UPDATE) {
    String contentLocation=result.getHeader(Constants.HEADER_CONTENT_LOCATION);
    if (contentLocation != null) {
      if (FhirVersionEnum.DSTU3.equals(fhirContextVersion) || FhirVersionEnum.DSTU2_HL7ORG.equals(fhirContextVersion)) {
        result.setId(new IdType(contentLocation));
      }
 else       if (FhirVersionEnum.DSTU2.equals(fhirContextVersion)) {
        result.setId(new IdDt(contentLocation));
      }
    }
  }
  result.setCompartmentName(myCompartment);
  result.setCompleteUrl(myRequestUrl);
  result.setResourceName(myResourceName);
  return result;
}

Fixed version (ground truth):
/** 
 * Create the jax-rs request
 * @return the jax-rs request
 */
public JaxRsRequest build(){
  JaxRsRequest result=new JaxRsRequest(myServer,myResource,myRequestType,myRestOperation);
  if ((StringUtils.isNotBlank(myVersion) || StringUtils.isNotBlank(myCompartment)) && StringUtils.isBlank(myId)) {
    throw new InvalidRequestException("String_Node_Str" + myServer.getUriInfo().getRequestUri().toASCIIString());
  }
  FhirVersionEnum fhirContextVersion=myServer.getFhirContext().getVersion().getVersion();
  if (StringUtils.isNotBlank(myVersion)) {
switch (fhirContextVersion) {
case R4:
      result.setId(new org.hl7.fhir.r4.model.IdType(myServer.getBaseForRequest(),UrlUtil.unescape(myId),UrlUtil.unescape(myVersion)));
    break;
case DSTU3:
  result.setId(new org.hl7.fhir.dstu3.model.IdType(myServer.getBaseForRequest(),UrlUtil.unescape(myId),UrlUtil.unescape(myVersion)));
break;
case DSTU2_1:
result.setId(new org.hl7.fhir.dstu2016may.model.IdType(myServer.getBaseForRequest(),UrlUtil.unescape(myId),UrlUtil.unescape(myVersion)));
break;
case DSTU2_HL7ORG:
result.setId(new org.hl7.fhir.instance.model.IdType(myServer.getBaseForRequest(),UrlUtil.unescape(myId),UrlUtil.unescape(myVersion)));
break;
case DSTU2:
result.setId(new ca.uhn.fhir.model.primitive.IdDt(myServer.getBaseForRequest(),UrlUtil.unescape(myId),UrlUtil.unescape(myVersion)));
break;
default :
throw new ConfigurationException("String_Node_Str" + fhirContextVersion);
}
}
 else if (StringUtils.isNotBlank(myId)) {
switch (fhirContextVersion) {
case R4:
result.setId(new org.hl7.fhir.r4.model.IdType(myServer.getBaseForRequest(),UrlUtil.unescape(myId)));
break;
case DSTU3:
result.setId(new org.hl7.fhir.dstu3.model.IdType(myServer.getBaseForRequest(),UrlUtil.unescape(myId)));
break;
case DSTU2_1:
result.setId(new org.hl7.fhir.dstu2016may.model.IdType(myServer.getBaseForRequest(),UrlUtil.unescape(myId)));
break;
case DSTU2_HL7ORG:
result.setId(new org.hl7.fhir.instance.model.IdType(myServer.getBaseForRequest(),UrlUtil.unescape(myId)));
break;
case DSTU2:
result.setId(new ca.uhn.fhir.model.primitive.IdDt(myServer.getBaseForRequest(),UrlUtil.unescape(myId)));
break;
default :
throw new ConfigurationException("String_Node_Str" + fhirContextVersion);
}
}
if (myRestOperation == RestOperationTypeEnum.UPDATE) {
String contentLocation=result.getHeader(Constants.HEADER_CONTENT_LOCATION);
if (contentLocation != null) {
switch (fhirContextVersion) {
case R4:
result.setId(new org.hl7.fhir.r4.model.IdType(contentLocation));
break;
case DSTU3:
result.setId(new org.hl7.fhir.dstu3.model.IdType(contentLocation));
break;
case DSTU2_1:
result.setId(new org.hl7.fhir.dstu2016may.model.IdType(contentLocation));
break;
case DSTU2_HL7ORG:
result.setId(new org.hl7.fhir.instance.model.IdType(contentLocation));
break;
case DSTU2:
result.setId(new ca.uhn.fhir.model.primitive.IdDt(contentLocation));
break;
default :
throw new ConfigurationException("String_Node_Str" + fhirContextVersion);
}
}
}
result.setCompartmentName(myCompartment);
result.setCompleteUrl(myRequestUrl);
result.setResourceName(myResourceName);
return result;
}