From: Tripp, B. <Bry...@uh...> - 2004-08-24 22:40:52
|
Hi Archie, Sorry about the bugs, and thanks for letting us know. I'll look into the looping problem further. Unfortunately I'll be unavailable for the next two weeks. If any one else wants to look at it, it sounds like MessageIterator is creating a spot for the unexpected segment but then not recognizing that spot as being suitable. Regarding the other problem, it doesn't make sense to try to XML encode messages of unknown structure (with HAPI or otherwise), so you're right that HAPI should just quit. I'll change this for the next release. GenericMessage is used when MSH-9 is not valued, or is valued with something for which there is no corresponding message class on the classpath. Regards, Bryan -----Original Message----- From: Archie Cobbs To: hl7...@li... Sent: 24/08/2004 5:54 PM Subject: Re: [HAPI-devel] Bugs encountered in 0.4.2 Archie Cobbs wrote: > > I've just upgraded to 0.4.2 and am encountering some problems. > > I've also just switched to a new HL7 feed so some of these problems > > may be related to that switch as well. > > > > #1: Infinite loops > > > > I'm receiving some ADT^A24 messages that seem to contain > > no PID segments (which is wrong I think). In any case, they > > send the HL7 server into an infinite loop when it tries to > > parse them! See log trace below. Oddly, when I cut & paste > > the same message into the Message Tester Swing app, it seems > > to parse it fine. > > Oops, correction: the ADT^A24 is properly formatted and does > contain the required PID segments. I was missing the latter half > of the message with cut&paste because of the carriage returns > without linefeeds. > > Also, the Message Tester Swing app goes into an infinite loop > (ie., hangs) also when trying to parse this message. > > I've attached a sanitized version below of a message that causes > this loop. FYI, ..continuing my conversation with myself... :-) This bug seems to be triggered by the fact that this message specifies that it is version "2.2" but actually contains a 2.3 segment, PD1. In any case, as a stopgap I've added the patch below to work around the problem. -Archie ________________________________________________________________________ __ Archie Cobbs * CTO, Awarix * http://www.awarix.com diff -ur /home/archie/hapi/hapi-0.4.2/src/ca/uhn/hl7v2/model/AbstractGroup.java ./ca/uhn/hl7v2/model/AbstractGroup.java --- /home/archie/hapi/hapi-0.4.2/src/ca/uhn/hl7v2/model/AbstractGroup.java 2004-08-24 12:25:07.000000000 -0500 +++ ./ca/uhn/hl7v2/model/AbstractGroup.java 2004-08-24 16:48:12.000000000 -0500 @@ -140,6 +140,17 @@ if (version == null) throw new HL7Exception("Need message version to add segment by name; message.getVersion() returns null"); Class c = ca.uhn.hl7v2.parser.Parser.findSegmentClass(name, version); + + // Hack to try the next version if segment not found in this version + if (c == null) { + String[] vlist = new String[] { "2.1", "2.2", "2.3", "2.3.1", "2.4", "2.5" }; + for (int i = 0; i < vlist.length - 1; i++) { + if (version.equals(vlist[i])) { + c = ca.uhn.hl7v2.parser.Parser.findSegmentClass(name, vlist[i + 1]); + break; + } + } + } if (c == null) c = GenericSegment.class; ------------------------------------------------------- SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 _______________________________________________ Hl7api-devel mailing list Hl7...@li... https://lists.sourceforge.net/lists/listinfo/hl7api-devel This e-mail may contain confidential and/or privileged information for the sole use of the intended recipient. Any review or distribution by anyone other than the person for whom it was originally intended is strictly prohibited. If you have received this e-mail in error, please contact the sender and delete all copies. Opinions, conclusions or other information contained in this e-mail may not be that of the organization. |