While opening a winmail.dat file I get a BufferUnderrunException. The message is properly opened and displayed if forwarded to an outlook.com email address. My code is trivial: HMEFContentsExtractor ext = new HMEFContentsExtractor(tnefFile); I cannot include a sample file as it is confidential customer information, however, I can privately share samples for testing, I have hundreds. I have also tried and failed opening with these utilities: * http://www.freeutils.net/source/jtnef/ java library * http://tud.at/php/tnef/ online tnef extractor * http://www.winmail-dat.com/online.php online tnef extractor * http://github.com/verdammelt/tnef C utility on linux * http://www.joshjacob.com/mac-development/tnef.php OSX app * Forward to gmail.com email address I was thinking the winmail.dat file was corrupt until I sent to outlook.com and it worked perfectly. Stack trace: org.apache.poi.util.LittleEndian$BufferUnderrunException: buffer underrun at org.apache.poi.util.LittleEndian.readUShort(LittleEndian.java:804) at org.apache.poi.hmef.attribute.TNEFAttribute.create(TNEFAttribute.java:61) at org.apache.poi.hmef.HMEFMessage.process(HMEFMessage.java:74) at org.apache.poi.hmef.HMEFMessage.process(HMEFMessage.java:98) at org.apache.poi.hmef.HMEFMessage.process(HMEFMessage.java:98) at org.apache.poi.hmef.HMEFMessage.process(HMEFMessage.java:98) at org.apache.poi.hmef.HMEFMessage.process(HMEFMessage.java:98) at org.apache.poi.hmef.HMEFMessage.process(HMEFMessage.java:98) at org.apache.poi.hmef.HMEFMessage.process(HMEFMessage.java:98) at org.apache.poi.hmef.HMEFMessage.process(HMEFMessage.java:98) at org.apache.poi.hmef.HMEFMessage.process(HMEFMessage.java:98) at org.apache.poi.hmef.HMEFMessage.<init>(HMEFMessage.java:63) at org.apache.poi.hmef.extractor.HMEFContentsExtractor.<init>(HMEFContentsExtractor.java:63) ... my code
I'd suggest attaching a debugger, and stepping through. Focus on the attributes just before it goes wrong, as well as the one it fails on - check if they look sensible, sizes and types are sensible, values read match the ones that outlook shows etc. That should help you identify if the problem is with the failing attribute, or if it's actually a problem with a preceeding one which wrecks the state
Unfortunately there is not much we can do without a sample file, therefore I am closing this for now, please reopen if you can provide a file.