ArrayIndexOutOfBoundsException on iterating FolderInfo Content of OST (Java)

Hi,

I am attempting to iterate over the folders in an OST (2016 version if that matters) and save off the messages in them, similar to the examples here [1]. When running, it gets through the first couple folders until it hits the Calendar folder, where when I do the FolderInfo.getContents() it throws this exception [2]. Here is the code that is running [3], and I have attached the ost file that is failing. We have ran a handful of other pst/ost files through the same code and this is the only one that seems to be causing the issue. Also we ran the same ost file through the C# Email library doing essentially the same logic with no issues.

[1] https://github.com/aspose-email/Aspose.Email-for-Java/blob/master/Examples/src/main/java/com/aspose/email/examples/outlook/pst/PSTExtractMessages.java
[2] Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
at com.aspose.email.internal.ak.a.a(Unknown Source)
at com.aspose.email.internal.ak.a.a(Unknown Source)
at com.aspose.email.system.BitConverter.toInt16(Unknown Source)
at com.aspose.email.aqq.a(SourceFile:439)
at com.aspose.email.MessageInfo.a(SourceFile:168)
at com.aspose.email.MessageInfo.(SourceFile:99)
at com.aspose.email.aqm$d.b(SourceFile:2986)
at com.aspose.email.aqm$d.hasNext(SourceFile:2952)
at com.aspose.email.aqm.a(SourceFile:602)
at com.aspose.email.aqm.a(SourceFile:574)
at com.aspose.email.FolderInfo.getContents(SourceFile:451)
at com.stormed.processing.flattening.extractor.PstExtractor.extractFolder(PstExtractor.java:49)

[3]
int messageNumber = 0;
for (MessageInfo messageInfo : folder.getContents()) {
MapiMessage message = pst.extractMessage(messageInfo);
IMapiMessageItem item = message.toMapiMessageItem();

String fileName = getDirectoryString(folderPath, messageNumber);
if (item instanceof MapiContact) {
	((MapiContact) item).save(fileName + ".vcf", SAVE_OPTIONS_VCARD);
} else {
	message.save(fileName + ".eml", SAVE_OPTIONS_EML);
}
messageNumber++;

}

@mstandfuss,

I have observed the issue shared by you and request you to please try using latest Aspose.Email for Java 19.1 on your end. If there is still an issue then please share the source OST file reproducing the issue so that we may proceed further to help you.

Hi thanks for the response. I am currently using the 19.1 version, the ost file producing the error was also uploaded to the original post. Let me know if it is not showing up on your end and I can reupload it again.

Thanks
Mike

@mstandfuss,

I regret to share that I am unable to find any attachment. Can you please share the file again so that I may proceed further.

Ok I am trying it again, please let me know if you find it now.

@mstandfuss,

I am still unable to see the attachment. Can you please share that.

I am clicking on the Upload button above, browsing to the zip file on my local desktop, and selecting it to upload. Can you tell me of another way to upload it? Seems that is not working.

@mstandfuss,

You can please share the file by upload on some FTP server of Dropbox and providing the download link to us. If your file is more than 3 MB then you can upload the file in Aspose forums.

The FTP server of Dropbox the will be going to provide the overall work which will assign the part for array bound exception which will immense the overall [netgear r6700 review ](https://netgears.support/blog/netgear-r6700-nighthawk-ac1750-review/) that can easily able to upload the aspose attachment.

Please try this link and let me know if you are still having issues downloading the ost.

https://www.dropbox.com/s/gu0i9sernod0v1q/qafost%40epiqsystems.com(2016).ost?dl=0

@mstandfuss
@waidepaine,

Thank you for sharing the information with us. Can you please share the working sample code reproducing the issue as the previously shared code is not complete. I really appreciate your cooperation in this regard.

Please use the link to the Aspose.Email for Java example code I provided in the first link.

https://github.com/aspose-email/Aspose.Email-for-Java/blob/master/Examples/src/main/java/com/aspose/email/examples/outlook/pst/PSTExtractMessages.java.

The snippet I provided of my code was just to show that I am essentially using the same logic.

@mstandfuss,

I have worked with the sample code and file shared by you and have been able to observe the issue specified. An issue with ID EMAILJAVA-34507 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

Thank you, appreciate you help.

The issues you have found earlier (filed as EMAILJAVA-34507) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by muhammadahmad