}
String uniqueFilename = filename + "-" + email.getSentDate();
String outPath = outputDirPath + uniqueFilename;
FileOutputStream fos;
BinaryBody bb;
try {
fos = new FileOutputStream(outPath);
} catch (FileNotFoundException ex) {
addErrorMessage(
NbBundle.getMessage(this.getClass(),
"MboxParser.handleAttch.errMsg.failedToCreateOnDisk", outPath));
logger.log(Level.INFO, "Failed to create file output stream for: " + outPath, ex); //NON-NLS
return;
}
try {
Body b = e.getBody();
if (b instanceof BinaryBody) {
bb = (BinaryBody) b;
bb.writeTo(fos);
} else {
// This could potentially be other types. Only seen this once.
}
} catch (IOException ex) {
logger.log(Level.INFO, "Failed to write mbox email attachment to disk.", ex); //NON-NLS