Merge branch 'develop' of https://github.com/sleuthkit/autopsy into 1205-download-source

This commit is contained in:
Raman 2019-03-04 16:17:32 -05:00
commit 49732b1dfc

View File

@ -552,12 +552,13 @@ final class ChromeCacheExtractor {
} }
AbstractFile cacheFile = cacheFileOptional.get(); AbstractFile cacheFile = cacheFileOptional.get();
RandomAccessFile randomAccessFile = null;
String tempFilePathname = RAImageIngestModule.getRATempPath(currentCase, moduleName) + cachePath + cacheFile.getName(); //NON-NLS String tempFilePathname = RAImageIngestModule.getRATempPath(currentCase, moduleName) + cachePath + cacheFile.getName(); //NON-NLS
try { try {
File newFile = new File(tempFilePathname); File newFile = new File(tempFilePathname);
ContentUtils.writeToFile(cacheFile, newFile, context::dataSourceIngestIsCancelled); ContentUtils.writeToFile(cacheFile, newFile, context::dataSourceIngestIsCancelled);
RandomAccessFile randomAccessFile = new RandomAccessFile(tempFilePathname, "r"); randomAccessFile = new RandomAccessFile(tempFilePathname, "r");
FileChannel roChannel = randomAccessFile.getChannel(); FileChannel roChannel = randomAccessFile.getChannel();
ByteBuffer cacheFileROBuf = roChannel.map(FileChannel.MapMode.READ_ONLY, 0, ByteBuffer cacheFileROBuf = roChannel.map(FileChannel.MapMode.READ_ONLY, 0,
(int) roChannel.size()); (int) roChannel.size());
@ -571,15 +572,20 @@ final class ChromeCacheExtractor {
return Optional.of(cacheFileCopy); return Optional.of(cacheFileCopy);
} }
catch (ReadContentInputStream.ReadContentInputStreamException ex) { catch (IOException ex) {
String msg = String.format("Error reading Chrome cache file '%s' (id=%d).", //NON-NLS
cacheFile.getName(), cacheFile.getId()); try {
if (randomAccessFile != null) {
randomAccessFile.close();
}
}
catch (IOException ex2) {
logger.log(Level.SEVERE, "Error while trying to close temp file after exception.", ex2); //NON-NLS
}
String msg = String.format("Error reading/copying Chrome cache file '%s' (id=%d).", //NON-NLS
cacheFile.getName(), cacheFile.getId());
throw new IngestModuleException(msg, ex); throw new IngestModuleException(msg, ex);
} catch (IOException ex) { }
String msg = String.format("Error writing temp Chrome cache file '%s' (id=%d).", //NON-NLS
cacheFile.getName(), cacheFile.getId());
throw new IngestModuleException(msg, ex);
}
} }
/** /**