Merge pull request #1392 from karlmortensen/size_compare

watch out for unknown (-1)
This commit is contained in:
Richard Cordovano 2015-06-23 14:33:28 -04:00
commit f1c014f84f
3 changed files with 10 additions and 4 deletions

View File

@ -56,6 +56,7 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
import org.sleuthkit.autopsy.ingest.ProcTerminationCode;
import org.sleuthkit.autopsy.ingest.FileIngestModuleProcessTerminator;
import org.sleuthkit.autopsy.ingest.IngestMonitor;
import org.sleuthkit.autopsy.ingest.IngestServices;
import org.sleuthkit.autopsy.ingest.ModuleContentEvent;
@ -150,7 +151,7 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule {
// Some network drives always return -1 for free disk space.
// In this case, expect enough space and move on.
long freeDiskSpace = IngestServices.getInstance().getFreeDiskSpace();
if ((freeDiskSpace != -1) && ((file.getSize() * 1.2) > freeDiskSpace)) {
if ((freeDiskSpace != IngestMonitor.DISK_FREE_SPACE_UNKNOWN) && ((file.getSize() * 1.2) > freeDiskSpace)) {
logger.log(Level.SEVERE, "PhotoRec error processing {0} with {1} Not enough space on primary disk to save unallocated space.", // NON-NLS
new Object[]{file.getName(), PhotoRecCarverIngestModuleFactory.getModuleName()}); // NON-NLS
MessageNotifyUtil.Notify.error(NbBundle.getMessage(this.getClass(), "PhotoRecIngestModule.UnableToCarve", file.getName()),

View File

@ -33,6 +33,7 @@ import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.ingest.IngestMonitor;
import org.sleuthkit.autopsy.ingest.IngestServices;
import static org.sleuthkit.autopsy.thunderbirdparser.ThunderbirdMboxFileIngestModule.getRelModuleOutputPath;
import org.sleuthkit.datamodel.AbstractFile;
@ -202,7 +203,8 @@ class PstParser {
try {
PSTAttachment attach = msg.getAttachment(x);
long size = attach.getAttachSize();
if (size >= services.getFreeDiskSpace()) {
long freeSpace = services.getFreeDiskSpace();
if ((freeSpace != IngestMonitor.DISK_FREE_SPACE_UNKNOWN) && (size >= freeSpace)) {
continue;
}
// both long and short filenames can be used for attachments

View File

@ -32,6 +32,7 @@ import org.sleuthkit.autopsy.ingest.FileIngestModule;
import org.sleuthkit.autopsy.ingest.IngestJobContext;
import org.sleuthkit.autopsy.ingest.IngestMessage;
import org.sleuthkit.autopsy.ingest.IngestModule.ProcessResult;
import org.sleuthkit.autopsy.ingest.IngestMonitor;
import org.sleuthkit.autopsy.ingest.IngestServices;
import org.sleuthkit.autopsy.ingest.ModuleContentEvent;
import org.sleuthkit.autopsy.ingest.ModuleDataEvent;
@ -118,7 +119,8 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule {
+ "-" + String.valueOf(abstractFile.getId());
File file = new File(fileName);
if (abstractFile.getSize() >= services.getFreeDiskSpace()) {
long freeSpace = services.getFreeDiskSpace();
if ((freeSpace != IngestMonitor.DISK_FREE_SPACE_UNKNOWN) && (abstractFile.getSize() >= freeSpace)) {
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(),
@ -200,7 +202,8 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule {
+ "-" + String.valueOf(abstractFile.getId());
File file = new File(fileName);
if (abstractFile.getSize() >= services.getFreeDiskSpace()) {
long freeSpace = services.getFreeDiskSpace();
if ((freeSpace != IngestMonitor.DISK_FREE_SPACE_UNKNOWN) && (abstractFile.getSize() >= freeSpace)) {
logger.log(Level.WARNING, "Not enough disk space to write file to disk."); //NON-NLS
postErrorMessage(
NbBundle.getMessage(this.getClass(), "ThunderbirdMboxFileIngestModule.processMBox.errProcFile.msg",