HAPI

Release History

Version Date Description
2.5.1 2023-11-01  
2.4.1 2023-11-01  
2.5 2023-10-30  
2.4 2023-10-30  
2.3 2017-06-23  
2.2 2014-03-04 This release contains a number of big fixes, a newly rewritten MLLP implementation and several API enhancements.
2.1 2013-03-21 This release introduces the HapiContext and brings many new features
2.0 2012-07-16 This release contains a complete overhaul of the SimpleServer infrastructure, a move to SLF4J, a new LLP implementation, and many other enhancements and bugfixes!
1.2 2011-06-26 This release brings some bug fixes and a few enhancements. The primary focus of this release is in fixing issues relating to parsing and encoding. In particular, a number of issues specific to parsing of OBX-5 (Varies) values have been corrected.
1.1 2011-03-28 This release contains a number of bug fixes and several new features.
1.0.1 2010-05-16 This release corrects a single issue
1.0 2010-04-12 This release adds a newly reworked PipeParser, and number of new features
0.6 2009-07-01 This release adds support for HL7 2.5.1 and 2.6, as well as fixing a number of issues and introducing a new build system.
0.5.1 2007-02-18 This release fixes only one issue. In the previous release (0.5), some classes were released with a dependency on Java 5. HAPI officially supports JDK version 1.4, so this release corrects the dependency.
0.5 2006-12-14  

Release 2.5.1 – 2023-11-01

Type Changes By
Fix SimpleServer now waits for its server socket to be closed when stopAndWait is called. This makes it easier for consumers of SimpleServer to reuse the port after stopping the server without implementing a wait for the port to be released themselves. Emre Dincturk

Release 2.4.1 – 2023-11-01

Type Changes By
Fix SimpleServer now waits for its server socket to be closed when stopAndWait is called. This makes it easier for consumers of SimpleServer to reuse the port after stopping the server without implementing a wait for the port to be released themselves. Emre Dincturk

Release 2.5 – 2023-10-30

Type Changes By
HAPI HL7v2 2.5 is identical to HAPI FHIR 2.4, but uses the jakarta.servlet packages instead of the javax.servlet packages. All versions of HAPI HL7v2 going forward will contain this change. James Agnew

Release 2.4 – 2023-10-30

Type Changes By
As of HAPI HL7v2 2.4, HAPI FHIR now requires JDK 11 or newer in order to build or use the library. James Agnew
Fix The XML parser was vulnerable to XXE injections (meaning that the XML parser could be coerced into inadvertently loading the contents of files on the local filesystem). It is highly recommended to upgrade to this release in order to mitigate this issue. James Agnew
Fix Testpanel: Correct a NullPointerException when opening a message from a text file
Fix Testpanel: Prevent a failure to autosave messages when TestPanel is closing if the charset has not been selected
Fix Testpanel: Fix formatting issue when displaying sent/received messages containing HTML fragments
Fix Fix an issue with the AbstractMessage#copy() method where non-standard segments were not being added at the same position as the original message. Nathan Doef
Add Add a new copy() method to AbstractMessage that recursively loops over every Structure and parses / encodes the contents of each AbstractSegment into the copied message. Nathan Doef
Fix The Connection interface now extends Closeable. As a consequence, the close() method now throws IOException. Thanks to hauntingEcho for the proposal. Fixes 35. Christian Ohr
Fix Fixes problem with missing items in PopulatingVisitor. Thanks to mourezwell for the pull request. Fixes 33. Christian Ohr
Fix Allow Visitor or Terser API to filter for repeated field. Thanks to mourezwell for the pull request. Fixes 31. Christian Ohr
Fix Fix namespace handling when XML-encoding messages. Thanks to kbalthaser for reporting. Fixes 22. Christian Ohr
Fix Fix encoding of line breaks as \X000d\. Fixes 7. Christian Ohr
Fix When calling Parser#parse(Message, String), the parser now sets itself as the parser associated with the message. This causes the parser's validation settings to be applied during parse instead of default settings being applied.
Add Add an optional mode to SimpleServer where all received messages are processed, even including unexpected ACK messages. Thanks to Tom Chiverton for the pull request!. Fixes 2.
Fix A concurrency issue causing an exception when parsing or receiving multiple messages in parallel has been resolved.
Add A new protocol error handler has been added to the LLP layer. Thanks to Sumeet Chhetri for the pull request!. Fixes 26.

Release 2.3 – 2017-06-23

Type Changes By
Fix Improve SegmentFinder performance. Thanks to Niels Harremoës for reporting. Fixes 242. Christian Ohr
Fix Fixed field numbers of handling MFE-4/MFE-5 varies types Christian Ohr
Fix Consistently use longs in ID generators. Thanks to Samantha Chan for reporting. Fixes 241. Christian Ohr
Fix Fix missing location field in NAK messages. Thanks to Christian Woerns for reporting. Fixes 240. Christian Ohr
Fix Fix wrong case in Role and Identifier elements in conformance profile parsing. Thanks to Jens Villadsen. Fixes 239. Christian Ohr
Fix Fix serialization of TerserMessageRule. Thanks to Sebastian Tacke for reporting. Fixes 238. Christian Ohr
Fix Avoid NullPointerException with non-existing conformance profile. Thanks to Ulrich Metzger for reporting. Fixes 234. Christian Ohr
Fix Fix daylight savings issue in CommonTM. Thanks to Rolf Thorup for reporting and the fix. Fixes 229. Rolf Thorup
Fix Conformance profile validation skips Varies fields. Thanks to Pablo Leon for reporting Christian Ohr
Add Add option to MessageValidator to validate primitives, too. Note that this slows down the validation significantly Christian Ohr
Fix Do not embed slf4j into OSGi bundle (rely on PAX logging). With thanks to juantxorena. Fixes 226. Christian Ohr
Fix Avoid that empty segments are added during parsing. With thanks to Jens Villadsen. Fixes 207. Christian Ohr
Add Allow messages to be wrapped as unmodifiable. Fixes 92. Christian Ohr
Add Allow messages to be created from within an HapiContext. Fixes 91. Christian Ohr
Fix Fix isEmpty() and clear() in TSComponentOne. Thanks to Sebastian Tacke for reporting. Fixes 224. Christian Ohr
Fix Avoid NullPointerException using DefaultHapiContext close method. Thanks to Domingo Amado for reporting. Fixes 223. Christian Ohr
Fix CustomModelClassfactory should not check for valid versions. Thanks to Ambassador Software Works for reporting. Fixes 222. Christian Ohr
Add Allow to unregister/unbind applications from ApplicationRouter. Thanks to Mathieu for the proposal. Fixes 89. Christian Ohr
Add Make default acknowledgement code configurable in ApplicationRouterImpl. With thanks to Jens Villadsen. Fixes 87. Christian Ohr
Add Throw new TimeoutException (subclass of Hl7Exception) is HL7 server fails to answer. With thanks to Jens Villadsen. Fixes 86. Christian Ohr
Add Add type parameter to ReceivingApplication. With thanks to Jens Villadsen. Fixes 85. Christian Ohr
Fix Improve exception message. Thanks to DiGiT for reporting. Fixes 216. Christian Ohr
Fix Fix CustomModelClassFactory implementation, returning the correct message structure. Fixes 213. Christian Ohr
Fix HapiContext now supplies a default Server Configuration, which prevents an unrelated error from showing up in logs if an unparseable message is received. James Agnew

Release 2.2 – 2014-03-04

Type Changes By
Fix XML Parsing now also works if the HL7v2 XML namespace is not the default namespace (i.e. tags have namespace prefixes). Thanks to Eugene Berman for reporting!. Fixes 176. Christian Ohr
Fix Fix issue where HohRawClientMultithreaded (HL7 over HTTP Multithreaded Client) fails to reconnect automatically when the server side unexpectedly closes the connection. Fixes 180. James Agnew
Fix Correct a crash when using CanonicalModelClassFactory with a fixed message class (not version) and parsing a message containing unexpected/custom Z segments. Fixes 182. James Agnew
Fix Modify ExtendedMinLLPWriter (a part of the ExtendedMinLowerLayerProtocol LLP implementation) so that it doesn't flush the network buffer between the LLP start block and the actual message (causing issues transmitting messages to some Websphere implementations). Thanks to Chris Stoten of UHN for all of the hard work in getting this figured out. Chris Stoten
Add HL7 over HTTP relay now adds its own product name to any error messages it returns in a NAK message, so that it is easier when troubleshooting to distinguish a NAK which is coming back from the destination system vs. a NAK which is generated by the relay itself (e.g. because the destination is unreachable). James Agnew
Fix Fix the "xsdconfgen" Maven plugin so that it adds generated artifacts to the current build as resources instead of compile sources. James Agnew
Fix Fix a minor issue in the HAPI bootstrap process where a classpath inputstream wasn't closed properly, leading to weird artifacts in logs when HAPI based applications are redeployed on some application servers (e.g. Glassfish 3.x). Fixes 179. Christian Ohr
Fix Correct an issue in hapi-hl7overhttp where the HOH Server implementations incorrectly fail to detect the content type if the charset isn't specified by the client. James Agnew
Add Added methods to HapiContext and ConnectionHub that allow to lazily create a client connection, i.e. the physical connection is established only right before the first message is sent over it. Fixes 80. Christian Ohr
Add Correcting a bug in the HL7 over HTTP client code where GZipped HTTP responses are not properly interpreted as being GZipped. Fixes 183. James Agnew
Add Reimplemented MinLLP readers and writers. MSH-18 handling is configured by the parameter in the constructor MinLowerLayerProtocol(boolean). ExtendedMinLowerLayerProtocol has been deprecated. Fixes 76. Christian Ohr
Add Correct an issue with the HL7 over HTTP Relay where concurrent messages being relayed at the same time may result in misdirected ACK responses. Fixes 186. Anthony Rakic
Add Add a new convenience method to text primitives (ST, TX, etc.) called "getValueOrEmpty()" which returns an empty string instead of null, and modify ID and IS to use the AbstractTextPrimitive base class so that they can take advantage. James Agnew
Fix Fix a typo in AbstractValidationExceptionHandler, where "info" severity exceptions aren't handled. Thanks to Brennan O'Banion for reporting and submitting a fix. Fixes 190. Brennan O'Banion
Add HL7 over HTTP client now properly respects "Connection=close" header in responses James Agnew
Add Add a new method to HapiContext, getServerConfiguration. This method returns a configuration bean, much like getParserConfiguration() which can be used to configure receiving servers created by the given context. James Agnew
Add Add a configuration option to the new ServerConfiguration bean which sets the policy for how to handle exceptions thrown by receiving applications. This can be used to configure HAPI to not send a response message back, which can be useful when dealing with problematic legacy systems. James Agnew
Fix Fix exception when HL7 over HTTP servlet receives message larger than 4K. Thanks to Paul Schwartz for contributing a bug report and pinpointing the cause. Fixes 191. Paul Schwartz
Fix Fix problem where Superstructures (such as this one ) do not support all of the types they should. For example, ADT_AXX would allow an ADT^A04 message to parse, but not an ADT^A01. This is now fixed. Fixes 192. James Agnew
Fix Fix an issue where the XML parser ignores "extra components", unlike the Pipe parser. For example, if a CX.4 element is found within a CX field, the XML parser would not grab its contents. This is now corrected. Thanks to Ryan Baldwin for the diagnosis. Fixes 199. Ryan Baldwin
Add HL7 over HTTP client now comes with several configuration options to set the socket properties (SO_timeout, Keepalive, etc.) James Agnew
Add HL7 over HTTP relay now mentions itself in NAK messages it generates (which makes it easier to tell if a NAK is coming from the relay because it couldn't reach its target, or if the NAK is actually from the target). Fixes 77. James Agnew
Add Add two new methods to ParserConfiguration which allow the disabling of whitespace trimming at the individual node level, and on a global level. This configuration replaces the "setKeepAsOriginalNodes" method on the XMLParser, which is somewhat confusingly named. Thanks to Ryan Baldwin for help in diagnosing the need for this. James Agnew
Fix Fix an issue where the XML parser incorrectly encodes text values which contain an escape sequence (e.g. \E\) at the very end of the value. Thanks to Ioan Salau for reporting!. Fixes 202. James Agnew
Add Make HL7 escaping strategy configurable over ParserConfiguration API Christian Ohr
Fix HapiContext now implements Closeable. Fixes 193. Christian Ohr
Add Apply visitor pattern to message validation: a message can be validated by letting a MessageVisitor traverse the message and collect potential problems Christian Ohr
Add Allow HL7 over HTTP Relay users to set the read timeout on connections James Agnew
Fix Fix a regression in HAPI 2.2-beta1 which caused the first portion of a received message to be processed as a complete message when the reading socket times out part way through the message. This issue does not affect previous versions of HAPI. Fixes 206. James Agnew
Add HL7 over HTTP implementation updated to match specification changes by HL7 ITS WG: HL7 responses always use HTTP 200, UTF-8 is default (and changing it is deprecated) James Agnew

Release 2.1 – 2013-03-21

Type Changes By
Add HAPI is now able to work without any structure JARs for basic tasks, and can process unknown versions of HL7 (e.g. 2.99) if configured to allow this. See GenericModelClassFactory for more information. Fixes 155. James Agnew
Fix Fixed incorrect trimming rule for TX. Thanks to Søren Therkildsen for reporting. Fixes 3590954. Christian Ohr
Fix Fixed incorrect generation of ACK messages for HL7 versions newer than 2.4. Thanks to Anne-Gaelle for reporting. Fixes 3571839. Christian Ohr
Add ModelClassFactory define their own event map location, where the mapping between event and message structure is defined. Compatibility notice: Parser.getMessageStructureForEvent is not static anymore and was deprecated. Fixes 3570493. Christian Ohr
Fix Fixed bug in DefaultXMLParser. Thanks to Leo Marcov for reporting. Fixes 1834598. Christian Ohr
Fix Deprecated LowerLayerProtocol.makeLLP as there is now the choice between MinLowerLayerProtocol and ExtendedMinLowerLayerProtocol. Fixes 3552470. Jens Villadsen, Christian Ohr
Add ValidationContext can now be more conveniently configured using ValidationRuleBuilders. All predefined ValidationContext classes have been reimplemented to be defined by such builders. Christian Ohr
Fix HapiContext becomes the unique source of configuration. Changing a context object immediately changes the configuration of all connected parsers, servers etc. Message-specific ValidationContext has been deprecated and will be removed in the next version. Fixes 3564428. Christian Ohr
Fix XML Parser is now able to handle escape sequences that are relevant for XML encoding when parsing and rendering. Thanks to Alberto Saez Torres for reporting. Fixes 3515725. Christian Ohr
Add Introduced HapiContext, which aggregates most of the configuration and allows to instantiate correspondingly configured HAPI services (parsers, validators, servers, ...). Fixes 3515833. Christian Ohr
Add All XML processing is based on DOM Level 3 and uses the standard libraries, which are included in JRE 5 and newer. Therefore, no external XML-related libraries are required anymore.

The default XML implementation can be overridden this by setting the system property org.w3c.dom.DOMImplementationSourceList to the external DOM implementation and org.xml.sax.driver to an external SAX implementation.

When Xerces 2.11 is used as external XML processor library, org.w3c.dom.DOMImplementationSourceList must be set to org.apache.xerces.dom.DOMXSImplementationSourceImpl and org.xml.sax.driver must be set to org.apache.xerces.parsers.SAXParser. Fixes 3515828.
Christian Ohr
Add Added a set of new message ID generators, to be centrally configured using the ParserConfiguration class. Provides non-persistent generators and the possibility to plug in custom ID generators. Fixes 3515832. Christian Ohr
Add Make Message Validation more versatile by adding a ValidationExceptionHandler that is called on every violation of a validation rule. A new implementation of such a handler (RespondingValidationExceptionHandler) is capable of creating response messages based on the validation result. Fixes 3494927. Christian Ohr
Add Minor API enhancements:
  • ConnectionHub has a new factory method which accepts an LLP instance but does not require a boolean flag to indicate whether TLS is being used (added for consistency with other methods).
  • A number of internal log statements which are only really useful if you are familiar with HAPI internals have been changed from DEBUG level to TRACE level, to make debug level logging easier to understand.
  • Service classes (such as SimpleServer) now have a startAndWait() method which doesn't return until the service has successfully started
  • When GenericParser parses a message, the Parser instance associated with the message is set appropriately to either the Pipe Parser or the XML Parser. This means that calls to generateAck().encode() will generate a message with the appropriate encoding.
James Agnew
Fix AbstractMessage#generateAck() now sets the Parser instance associated with the generated Ack message to be the same instance as its own instance. This means for instance that if a message is parsed from an XML message, the same XML parser will be associated with the generated ACK. James Agnew
Fix Prevent UnsupportedOperationException when AbstractType#toString() is called on a message that was parsed by an XML parser (for instance on an ST, or another datatype). James Agnew
Fix ConnectionHub and SimpleServer now each accept a custom socket factory instance, which can be used to allow custom configuration on sockets, or special TLS configurations. This checkin also corrects an issue where the "tls" parameter on ConnectionHub was not honoured. Fixes 3558687. James Agnew
Fix Fix an issue parsing XML encoded messages where any segment groups with a four letter name are ignored (e.g. the DIET group in an OMD_O01 message). Thanks to mmartin for providing a test case demonstrating the issue!. Fixes 3566636. mmartin (laguna27)
Fix Fix an issue where SegmentFinder can't find PID2 within an A24 message. Thanks to DiGiT for providing a working test case!. Fixes 169. DiGiT
Add AbstractTextPrimitive#getValueAsHtml() now properly escapes HTML reserved characters:
< > &. Fixes 166.
James Agnew
Fix Fix an issue that prevented the sample code for Custom Model Classes from working properly. Thanks to Michael Connor for reporting. Fixes 162. Christian Ohr
Fix Allow messages which contain "choices" within their structures to parse correctly. For example, the ORM_O01 v2.5 message has a structure called ORDER_DETAIL which can have any one of 6 different segments as its first segment. Previously HAPI treated all as required and failed to correctly parse in many cases. Thanks to Paulo Ferreira for reporting!. Fixes 159. James Agnew
Fix v2.3 structure for ORC-14 is correctly set to XTN datatype (was previously TN). Fixes 95. James Agnew
Fix Improve error message in ExtendedMinLowerLayerProtocol when an incoming message can't be processed because it contains an invalid MSH segment. Thanks to Jens Villadsen for reporting!. Fixes 134. James Agnew
Fix Allow ReceivingApplicationExceptionHandler to process exceptions even when un-parseable messages are received. Fixes 123. Nicolas Lefebvre
Fix New parser configuration option for customizing Unexpected segment (e.g. Z-segment) behaviour in terms of where in the structure the segment gets placed. Thanks to Michael Connor for suggesting this!. Fixes 64. James Agnew
Fix Prevent eventmap from containing structure mappings that shouldn't exist because the source structure exists. For example, in v2.3.1 there should not be a mapping from ADT_A34 to ADT_A30, because there is a structure for ADT_A34 itself. Thanks to hirion86 for reporting this!. Fixes 67. James Agnew
Fix Correct unhelpful error logging in HohRawServlet when the HL7 over HTTP servlet has an error decoding a request. Thanks to Giacomo Petronio for reporting and providing a fix!. Fixes 75. Giacomo Petronio
Fix Introduce new PipeParser non-greedy mode which can be used to give the parser hints on how to proceed when the choice of where to put the next segment is ambiguous between moving to a child group later in the message structure or moving to a new repetition of a parent structure.

Thanks to Pablo Pazos for reporting and providing a test case!. Fixes 171.
James Agnew
Fix Improve the documentation on the Maven Plugins and introduce a new plugins for generating Superstuctures and XSDs James Agnew
Fix Fix a regression in 2.1-beta1 where DefaultXMLParser would not encode correctly on certain environments because of an error relating to XML "pretty print" support.

As a part of this fix, a new ParserConfiguration option has also been added to optionally disable pretty printing if desired. Thanks Steffan Rachner for reporting!. Fixes 172.
Christian Ohr

Release 2.0 – 2012-07-16

Type Changes By
Fix Regression in 2.0-beta1: Fix issue where occasionally a Connection which is sending a message would ignore an ACK/response message it received and report that the send timed out.
Add HAPI has now switched from CVS to Subversion for version control purposes. The new repo can be accessed at: https://hl7api.svn.sourceforge.net/svnroot/hl7api The old CVS repo will be kept around for now, just in case it is needed.
Add Refactored large parts of the networking functionality in the ca.uhn.hl7v2.app package. Most notably, an ExecutorService instance can be injected to customize the threading behavior. Fixes 3388301. Christian Ohr
Add Make TestPanel more usable. Amongst other changes, it's now possible to load HL7 messages directly from a file and to reuse client-side connections even when the MLLP server was restarted in the meanwhile. Fixes 3421082. Christian Ohr / James Agnew
Add Convert HAPI to use the SLF4J logging framework in place of Apache Jakarta Commons-Logging (JCL). SLF4J is conceptually similar to JCL, in that it is a wrapper around an underlying framework of your choice (e.g. log4j, java.util.Logger, etc.). It brings a number of modern features with it, such as parameterized entries and NDCs, and uses a less confusing discovery process.

Applications which use HAPI will now need to add the "slf4j-api.jar" JAR to their classpath, as well as a second JAR such as "slf4j-log4j12.jar" which instructs SLF4J which underlying log framework to use. These two dependencies have been added to the hapi-base pom.xml, so Maven users will see this change automatically.

In addition, HapiLog has been deprecated. HapiLog was used as a logging system prior to the introduction of commons-logging into HAPI. It is no longer referenced by any part of HAPI itself, and will be removed at some point in the future. Fixes 3421083.
Christian Ohr
Add Add new method to group and message structure classes that returns all repetitions of repeatable children as a typed List. This is useful for quickly and easily iterating over structures within a message.

For example, ADT_A01 has a repeatable OBX segment. It is now possible to access it in three ways:
James Agnew
Add Add a new LowerLayerProtocol implementation which respects MSH-18 (Character Set) values to determine the underlying transport character set. See here for an example.

In addition, MinLowerLayerProtocol has received a new constructor which accepts a CharSet as a parameter, meaning that individual LLP instances may have their CharSet specified, as opposed to using a global System Property

Note that a dependency existed in HAPI 2.0-beta1 on XML libraries being present on the classpath. This has been corrected in HAPI 2.0. Fixes 3518763.
Jens Kristian Villadsen
Add Modernize a bunch of the code base to add proper generics support. Christian Ohr
Fix Fixed a race issue that starts the Receiver thread before an Application instance is attached. On the client side, when you don't use the ConnectionHub (you should!), make sure to call Connection#activate() before sending messages. On the server-side, this is done automatically. Fixes 3001226. Christian Ohr
Fix Correct an integer overflow issue when CommonTS#setValue(Calendar) is invoked with a calendar containing some high timezone offset values. Thanks to Jason Thompson for reporting and providing a fix. Fixes 3410095. Christian Ohr / Jason Thompson
Fix CommonTS#getValueAsCalendar() now sets the TimeZone associated with the returned Calendar object to have a TZ-offset equivalent to the offset provided in the raw HL7 data (e.g. if the value was "201201010800-0400", Calendar.setTimeZone(TimeZone) will be called with a timezone containing GMT-4:00).

This prevents issues when parsing times in a locale with Daylight Savings Time outside of the current DST window, such as parsing 201201010800-0400 in Toronto in June, when the DST offset is actually -0500.

James Agnew
Fix Correct several minor issues with CommonTS and TSComponentOne. Specifically:
  • Allow setValue(String) to work correctly if the previous value was invalid (instead of throwing a DataTypeException).
  • getValueAsDate() and getValueAsCalendar() now return null if the field contains null, instead of throwing a NullPointerException.
James Agnew
Add A new configuration bean, ParserConfiguration has been added which allows the parser to be configured for specific behaviour. See here for more information. James Agnew
Add Add a new method to Hl7InputStreamMessageStringIterator and Hl7InputStreamMessageIterator called setIgnoreComments(boolean) which allows the iterator to ignore lines beginning with a hash (#). This allows you to put comments in files being read by these classes. James Agnew
Fix Correct two issues with AbstractPrimitive#parse(String) This is the method which is used (for example) if parse is called on an ST type. Previously if an escape sequence (e.g. "Snakes \T\ Ladders") was passed into this method, it would appear double-escaped when the message was re-encoded, giving a string such as "Snakes \E\T\E\ Ladders". In addition, if this method was called and the string passed in contained a field delimiter (generally "^") this would lead to an IllegalArgumentException in some cases. Thanks to Diederik Muylwyk for reporting this and providing a test case! Diederik Muylwyk
Add Allow conformance profile structure generator to handle ID and IS type definitions with namespaced table numbers (e.g. IHE0155). These are now generated as special subclasses of ID and IS , called IDWithNamespace and ISWithNamespace respectively. These types have a method, getTableNamespace() which retrieves the non numeric part of the table name. Fixes 124. Eric Poiseau
Add Add a new method to Parser, parseForSpecificPackage, which parses messages using structure classes found in a particular package instead of using the built in HAPI defaults. Nicolas Lefebvre
Fix HL7 escape sequences, such as \X0000\, \H\, and \N\ are all now correctly handled when they are parsed and encoded. Previously, if one of these sequences were found within a field in a parsed message, they would be incorrectly encoded when the message was re-encoded. Thanks to anonymous bug poster for reporting this and providing a working test case!. Fixes 3323850. James Agnew
Add String structure types (ST, FT, TX) now have a new method getValueAsHtml() which converts any HL7 formatting codes (\H\, \.sp 55\, \.ce\, etc.) in the string to their HTML equivalent. This functionality can also be used to convert any other string containing HL7 formatting codes to the equivalent HTML codes using: FormattedTextEncoder Neal Acharya
Fix Calling stop() on HL7Server should also request that any processors which are active for that server stop as well. This prevents stray worker threads from staying alive and cluttering application logs after the server is stopped. James Agnew
Add Minor API changes:
  • Add a new method to Connection, getRemotePort, which returns the port number of the remote socket the connection is bound to.
  • Add several new factory methods to ConnectionHub which allow creating a new connection using an instantiated instance of a LowerLayerProtocol implementation instead of just supplying a type to be instantiated by ConnectionHub
  • Add new method to TwoPortService called getServiceExitedWithException(). In the event that the service exits unexpectedly, this method allows you to retrieve the exception which caused the failure (e.g. a BindException in the event that the port was already in use by another application).
  • Modify Conformance Profile DefaultValidator so that it can be used to validate individual parts of a message (e.g. only one segment, group, etc.) and not just the entire message
James Agnew
Fix Message#parse(java.lang.String) and Message#encode() now work correctly when the message parser is an XML based parser. Previously these convenience methods only worked for Pipe parsers. James Agnew
Fix Message#generateACK() now respects the ModelClassFactory used to build/parse the message from which the ACK is being generated. This means for example that if a CanonicalModelClassFactory is used to construct a message, that same CMCF will be used to generate its ACK. Thanks to Rahul Somasunderam for reporting this and providing a workaround!. Fixes 3471571. Christian Ohr
Fix The "Source" and "Javadoc" JAR bundles are once again being built and can be downloaded along with the library JARs themselves.
Add Add a system property to MessageIDGenerator which prevents it from failing if it is unable to read or write the message file. (Not that this feature sometimes failed to work in 2.0-beta1. This has been corrected.) James Agnew
Add MessageIDGenerator has been modified so that it will never fail in the event of a problem reading or writing a file. This should help with unpredictable failures when id_file permissions get messed up or id_file gets corrupted. James Agnew
Fix Correct an issue with the new ForcedEncode mode where for instance "PID-11-7" is read as "PID-1-7" and then incorrectly encoded. Fixes 3472728. mblanchette
Fix Prevent incorrect segment repetition number from appearing in validation failure exception messages. Thanks to Rahul for providing a report with a working test case. Fixes 3471934. Rahul Somasunderam (Certify)
Fix Provide the 2793050. Christian Ohr
Fix MessageTypeRouter calls Application#canProcess method of selected application before delegating message handling. Thanks for submitting a patch. Fixes 3520790. Christian Ohr
Fix DTM/TSComponentOne did not allow hour-precision timestamps as defined as of HL7 v2.5. Fixes 3519668. Christian Ohr
Fix DTM contained non-serializable primitives (CommonTS, CommonTM, CommonDT). Thanks to Guillaume (gga11729) for reporting. Fixes 3532775. Christian Ohr
Fix XMLParser now uses custom ModelClassFactory if provided. Thanks to Stephen Doxsee for reporting. Fixes 3530793. Christian Ohr
Fix Calling AbstractPrimitive#parse(String), for instance on an ST datatype, with a value of null now clears the value instead of throwing a NullPointerException. This brings the behaviour in line with that of AbstractComposite#parse(String) James Agnew
Fix RSP_K21 structure for v2.5.1 and v2.6 now has a repeatable QUERY_RESPONSE group. This addresses an inconsistency in the HL7 specification for those two versions. Thanks to Jens Villadsen for reporting. Fixes 3520523. Jens Villadsen
Fix ORL_O34 structure for v2.5.1 has two child structures with the same name (SPECIMEN). The second is now named OBSERVATION_REQUEST_SPECIMEN to prevent a recursive loop when parsing an ORL^O34 message. Thanks to Jure Grom for reporting. Fixes 3538074. Jure Grom
Fix ORL_O34 structure for v2.5 is missing an outer group called RESPONSE. This group contains only one nested group, so it doesn't do much but its absence could affect XML encoding. Thanks to Eric Poisseau for reporting. Fixes 3373654. Eric Poisseau
Fix MRG segment for v2.3 should have type XPN in position MRG.7 (Prior Patient Name) instead of type CX. Thanks to Fco. Javier Broullón for reporting. Fixes 3454369. Fco. Javier Broullón
Fix PID segment for v2.3 should allow repeatable elements in PID-5 (Patient Name). Thanks to Stéphane for reporting. Fixes 2864817. Stéphane

Release 1.2 – 2011-06-26

Type Changes By
Fix Fix one regression in HAPI 1.2-beta1, where a group containing at least one mandatory segment would sometimes be encoded as an empty segment even if no content was added to it. James Agnew
Add Add two new system properties which allow OBX segments messages to be parsed even if they are either missing, or have an invalid value in OBX-2 (which defines the datatype used in OBX-5). More information James Agnew
Add Add new utility classes for iterating over a file containing multiple ER7 encoded HL7 messages. See example James Agnew
Fix Fix an issue where calling AbstractPrimitive#parse(String) (for example on an ST datatype) would not clear pre-existing extra components if any were defined. James Agnew
Fix When encoding a group using the PipeParser where the first segment is required, but no data has been populated in that segment, the empty segment is now still encoded if needed as a blank segment in order to give parsers a hint about which group further segments are in. This helps to ensure that messages can be "round tripped", meaning that a message which is parsed, encoded, and then re-parsed should contain exactly the same structure from beginning to end. For example, in an ORU^R01 message with a populated OBX segment, but no data in the mandatory OBR segment which begins the ORDER_OBSERVATION group (see reference), the message would still contain an empty OBR segment when encoded:
	MSH|^~\&|REG|W|||201103230042||ORU^R01|32153168|P|2.5
	OBR|
	OBX||ST|||Value Data
Previously, the following encoding would have occurred, which would have incorrectly been parsed as having a custom OBX segment instead of having a normal ORDER_OBSERVATION group:
	MSH|^~\&|REG|W|||201103230042||ORU^R01|32153168|P|2.5
	OBX||ST|||Value Data
James Agnew
Add Group interface now has a new method: isGroup(String). This method allows callers to determine if a child structure is a segment or a group. The only provided implementation, AbstractGroup, implements this method, so the API change should not have any effect on users. James Agnew
Fix Restore missing get[FIELD_NAME]Reps() methods from segments. These were accidentally removed with the conversion to a Velocity based structure generator, but they have now been restored. James Agnew
Fix Avoid a NullPointerException if a null value is passed into the "setValue(Date)" or "setValue(Calendar)" methods on a DT, TS, or TM datatype. Passing in a null now simply clears any existing value, bringing these methods in line with the behaviour of the "setValue(String)" method. Thanks to Michael for reporting!. Fixes 3303344. James Agnew
Fix Fix potential race condition when using ConnectionHub in a multithreaded environment. Fixes 3307882. Stephane Giner
Fix Avoid line wrapping when XML encoding messages using the XMLParser. This means that values with very long strings won't have unexpected breaks added when they are encoded and re-parsed. Fixes 3308845. Axel Biernat
Fix Correct issue where extra components in primitive types within OBX-5 appear twice when message is re-encoded. This is useful, for example, if you are receiving messages from a system which is not correctly escaping ampersands or carats within an OBX-5 value. Prior to chis change, a message containing the following segment:
   OBX||ST|||F1C1^F2C1&F2C2
Would be re-encoded as:
   OBX||ST|||F1C1&F2C2^F2C1&F2C2
Thanks to Andbuty Choy for finding this.
James Agnew
Fix Prevent MessageIDGenerator (used to generate message control IDs for ACK messages, for example in SimpleServer) from throwing an exception if it is not able to parse the value found in id_file. Previously if something went wrong and this file was blank, a hard to debug exception was thrown. Now, control ID sequencing is simply reset to zero. Thanks to an anonymous bug submittor. Fixes 3306358. James Agnew
Fix Fix an issue where inserting/removing a repetition of the very last field in a segment fails due to an incorrect range check in AbstractSegment. Thanks Rodolfo for submitting!. Fixes 3264566. Rodolfo Chavez
Fix Where multiple structures are marked as associated with the same trigger event (example: ORN_O02 and ORR_O02 are both indicated as matching trigger ORR^O02) the parser will favour the structure whose name matches the event type and trigger (ORR_O02 in the previous example) when parsing a message with no structure explicitly defined in MSH-9-3. Fixes 3212931. James Agnew
Fix Fix an issue where subcomponents within a Varies (OBX-5) value are incorrectly handled. For example, if OBX-2 specifies a composite type, and the first component is also a composite, the first subcomponent (represented by the text F1C2 below) would be lost.
	OBX||AD|||F1C1&F1C2^F2C1
Ryan W. Gross
Fix Correct a PipeParser parsing issue: When a message is being parsed which contains multiple unexpected segments, any unexpected segments after the first one may appear out of order if the message is re-encoded. James Agnew

Release 1.1 – 2011-03-28

Type Changes By
Add HAPI libraries are now available in the Maven Central Repo. Thanks to Francis De Brabandere for figuring out how to make this happen!
Fix (Regression in 1.0-beta1) Some structures contained incorrect version information which led to inability to parse Z segments Christian Ohr
Add Message types now have a convenience method initQuickstart which sets default values to MSH segment (field separator, message type, etc) James Agnew
Add HAPI now has a Maven plugin which generates Message/Group/Segment struxctures based on an HL7 conformance profile. See the conformance page for more information. James Agnew
Add Allow users of HAPI SimpleServer to create an Application that handles errors. The provided patch adds an interface, which should be implemented by exception aware Applications. The application can then re-dispatch the provided ACK, or a create a completely new message. Fixes 3164756. Thanks to Gabriel Landais.
Fix Correct XML encoding of OMD_O03. (OMD_O03.DIET was incorrectly being encoded simply as "DIE"). Fixes 3115671. Thanks to Pepe Juarez.
Fix Correct the spelling of the name TIMING in a number of group structures (e.g. OML_O21_TIMING which was previously OML_O21_TIIMING). Fixes 3027567. Thanks to Karl Weller.
Update Update structure classes source generator to use an Apache Velocity based template instead of simple hard-coded string concatenation. This will make it much easier to add new features to the structures in the future. James Agnew
Update Message now has a method Message#printStructure(), which returns a useful String for debugging containing a description of the entire structure of the message James Agnew
Fix GenericParser ignores custom ModelClassFactory implementations passed into its constructor. Thanks to John R for reporting. James Agnew
Fix XML parser now parses subsequent datatype components correctly when a component is missing. E.g. if ED.1 is missing but ED.2 is present: Previously, ED.2 would be parsed as ED.1. Thanks to Yildiray Kabak.
Fix Parsing OBX-5 failed when value (as indicated by OBX-2) was a type which requires a table number (IS or ID). HAPI now defaults to table 0. Fixes 3031998. Thanks to Torsten from Agfa Healthcare.
Fix Parsing OBX-5 failed when value (as indicated by OBX-2) was a type which requires a table number (IS or ID). HAPI now defaults to table 0. Fixes 3027567. Thanks to Karl Weller.
Fix Add check to ConnectionHub to avoid returning a connection which was explicitly closed. Also update "send and receive" example in documentation to show correct way of discarding a connection using ConnectionHub. Thanks to Kalle Eskola.
Add HAPI now logs the current version as it is being initialized, for troubleshooting purposes. James Agnew
Add Add getters and setters to DT, TM, and TS data types to get and set values using standard Java Date and Calendar objects. (Examples here and here) James Agnew
Add Add factory method to PipeParser which returns an instance with validation disabled (useful for one-liner parse routines) James Agnew
Add Add system property to allow OBX-2 to contain invalid values and still parse James Agnew

Release 1.0.1 – 2010-05-16

Type Changes By
Fix Correct an issue where a NullPointerException occurs if a mandatory segment at the end of a message is not present. Fixes 3002194. Thanks to Irving Reid.

Release 1.0 – 2010-04-12

Type Changes By
Fix Correct regression introduced in 1.0-beta1 where a second segment within a group with the same name (i.e. the two PID segments in an ADT^A17) fails to parse correctly.
Fix Provide default implementation of new abstract method "createNewTypeWithoutReflection" on AbstractSegment class to prevent breaking existing user defined types. Thanks to Christian Ohr for reporting.
Update Clean up logging in ServerSocketStreamSource (used by HL7Server) so that it doesn't spew unneccesary logs while waiting for a connection James Agnew
Update Remove all test suites (not tests, just the suites), as they cause maven to execute tests twice, and clean up test execution. Full test suie execution is down to ~90 seconds from 10 mins. James Agnew
Add Add two new ModelClassFactory implementations: CanonicalModelClassFactory (always returns the same version), and CustomModelClassFactory (provides easy way to use custom structure packages) Thanks to Christian Ohr, Niranjan Sharma.
Fix Fix a bug where formatting escape sequences were stripped from messages (i.e. leave sequences such as /.br/ alone) James Agnew
Add Overhaul Escape class (handles HL7 escape sequences) to dramatically improve performance Thanks to Christian Ohr.
Fix Fix NullPointerException in DefaultValidator when no table present for an ID datatype. Fixes 1809573. Thanks to Jan Klasser.
Fix Allow parsing of unknown message types for 2.5.1 and 2.6 messages James Agnew
Update Convert HAPI source version JDK 5.0. This allows the use (and begins a gradual conversion) to generics by HAPI's internal structures. Support for JDK1.4 will still remain through version specific JARs produced by RetroTranslator. James Agnew
Add Add getNames() method to Segment, to allow programatic access to segment's field names (needed by hUnit) James Agnew
Fix Fix serialization of HAPI Message objects. Also added serialVersionUID to a number of core classes. Fixes 1263250. Thanks to Gerald Bortis, Christian Ohr.
Fix Fix a memory leak in Escape.java when lots of different encoding chars are used Thanks to Chris Busch.
Fix Modify ProcessorImpl (HL7Server processing class) to use an ExecutorService instead of spawning a new thread for each message to generate ACKs. James Agnew
Fix Fix XML parsing of seg groups containing more than one instance of the same segment (e.g. A17). Fixes 2164291. Thanks to Gerald Bortis, Polloloco.

Release 0.6 – 2009-07-01

Type Changes By
Add Add constructors to all parser types allowing a custom model factory. Fixes 2793054. Thanks to Christian Ohr.
Fix Fix XML parsing of seg groups containing more than one instance of the same segment (e.g. A17). Fixes 2164291. Thanks to Gerald Bortis, Polloloco.
Add Added isRunning() method to SimpleServer Thanks to Peter Gershkovich.
Add Add NULLDT datatype, to be used in withdrawn fields. Note that default validation expects this datatype to be empty, but custom validation does not need to enforce this. James Agnew
Add Add setEncoding method to XmlParser to allow text encoding to be specified when creating XML messages. In response to mailing list query from Fernando Ramírez Sánchez James Agnew
Add Add single argument constructor to ID datatype, to allow it to be used in OBX-5. Fixes 1890219. Thanks to Chris Horneck.
Add New HAPI maven repository now available at http://hl7api.sourceforge.net/m2/ James Agnew
Fix Make PipeParser not crash on empty segments (meaning segments with just a segment name, no field separator or fields) Thanks to Frédéric Dubru.
Fix NullPointerException if OBX-2 is invalid and OBX-5 is set. Fixes 1662979. Thanks to Greg Groves.
Fix Parsing fails when (pipe) is used as non-field separator. Fixes 1657929. btripp
Add Allow Parser to accept a null ValidationContext, which will prevent any attempt at validating messages from being made. James Agnew
Add Allow Parsers now get their default validation context from ValidationContextFactory if none is supplied Thanks to Andy Pardue.
Add Allow A new system property (See Varies JavaDoc) may be specified to supply a default datatype to be assumed for OBX-5 if none is found in OBX-2. A missing OBX-2 is not a valid case, but this property would allow a user to work around problems receiving from a bad message source Thanks to Andy Pardue.

Release 0.5.1 – 2007-02-18

Type Changes By
Fix Remove JDK 5 dependency James Agnew

Release 0.5 – 2006-12-14

Type Changes By
Fix hapi 0.4.3 Class Parser : Multi-threading conflict can occur. Fixes 1557203.
Fix Unescaping in XMLParser.getCriticalResponseData(). Fixes 1547989.
Fix PipeParser.getCriticalResponseData() does not use version. Fixes 1539866.
Fix NullPointerException on garbage messages. Fixes 1539352.
Fix Class ExtraComponents not Serializable. Fixes 1536231.
Fix "I" instead of "PID" freezes the parser. Fixes 1536200.
Fix validation contexts are not used during parsing. Fixes 1525034.
Fix Error generating error responses for XML messages. Fixes 1525029.
Fix SIU S12 Segment Issue. Fixes 1482059.
Fix DFT-P03 - incorrect message structure. Fixes 1405670.
Fix NM integer magnitude limited to java int. Fixes 1377382.
Fix ORU_R01_OBSERVATION incorrectly defined. Fixes 1368028.
Fix OBX-5 type assignment only operates on first rep. Fixes 1284281.
Fix Missing Code in Version 2.5. Fixes 260957.
Fix ORL_O34 message incorrectly defined. Fixes 1240698.