Free Support Forum - aspose.com

Maximum number of emails in PST / in Folder in PST


#1

Hi,
Tried to create a PST based on customer emails, (overall over 1m emails), and started to get exception (after 610804 emails) :
java.lang.NegativeArraySizeException
at com.aspose.email.wu$a.a(SourceFile:1056)
at com.aspose.email.wu.a(SourceFile:461)
at com.aspose.email.wu.a(SourceFile:270)
at com.aspose.email.ayl.a(SourceFile:285)
at com.aspose.email.adz.g(SourceFile:1958)
at com.aspose.email.adz.d(SourceFile:778)
at com.aspose.email.aqk.a(SourceFile:995)
at com.aspose.email.FolderInfo.addMessage(SourceFile:726)

After 610804 was not able to add anymore emails to the PST.
Please advise.
Thanks


#2

@slavago

I have observed your comments. Can you please share source file and sample code so that we may further investigate to help you out.


#3

This is the code that actually is doing the job :

static void createPST(String emlPath, List<String> emailFiles) {
	MapiConversionOptions options = new MapiConversionOptions(OutlookMessageFormat.Unicode);
	options.setUseBodyCompression(false);
	PersonalStorage pst = PersonalStorage.create("/tmp/mails.pst", FileFormatVersion.Unicode);
	FolderInfo tmpFolder = pst.getRootFolder().addSubFolder(Localization.PSTDEFAULTEXPORTFOLDER);
	EmlLoadOptions loadOption = new EmlLoadOptions();
	Charset utf8Charset = Charset.forName(CAConstants.UTF8);
	loadOption.setPrefferedTextEncoding(utf8Charset);
	loadOption.setPreserveTnefAttachments(true);
	for(String emailFile : emailFiles) {
		addMessageToPSt(loadOption, options, emlPath, tmpFolder, emailFile);
	}
	pst.dispose();
}

static void addMessageToPSt(EmlLoadOptions loadOption, MapiConversionOptions options, String emlPath, FolderInfo folder, final String emailFileName) {	
	final MailMessage eml = MailMessage.load(emlPath + "/" + emailFileName, loadOption);
	final MapiMessage mapi = MapiMessage.fromMailMessage(eml, options);
	folder.addMessage(mapi);
}

As for emails data, I cant’ send it to you as it’s confidential and huge. But I guess you should have test data to test such large volume of emails.

You can clearly see from the exception I’ve sent that issue is inside your library.

Thanks


#4

@slavago,

I have worked with the issue shared by you and an issue with ID EMAILJAVA-34492 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.