From: Mike M. <mi...@th...> - 2017-07-31 02:51:43
|
I need to apologise for my post about a broken PreParser with an invalid MSH-2. Debugging through the PreParser code I have noticed that it does indeed throw an exception when you call getFields() with the invalid MSH-2. I think my original conclusion about the parser failure was due to the lazy way in which I am using the PreParser. In my original code the PipeParser is always used, now the PreParser is only being triggered when a field is being accessed, my original test case was passing after the preParser was put in place because the original test case was invalid as it did not cause the PreParser to be used. If you create a simple test with the sample message you do indeed get an HL7 Exception thrown (message is not useful: "Parse Failed"), this happens because the 4 msh characters are read, and a test is performed to confirm that the next character is the field separator (in my example this fails as '&' is found instead of '|'). Sorry for the false alarm. Kind regards, -Mike On 28 July 2017 at 14:38, Mike Mills <mi...@th...> wrote: > I have been attempting to convert our routing code to use the more > performant PreParser over a full PipeParser. > > I have found this message to throw an exception in the pipe parser, but no > exception is thrown with the PreParser: > > MSH|^~\\&|||||20161024182512||ORM^O01|1624|T|2.4||||||8859/1 > > > Note the \\ in the MSH-2, this was an actual case in our production system > and is one of the edge tests we perform. > > When I moved to the PreParser this test failed as it no longer throws the > HL7Exception: > > ca.uhn.hl7v2.HL7Exception: Invalid or incomplete encoding characters - > MSH-2 is ^~\\& > > > Surely the same exception should be generated by the PreParser? > > -Mike > |