Free Support Forum - aspose.com

NullPointerException, Aspose Java

Get NullPointerException when extracting emails from one of the pst archive provided by client.
Our company owns license for [Aspose.Email for Java 17.12], I check last version (20.1) thinking to upgrade and it have the same issue.

private void extractFoldersContent(FolderInfo folderInfo, PersonalStorage pst, String pstFolder)
throws Exception {
MessageInfoCollection messageInfoCollection = folderInfo.getContents();
for (int i = 0; i < messageInfoCollection.size() ; i++) {
MessageInfo messageInfo = messageInfoCollection.get_Item(i);
MapiMessage mapiMessage = null;
try {
mapiMessage = pst.extractMessage(messageInfo);

exception:

java.lang.NullPointerException
at com.aspose.email.zaoi.d(SourceFile:2536) ~[aspose-email-20.1.jar:20.1]
at com.aspose.email.zaoi.b(SourceFile:307) ~[aspose-email-20.1.jar:20.1]
at com.aspose.email.zaoi.d(SourceFile:1350) ~[aspose-email-20.1.jar:20.1]
at com.aspose.email.zxq.h(SourceFile:526) ~[aspose-email-20.1.jar:20.1]
at com.aspose.email.zxq.(SourceFile:98) ~[aspose-email-20.1.jar:20.1]
at com.aspose.email.zatj.(SourceFile:66) ~[aspose-email-20.1.jar:20.1]
at com.aspose.email.zafu.a(SourceFile:309) ~[aspose-email-20.1.jar:20.1]
at com.aspose.email.zats.b(SourceFile:336) ~[aspose-email-20.1.jar:20.1]
at com.aspose.email.zats.a(SourceFile:295) ~[aspose-email-20.1.jar:20.1]
at com.aspose.email.PersonalStorage.extractMessage(SourceFile:561) ~[aspose-email-20.1.jar:20.1]
at com.fusemail.pstimport.PstExtractor.extractFoldersContent(PstExtractor.java:183) [classes/:?]
at com.fusemail.pstimport.PstExtractor.processFolderContents(PstExtractor.java:148) [classes/:?]
at com.fusemail.pstimport.PstExtractor.processFolderContents(PstExtractor.java:154) [classes/:?]
at com.fusemail.pstimport.PstExtractor.processFolderContents(PstExtractor.java:154) [classes/:?]
at com.fusemail.pstimport.PstExtractor.processFolderContents(PstExtractor.java:154) [classes/:?]
at com.fusemail.pstimport.PstExtractor.startImport(PstExtractor.java:115) [classes/:?]
at com.fusemail.pstimport.PstImportMain.extractEmailsFromArchive(PstImportMain.java:229) [classes/:?]
at com.fusemail.pstimport.PstImportMain.main(PstImportMain.java:137) [classes/:?]
I assume problem in your code, not how I use library.
Thank you for comments

@amazurok,

I have observed the issue shared by you and request you to please share the source PST file creating the issue along with working sample code that we may put to test in our environment. Please share the requested information so that we may proceed further to help you.

Sorry Mudassir, security reason doesn’t allow me to share any data provided by client.

@amazurok,

You may share the requested information privately with me as well by clicking my icon in this response and using Message option. Without provision of requested information, we may not be able to proceed further and help you out.