We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

NegativeArraySizeException when iterating messages in NotesStorageFacility

When iterating the messages in an nsf archive I get this exception:

Exception in thread “main” java.lang.NegativeArraySizeException: -98
at com.aspose.email.zaqj.a(SourceFile:223)
at com.aspose.email.zaqj.a(SourceFile:83)
at com.aspose.email.zfw.a(SourceFile:53)
at com.aspose.email.zlt.b(SourceFile:252)
at com.aspose.email.zlt.a(SourceFile:27)
at com.aspose.email.zlt$za.hasNext(SourceFile:340)
at com.stormed.processing.flattening.extractor.NsfExtractor.main(NsfExtractor.java:47)

Using this dependency:

compile group: ‘com.aspose’, name: ‘aspose-email’, version: ‘20.4’, classifier: ‘jdk16’

Here is the code to reproduce the issue

public static void main(String[] args){
String path = “”;
NotesStorageFacility nsf = new NotesStorageFacility(path);
ExtractionResults info = new ExtractionResults();
File destination = new File("");
int count = 0;
for (MailMessage message : nsf.enumerateMessages()) {
MapiMessage mapiMessage = MapiMessage.fromMailMessage(message);
String fileName = Paths.get(destination.toString(), String.valueOf(count)).toString();
mapiMessage.save(fileName + “.eml”, SaveOptions.getDefaultEml());

Attaching nsf to recreate this issue.
test.zip (6.2 MB)


I have verified from our issue tracking system and like to share that an issue with ID EMAILJAVA-34696 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.

@mudassir.fayyaz Hi, would you be able to provide any timeline for a fix on this? We were looking to start leveraging Aspose for NSF files, but ran into this bug with the first file that we pointed it to. It needs to be fixed before we can even begin to evaluate whether or not to use the platform.


I have verified from our issue tracking system and regret to share that the issue is still unresolved. It has been added recently in our issue tracking system. We request for your patience till the time the feedback is shared and issue gets resolved. We will share the notification with you once it will be fixed.

Hi @mudassir.fayyaz, it has almost been a month on this issue. Is there any update on a timeline to share or has it not even been considered yet?


I have verified from our issue tracking system and regret to share that at present the issue is still unresolved. We request for your patience and will be able to share further details with you as soon as the issue will be addressed.

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