From: Todd C. <tch...@bc...> - 2006-01-13 06:57:19
|
Did this ever get resolved? I have 0.5 beta, and ran into an issue where an HL7 message got sent in that contained a segment with a line break in it (an invalid HL7 message). The first 3 characters after the line break were ||| ( a continutation of the previous line). This caused the parser to go into an infinite loop at the location shown in the stacktrace below: at java.util.ArrayList.get(Unknown Source) at ca.uhn.hl7v2.model.AbstractGroup.getAll(AbstractGroup.java:306) at ca.uhn.hl7v2.util.MessageIterator.getIndex(MessageIterator.java:341) at ca.uhn.hl7v2.util.MessageIterator.hasNext(MessageIterator.java:86) at ca.uhn.hl7v2.util.FilterIterator.setNextObject(FilterIterator.java:78 at ca.uhn.hl7v2.util.FilterIterator.hasNext(FilterIterator.java:59) at ca.uhn.hl7v2.util.FilterIterator.setNextObject(FilterIterator.java:78 at ca.uhn.hl7v2.util.FilterIterator.hasNext(FilterIterator.java:59) at ca.uhn.hl7v2.parser.PipeParser.doParse(PipeParser.java:249) at ca.uhn.hl7v2.parser.GenericParser.doParse(GenericParser.java:188) at ca.uhn.hl7v2.parser.Parser.parse(Parser.java:151) at ca.uhn.hl7v2.app.TestPanel.parseOutbound(TestPanel.java:263) at ca.uhn.hl7v2.app.TestPanel$1.actionPerformed(TestPanel.java:161) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Sour I've worked around it by pre parsing the messages and looking for known problems (like this one) and fixing them. But I only fix the ones I know about, so I could get blindsided... Todd Tripp, Bryan wrote: > 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. Just curious if there was eventually some resolution to this problem. I.e., I"d like to know if now there is a better fix than my workaround below which I can pull from CVS or whatever.. Thanks, -Archie > 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 > Hl7api-devel@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. > > > > ------------------------------------------------------- > 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 > Hl7api-devel@li... > https://lists.sourceforge.net/lists/listinfo/hl7api-devel > __________________________________________________________________________ Archie Cobbs * CTO, Awarix * http://www.awarix.com * Confidentiality Notice: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. * *** *** *** *** *** *** *** *** *** *** CONFIDENTIALITY NOTICE This e-mail is intended for the sole use of the individual(s) to whom it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. You are hereby notified that any dissemination, duplication, or distribution of this transmission by someone other than the intended addressee or its designated agent is strictly prohibited. If you receive this e-mail in error, please notify me immediately by replying to this e-mail. *** *** *** *** *** *** *** *** *** *** |