I receive a file on email which I read using javamail API and save it onto disk directory
Now another program polls that disk directory and reads all incoming file. I am only concerned with File extensions - xls/xlsx, so I use apache poi to read the files:
This sometimes(read random) results in error as below
[2013-07-18 23:38:32,409] ERROR [AvailabilityDirectoryPoller]: Exception in I/O Reading file
java.io.IOException: Your file contains 79 sectors, but the initial DIFAT array at index 1 referenced block # 98. This isn't allowed and your file is corrupt
at com.deltax.util.listener.SignalQueue.run(Unknown Source)
If I open the javamail saved file in MS Excel, it opens with no warnings/errors.
And... does this always happen with Excel files sent by e-mail? Or only one particular file? Have you acquired a copy of that file via some other method and compared it to the result of saving it via JavaMail? Are you sure that the polling program waited for your file-saving code to finish before grabbing the file?
I've got no option but to sell you all for scientific experiments. Or a tiny ad: