Free Support Forum - aspose.com

MailMessage not report exception when loading random bytes array

I’m using 18.6 aspose email for java lib. I use the following code to load a random byte array into pst file. It didn’t report any parsing exception and successfully add an empty email to pst file. I’m wondering why there is no exception thrown because our code is expecting exception for wrong formatted email and record it. If every wrong formatted email are translated to empty message that would defeat our purpose.

PersonalStorage pstFile = PersonalStorage.create(
GoogleFile.SYSTEM.newOutputStream("/usr/local/google/home/jiarongl/test.pst", AccessMode.WRITE), 0);
byte[] rawMessage = new byte[500];
Randoms.insecureRandom().nextBytes(rawMessage);
MailMessage mailMessage = MailMessage.load(new ByteArrayInputStream(rawMessage));
MapiConversionOptions conversionOptions = new MapiConversionOptions();
conversionOptions.setPreserveOriginalAddresses(true);
MapiMessage mapiMessage = MapiMessage.fromMailMessage(mailMessage, conversionOptions);
pstFile.getRootFolder().addMessage(mapiMessage);

@jiarongl,

We have logged your requirement as EMAILNET-39050 for further consideration at our end and will update you here once there is some feedback available in this regard.

The issues you have found earlier (filed as EMAILNET-39050) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by kashif.iqbal