From: Tripp, B. <Bry...@uh...> - 2004-03-01 15:23:33
|
Hi Bill, That's odd. The important thing is that there is a carriage return (\r) at the end of the segment. Is there any chance there is only a newline? If the \r is there, make sure you aren't removing it during the read ... for example appending repeated BufferedReader readLine() results to a StringBuffer would leave out the \r. Bryan > -----Original Message----- > From: William Butler [mailto:wb...@pa...] > Sent: February 29, 2004 4:56 PM > To: hl7...@li... > Subject: [HAPI-devel] NumberFormatException from PipeParser > > > OK here's a newbie question: > > I worked through the introductory tutorial fine including the > interaction between TestPanel and SimpleServer. > > However when I programmatically read an HL7 file containing: > > MSH|^~\&| ...blah... |P|2.3|1508 > EVN|A08|20031105133757|||hearnm > .... > > into the string stringFromFile. and send it to an instance of > PipeParser as > > parser = new PipeParser() > message = parser.parse(stringFromFile) > > I get: > > Traceback (innermost last): > File "<console>", line 1, in ? > Caused by: java.lang.NumberFormatException: For input string: "1508 > EVN" > at > java.lang.NumberFormatException.forInputString(NumberFormatExc > eption.jav > a:48) > at java.lang.Integer.parseInt(Integer.java:477) > at java.lang.Integer.parseInt(Integer.java:518) > at > ca.uhn.hl7v2.model.primitive.CommonNM.setValue(CommonNM.java:105) > ... 25 more > > ca.uhn.hl7v2.model.DataTypeException: > ca.uhn.hl7v2.model.DataTypeException: > java.lang.NumberFormatException: > For input string: "1508 > EVN": Segment: MSH (rep 0) Field #12 > > The same text copied and pasted into TestPanel works fine. I > guess the > end of the line is not being recognized. Can anything be done > to help > this? > > Thanks, > > Bill Butler > > Mass General Hospital > > > > ------------------------------------------------------- > SF.Net is sponsored by: Speed Start Your Linux Apps Now. > Build and deploy apps & Web services for Linux with > a free DVD software kit from IBM. Click Now! > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click > _______________________________________________ > 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. |