For all UN/EDIFACT OTDs, including the two envelope OTDs, if the incoming message cannot be parsed (for example, if the OTD cannot find the UNB segment), then the unmarshal() method generates a com.stc.otd.runtime.UnmarshalException.
You can also use the isUnmarshalComplete() method to learn whether unmarshal() executed without reporting any errors. Successful completion does not guarantee that the OTD instance is free of unmarshal exceptions within segments, however, since elements are not unmarshaled until the first getElementXxxx() method of a segment is encountered (see On Demand Parsing). Encountering this triggers an automatic background unmarshal of the entire segment. Note that the value returned by isUnmarshalComplete() 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.