Source:
<code>private void extractAttachments(EmailMessage email, PSTMessage msg, long fileID) { int numberOfAttachments = msg.getNumberOfAttachments(); String outputDirPath; try { outputDirPath = ThunderbirdMboxFileIngestModule.getModuleOutputPath() + File.separator; } catch (NoCurrentCaseException ex) { logger.log(Level.SEVERE, "Exception while getting open case.", ex); return; } for (int x = 0; x < numberOfAttachments; x++) { String filename = ""; try { PSTAttachment attach = msg.getAttachment(x); long size = attach.getAttachSize(); long freeSpace = services.getFreeDiskSpace(); if ((freeSpace != IngestMonitor.DISK_FREE_SPACE_UNKNOWN) && (size >= freeSpace)) { continue; } filename = attach.getLongFilename(); if (filename.isEmpty()) { filename = attach.getFilename(); } String uniqueFilename = fileID + "-" + msg.getDescriptorNodeId() + "-" + attach.getContentId() + "-" + filename; String outPath = outputDirPath + uniqueFilename; saveAttachmentToDisk(attach, outPath); EmailMessage.Attachment attachment = new EmailMessage.Attachment(); long crTime = attach.getCreationTime() != null ? attach.getCreationTime().getTime() / 1000 : 0; long mTime = attach.getModificationTime() != null ? attach.getModificationTime().getTime() / 1000 : 0; String relPath = getRelModuleOutputPath() + File.separator + uniqueFilename; attachment.setName(filename); attachment.setCrTime(crTime); attachment.setmTime(mTime); attachment.setLocalPath(relPath); attachment.setSize(attach.getFilesize()); attachment.setEncodingType(TskData.EncodingType.XOR1); email.addAttachment(attachment); <START> } catch (PSTException | IOException | NullPointerException | NoCurrentCaseException ex) { <END> addErrorMessage( NbBundle.getMessage(this.getClass(), "PstParser.extractAttch.errMsg.failedToExtractToDisk", filename)); logger.log(Level.WARNING, "Failed to extract attachment from pst file.", ex); } } }</code><technical_language>NoCurrentCaseException in a separate catch error logged SEVERE</technical_language>

Target:
private void extractAttachments(EmailMessage email, PSTMessage msg, long fileID) { int numberOfAttachments = msg.getNumberOfAttachments(); String outputDirPath; try { outputDirPath = ThunderbirdMboxFileIngestModule.getModuleOutputPath() + File.separator; } catch (NoCurrentCaseException ex) { logger.log(Level.SEVERE, "Exception while getting open case.", ex); return; } for (int x = 0; x < numberOfAttachments; x++) { String filename = ""; try { PSTAttachment attach = msg.getAttachment(x); long size = attach.getAttachSize(); long freeSpace = services.getFreeDiskSpace(); if ((freeSpace != IngestMonitor.DISK_FREE_SPACE_UNKNOWN) && (size >= freeSpace)) { continue; } filename = attach.getLongFilename(); if (filename.isEmpty()) { filename = attach.getFilename(); } String uniqueFilename = fileID + "-" + msg.getDescriptorNodeId() + "-" + attach.getContentId() + "-" + filename; String outPath = outputDirPath + uniqueFilename; saveAttachmentToDisk(attach, outPath); EmailMessage.Attachment attachment = new EmailMessage.Attachment(); long crTime = attach.getCreationTime() != null ? attach.getCreationTime().getTime() / 1000 : 0; long mTime = attach.getModificationTime() != null ? attach.getModificationTime().getTime() / 1000 : 0; String relPath = getRelModuleOutputPath() + File.separator + uniqueFilename; attachment.setName(filename); attachment.setCrTime(crTime); attachment.setmTime(mTime); attachment.setLocalPath(relPath); attachment.setSize(attach.getFilesize()); attachment.setEncodingType(TskData.EncodingType.XOR1); email.addAttachment(attachment); } catch (PSTException | IOException | NullPointerException ex) { addErrorMessage( NbBundle.getMessage(this.getClass(), "PstParser.extractAttch.errMsg.failedToExtractToDisk", filename)); logger.log(Level.WARNING, "Failed to extract attachment from pst file.", ex); } catch (NoCurrentCaseException ex) { addErrorMessage(Bundle.PstParser_noOpenCase_errMsg()); logger.log(Level.SEVERE, Bundle.PstParser_noOpenCase_errMsg(), ex); } } }