Merge pull request #680 from mrtizmo/thunderbird

ThunderbirdParser - added NON-NLS tags
This commit is contained in:
Richard Cordovano 2014-04-23 10:34:38 -04:00
commit 16f081ea8e
3 changed files with 35 additions and 35 deletions

View File

@ -71,7 +71,7 @@ import org.sleuthkit.autopsy.ingest.IngestServices;
/**
* The mime type string for html text.
*/
private static final String HTML_TYPE = "text/html";
private static final String HTML_TYPE = "text/html"; //NON-NLS
/**
* The local path of the mbox file.
@ -89,7 +89,7 @@ import org.sleuthkit.autopsy.ingest.IngestServices;
}
static boolean isValidMimeTypeMbox(byte[] buffer) {
return (new String(buffer)).startsWith("From ");
return (new String(buffer)).startsWith("From "); //NON-NLS
}
/**
@ -115,7 +115,7 @@ import org.sleuthkit.autopsy.ingest.IngestServices;
} catch (IllegalArgumentException ex) {
// Not the right encoder
} catch (IOException ex) {
logger.log(Level.WARNING, "couldn't find mbox file.", ex);
logger.log(Level.WARNING, "couldn't find mbox file.", ex); //NON-NLS
addErrorMessage(NbBundle.getMessage(this.getClass(), "MboxParser.parse.errMsg.failedToReadFile"));
return new ArrayList<>();
}
@ -136,7 +136,7 @@ import org.sleuthkit.autopsy.ingest.IngestServices;
Message msg = messageBuilder.parseMessage(message.asInputStream(theEncoder.charset()));
emails.add(extractEmail(msg));
} catch (IOException ex) {
logger.log(Level.WARNING, "Failed to get message from mbox: {0}", ex.getMessage());
logger.log(Level.WARNING, "Failed to get message from mbox: {0}", ex.getMessage()); //NON-NLS
failCount++;
}
}
@ -236,7 +236,7 @@ import org.sleuthkit.autopsy.ingest.IngestServices;
break;
}
} catch (IOException ex) {
logger.log(Level.WARNING, "Error getting text body of mbox message", ex);
logger.log(Level.WARNING, "Error getting text body of mbox message", ex); //NON-NLS
}
}
@ -259,7 +259,7 @@ import org.sleuthkit.autopsy.ingest.IngestServices;
addErrorMessage(
NbBundle.getMessage(this.getClass(),
"MboxParser.handleAttch.errMsg.failedToCreateOnDisk", filename));
logger.log(Level.INFO, "Failed to create file output stream for: " + outPath, ex);
logger.log(Level.INFO, "Failed to create file output stream for: " + outPath, ex); //NON-NLS
return;
}
@ -272,14 +272,14 @@ import org.sleuthkit.autopsy.ingest.IngestServices;
// 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);
logger.log(Level.INFO, "Failed to write mbox email attachment to disk.", ex); //NON-NLS
addErrorMessage(NbBundle.getMessage(this.getClass(), "MboxParser.handleAttch.failedWriteToDisk", filename));
return;
} finally {
try {
fos.close();
} catch (IOException ex) {
logger.log(Level.INFO, "Failed to close file output stream", ex);
logger.log(Level.INFO, "Failed to close file output stream", ex); //NON-NLS
}
}
@ -338,7 +338,7 @@ import org.sleuthkit.autopsy.ingest.IngestServices;
try {
is = new BufferedInputStream(new FileInputStream(mboxFile));
} catch (FileNotFoundException ex) {
logger.log(Level.WARNING, "Failed to find mbox file while detecting charset");
logger.log(Level.WARNING, "Failed to find mbox file while detecting charset"); //NON-NLS
return possibleEncoders;
}
@ -355,18 +355,18 @@ import org.sleuthkit.autopsy.ingest.IngestServices;
}
return possibleEncoders;
} catch (IOException | IllegalArgumentException ex) {
logger.log(Level.WARNING, "Failed to detect charset of mbox file.", ex);
logger.log(Level.WARNING, "Failed to detect charset of mbox file.", ex); //NON-NLS
return possibleEncoders;
} finally {
try {
is.close();
} catch (IOException ex) {
logger.log(Level.INFO, "Failed to close input stream");
logger.log(Level.INFO, "Failed to close input stream"); //NON-NLS
}
}
}
private void addErrorMessage(String msg) {
errors.append("<li>").append(msg).append("</li>");
errors.append("<li>").append(msg).append("</li>"); //NON-NLS
}
}

View File

@ -88,11 +88,11 @@ class PstParser {
}
return ParseResult.OK;
} catch (PSTException | IOException ex) {
String msg = file.getName() + ": Failed to create internal java-libpst PST file to parse:\n" + ex.getMessage();
String msg = file.getName() + ": Failed to create internal java-libpst PST file to parse:\n" + ex.getMessage(); //NON-NLS
logger.log(Level.WARNING, msg);
return ParseResult.ERROR;
} catch (IllegalArgumentException ex) {
logger.log(Level.INFO, "Found encrypted PST file.");
logger.log(Level.INFO, "Found encrypted PST file."); //NON-NLS
return ParseResult.ENCRYPT;
}
}
@ -130,7 +130,7 @@ class PstParser {
subFolders = folder.getSubFolders();
} catch (PSTException | IOException ex) {
subFolders = new ArrayList<>();
logger.log(Level.INFO, "java-libpst exception while getting subfolders: {0}", ex.getMessage());
logger.log(Level.INFO, "java-libpst exception while getting subfolders: {0}", ex.getMessage()); //NON-NLS
}
for (PSTFolder f : subFolders) {
@ -147,7 +147,7 @@ class PstParser {
}
} catch (PSTException | IOException ex) {
failCount++;
logger.log(Level.INFO, "java-libpst exception while getting emails from a folder: {0}", ex.getMessage());
logger.log(Level.INFO, "java-libpst exception while getting emails from a folder: {0}", ex.getMessage()); //NON-NLS
}
}
@ -174,7 +174,7 @@ class PstParser {
try {
rtf = msg.getRTFBody();
} catch (PSTException | IOException ex) {
logger.log(Level.INFO, "Failed to get RTF content from pst email.");
logger.log(Level.INFO, "Failed to get RTF content from pst email."); //NON-NLS
}
email.setRtfBody(rtf);
email.setLocalPath(localPath);
@ -229,7 +229,7 @@ class PstParser {
addErrorMessage(
NbBundle.getMessage(this.getClass(), "PstParser.extractAttch.errMsg.failedToExtractToDisk",
filename));
logger.log(Level.WARNING, "Failed to extract attachment from pst file.", ex);
logger.log(Level.WARNING, "Failed to extract attachment from pst file.", ex); //NON-NLS
}
}
}
@ -294,12 +294,12 @@ class PstParser {
ByteBuffer bb = ByteBuffer.wrap(buffer);
return bb.getInt() == PST_HEADER;
} catch (TskCoreException ex) {
logger.log(Level.WARNING, "Exception while detecting if a file is a pst file.");
logger.log(Level.WARNING, "Exception while detecting if a file is a pst file."); //NON-NLS
return false;
}
}
private void addErrorMessage(String msg) {
errors.append("<li>").append(msg).append("</li>");
errors.append("<li>").append(msg).append("</li>"); //NON-NLS
}
}

View File

@ -120,7 +120,7 @@ public final class ThunderbirdMboxFileIngestModule extends IngestModuleAdapter i
File file = new File(fileName);
if (abstractFile.getSize() >= services.getFreeDiskSpace()) {
logger.log(Level.WARNING, "Not enough disk space to write file to disk.");
logger.log(Level.WARNING, "Not enough disk space to write file to disk."); //NON-NLS
IngestMessage msg = IngestMessage.createErrorMessage(EmailParserModuleFactory.getModuleName(), EmailParserModuleFactory.getModuleName(),
NbBundle.getMessage(this.getClass(),
"ThunderbirdMboxFileIngestModule.processPst.errMsg.outOfDiskSpace",
@ -132,7 +132,7 @@ public final class ThunderbirdMboxFileIngestModule extends IngestModuleAdapter i
try {
ContentUtils.writeToFile(abstractFile, file);
} catch (IOException ex) {
logger.log(Level.WARNING, "Failed writing pst file to disk.", ex);
logger.log(Level.WARNING, "Failed writing pst file to disk.", ex); //NON-NLS
return ProcessResult.OK;
}
@ -150,7 +150,7 @@ public final class ThunderbirdMboxFileIngestModule extends IngestModuleAdapter i
EmailParserModuleFactory.getModuleName(),
NbBundle.getMessage(this.getClass(), "ThunderbirdMboxFileIngestModule.encryptionFileLevel")));
} catch (TskCoreException ex) {
logger.log(Level.INFO, "Failed to add encryption attribute to file: {0}", abstractFile.getName());
logger.log(Level.INFO, "Failed to add encryption attribute to file: {0}", abstractFile.getName()); //NON-NLS
}
} else {
// parsing error: log message
@ -159,12 +159,12 @@ public final class ThunderbirdMboxFileIngestModule extends IngestModuleAdapter i
abstractFile.getName()),
NbBundle.getMessage(this.getClass(),
"ThunderbirdMboxFileIngestModule.processPst.errProcFile.details"));
logger.log(Level.INFO, "PSTParser failed to parse {0}", abstractFile.getName());
logger.log(Level.INFO, "PSTParser failed to parse {0}", abstractFile.getName()); //NON-NLS
return ProcessResult.ERROR;
}
if (file.delete() == false) {
logger.log(Level.INFO, "Failed to delete temp file: {0}", file.getName());
logger.log(Level.INFO, "Failed to delete temp file: {0}", file.getName()); //NON-NLS
}
String errors = parser.getErrors();
@ -190,20 +190,20 @@ public final class ThunderbirdMboxFileIngestModule extends IngestModuleAdapter i
// use the local path to determine the e-mail folder structure
String emailFolder = "";
// email folder is everything after "Mail" or ImapMail
if (mboxParentDir.contains("/Mail/")) {
emailFolder = mboxParentDir.substring(mboxParentDir.indexOf("/Mail/") + 5);
} else if (mboxParentDir.contains("/ImapMail/")) {
emailFolder = mboxParentDir.substring(mboxParentDir.indexOf("/ImapMail/") + 9);
if (mboxParentDir.contains("/Mail/")) { //NON-NLS
emailFolder = mboxParentDir.substring(mboxParentDir.indexOf("/Mail/") + 5); //NON-NLS
} else if (mboxParentDir.contains("/ImapMail/")) { //NON-NLS
emailFolder = mboxParentDir.substring(mboxParentDir.indexOf("/ImapMail/") + 9); //NON-NLS
}
emailFolder = emailFolder + mboxFileName;
emailFolder = emailFolder.replaceAll(".sbd", "");
emailFolder = emailFolder.replaceAll(".sbd", ""); //NON-NLS
String fileName = getTempPath() + File.separator + abstractFile.getName()
+ "-" + String.valueOf(abstractFile.getId());
File file = new File(fileName);
if (abstractFile.getSize() >= services.getFreeDiskSpace()) {
logger.log(Level.WARNING, "Not enough disk space to write file to disk.");
logger.log(Level.WARNING, "Not enough disk space to write file to disk."); //NON-NLS
postErrorMessage(
NbBundle.getMessage(this.getClass(), "ThunderbirdMboxFileIngestModule.processMBox.errProcFile.msg",
abstractFile.getName()),
@ -215,7 +215,7 @@ public final class ThunderbirdMboxFileIngestModule extends IngestModuleAdapter i
try {
ContentUtils.writeToFile(abstractFile, file);
} catch (IOException ex) {
logger.log(Level.WARNING, "Failed writing mbox file to disk.", ex);
logger.log(Level.WARNING, "Failed writing mbox file to disk.", ex); //NON-NLS
return ProcessResult.OK;
}
@ -225,7 +225,7 @@ public final class ThunderbirdMboxFileIngestModule extends IngestModuleAdapter i
processEmails(emails, abstractFile);
if (file.delete() == false) {
logger.log(Level.INFO, "Failed to delete temp file: {0}", file.getName());
logger.log(Level.INFO, "Failed to delete temp file: {0}", file.getName()); //NON-NLS
}
String errors = parser.getErrors();
@ -245,7 +245,7 @@ public final class ThunderbirdMboxFileIngestModule extends IngestModuleAdapter i
*/
public static String getTempPath() {
String tmpDir = Case.getCurrentCase().getTempDirectory() + File.separator
+ "EmailParser";
+ "EmailParser"; //NON-NLS
File dir = new File(tmpDir);
if (dir.exists() == false) {
dir.mkdirs();
@ -383,7 +383,7 @@ public final class ThunderbirdMboxFileIngestModule extends IngestModuleAdapter i
if (localPath.isEmpty() == false) {
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PATH.getTypeID(), EmailParserModuleFactory.getModuleName(), localPath));
} else {
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PATH.getTypeID(), EmailParserModuleFactory.getModuleName(), "/foo/bar"));
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PATH.getTypeID(), EmailParserModuleFactory.getModuleName(), "/foo/bar")); //NON-NLS
}
try {