From: Shrock, C. <Sh...@in...> - 2004-12-01 00:17:47
|
I have tracked an issue to a version issue. I get an exception (the line numbers are a little off because I am debugging things): 455 ERROR [ca.uhn.hl7v2.app.Responder] Attempting to send error message to remote system. ca.uhn.hl7v2.HL7Exception: java.lang.ClassCastException trying to set data type of OBX-5 at ca.uhn.hl7v2.model.Varies.fixOBX5(Varies.java:130) at ca.uhn.hl7v2.parser.PipeParser.parse(PipeParser.java:325) at ca.uhn.hl7v2.parser.PipeParser.parse(PipeParser.java:262) at ca.uhn.hl7v2.app.Responder.processMessage(Responder.java:139) at ca.uhn.hl7v2.app.Receiver$Grunt.run(Receiver.java:120) Caused by: java.lang.ClassCastException at ca.uhn.hl7v2.model.Varies.fixOBX5(Varies.java:107) The offending line is: Varies v = (Varies) segment.getField(5, 0); The test message I have broken it down to is: MSH|^~\&|RAD|SHM||SHM|200411291512||ORU^R01|OUTBOUND.5.32158|D|2.1 PID|1|Z4882|Z000004931|Z4882|RED^CODE^^^^||19650328|F||||||||||Z00006227 ORC||#SHM#000002707|4780550||D||||200411291512 OBX|1|TX||| This is a test Change the version to 2.2, and the message is parsed. The difference that I can see is in the implementation of the OBX segment; The 2.1 implementation handles OBX-5 by: this.add(ST.class, true, 1, 65, null); The 2.2 implementation handles OBX-5 by: this.add(Varies.class, false, 1, 65536, null); The only thing that makes sense to me at this point is that since the 2.2 is explicitly returning a (Varies) and not a (ST) like 2.1, the class casting is working. My question is what would govern the successful casting of (ST) to (Varies) and is it related to the actual HL7 message being parsed? If so, any hints? I know that the HL7 message is not standard. I have been trying to troubleshoot things and I want to see if by trying to troubleshoot, I have broken an assumption that is necessary for it to work. Thank you for any insight/shared experience that may have in this matter, Court |