Free Support Forum -

ArgumentException: Offset or count were out of bounds - Java Email


In the most recent version of the Java Email library I’m seeing the following error when trying to extract messages from a PST in EML format:

class Offset or count were out of bounds Source) Source) Source) Source) Source) Source) Source)

Here is the calling code:

private void extractEmlFile(FolderInfo folderInfo, PersonalStorage pst) {

MessageInfoCollection messageInfoCollection = folderInfo.getContents();

MessageInfo messageInfo = (MessageInfo) messageInfoCollection.get(0);

MapiMessage message = pst.extractMessage(messageInfo);



Any help would be appreciated.


Hi David,

Thank you for upgrading to the latest version.

I have analyzed your problem statement and tried to reproduce the same at my end with sample PST file having Calendar entries, but no such exception was raised. The issue seems to be related to specific PST file that you are testing at your end. Please share the sample file with us so that we can investigate the issue at our end and assist you further.

I’ve attached a zip file that has two files in it.

One is a PST that contains the message in question. The other is the same file in .MSG format.

Both of which throw the following error when I attempt to convert them to EML:

Exception in thread “main” class Offset or count were out of bounds Source) Source) Source) Source) Source) Source) Source) Source) Source) Source)

PS - It would also be great if your attachment uploader allowed .PST and .MSG extension to be uploaded, this seems like a fairly common use case.

Thank you for writing to Aspose support team.

I was able to reproduce the exception using Aspose.Email for Java 5.3.0. This issue has been logged as EMAILJAVA-33501 in our bug tracking system for further investigation by our product team. We shall notify you here once any information is available about the issue.

Thank you.

Is there a rough timeline as to when a fix will be available?

Hi David,

I have checked the status of this issue from our issue tracking system and have found that it is still pending for analysis by our Product Team. Probably it may get rectified in the next version of Aspose.Email for Java 5.4.0 which will be available by the mid of next month. We shall share the information with as and when available.

The issues you have found earlier (filed as EMAILJAVA-33501) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.