For all HIPAA OTDs, including the envelope OTDs, when the incoming message cannot be parsed, for example, if the OTD cannot find the ISA segment, then the unmarshal() method generates a com.stc.otd.runtime.UnmarshalException.
The cause of the UnmarshalException depends on which envelope threw the exception:
You can also use the isUnmarshalComplete() method on an OTD to verify whether the unmarshal() method completed successfully. Successful completion does not guarantee that the OTD instance is free of data errors within segments and composites because elements are not unmarshaled until the first invocation of the leaf element getElementXxxx() method of a segment or composite. For more information, refer to On Demand Parsing.
Encountering this exception triggers an automatic background unmarshal of the entire segment. Note that the value returned by the isUnmarshalComplete() method is not influenced by the outcome of the automatic background unmarshal, instead, its value reflects what was set by the explicit invocation of the unmarshal() method.