LinuxForHealth / hl7v2-fhir-converter

Converts HL7 v2 Messages to FHIR Resources
Apache License 2.0
86 stars 34 forks source link

Issue/nte string index out of bound #521

Closed ssharma5 closed 3 weeks ago

ssharma5 commented 3 weeks ago

Fix for issue: StringIndexOutOfBoundsException is thrown while converting NTE segments with additional dash #512

In HL7ToFHIRConverter class, Method 'getHl7Message' has code for logging HL7 message structure. In order to optimize the content. It takes subset of each line based on first occurrence of "-" and 5 chars more. Issue occurs when there are multiple repeating segments like NTE and HL7Message.printStructure does not follow {Segment} - start prefix on these repeating segments. and these sgement has "-" in content.

For now added fail-safe check if indexof Dash + 5 chars is more then length of line then take line length as input.

ssharma5 commented 3 weeks ago

create new pull request with proper commit message.