Hi,

I got an exception while trying to parse a HL7 message with an empty PV1 
segment (using HAPI 0.5.1). Although it is rather unusual, I don't read 
anything in the spec which forbids it. Example:

MSH|^~\&|||||20080627102031.292+0100||ADT^A31|EJ557600005480760|P|2.3|||||BE|8859/1|FR
EVN||20080627101943+0100
PID|||M07869D^^^ADMISSION^^ISSTLUC||DUPONT^JEAN||19701004000000+0100|M
PV1

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring(String.java:1768)
    at ca.uhn.hl7v2.parser.PipeParser.doParse(PipeParser.java:241)
    at ca.uhn.hl7v2.parser.Parser.parse(Parser.java:151)
    at ca.uhn.hl7v2.view.Viewer.main(Viewer.java:119)

As a workaround, we changed the PipeParser code like this:

                    // name = segments[i].substring(0, 
segments[i].indexOf(delim));
                    if (segments[i].indexOf(delim) >= 0 ) {
                      name = segments[i].substring(0, 
segments[i].indexOf(delim));
                    } else {
                      name = segments[i];
                    }

-- 
Frédéric Dubru
Département informatique
Cliniques universitaires Saint-Luc
10, avenue Hippocrate
B-1200 Bruxelles
http://www.saintluc.be


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to