Skip to content

FHIRLexer$FHIRLexerException after upgrading hapi-fhir from 8.2.0 to 8.4.0 #892

@centaurusgod

Description

@centaurusgod

The FHIRPath PATCH operation targeting Task.businessStatus.coding.where(...) is causing a regression in hapi-fhir 8.4.0, resulting in an Unterminated string error during lexical analysis. This request executed successfully on version 8.2.0

curl --request POST
--url http://localhost:8080/fhir/
--header 'Content-Type: application/json'
--header 'accept: /'
--data '{"resourceType":"Bundle","type":"transaction","entry":[{"resource":{"resourceType":"Parameters","parameter":[{"name":"operation","part":[{"name":"type","valueCode":"replace"},{"name":"path","valueString":"ServiceRequest.status"},{"name":"value","valueCode":"revoked"}]}]},"request":{"method":"PATCH","url":"/ServiceRequest/1"}},{"resource":{"resourceType":"Parameters","parameter":[{"name":"operation","part":[{"name":"type","valueCode":"replace"},{"name":"path","valueString":"Task.businessStatus.coding.where(system='''http://customurl.com/fhir/CodeSystem/order-businessStatus''')"},{"name":"value","valueCoding":{"system":"http://customurl.com/fhir/CodeSystem/order-businessStatus","code":"cancelled","display":"Cancelled"}}]},{"name":"operation","part":[{"name":"type","valueCode":"replace"},{"name":"path","valueString":"Task.status"},{"name":"value","valueCode":"cancelled"}]}]},"request":{"method":"PATCH","url":"/Task/2"}}]}'

Response:

{
	"resourceType": "OperationOutcome",
	"issue": [
		{
			"severity": "error",
			"code": "processing",
			"diagnostics": "HAPI-2409: org.hl7.fhir.r4.fhirpath.FHIRLexer$FHIRLexerException: Error @1, 8: Unterminated string"
		}
	]
}

The request is completed normally on hapi-fhir verrsion 8.2.0.

Additional Info:
If we remove the dot from the url then the request is completed for eg.
From:

   {
     "name": "path",
     "valueString": "Task.businessStatus.coding.where(system='http://customurl.com/fhir/CodeSystem/order-businessStatus')"
   }

To:

   {
     "name": "path",
     "valueString": "Task.businessStatus.coding.where(system='http://customurlcom/fhir/CodeSystem/order-businessStatus')"
   }

The issue remains same for normal string. For eg:
Error: hapi.fhir
No Error: hapifhir

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions