diff --git a/Core/src/org/sleuthkit/autopsy/filequery/DiscoveryUiUtils.java b/Core/src/org/sleuthkit/autopsy/filequery/DiscoveryUiUtils.java index e566045d5c..fc2752a659 100644 --- a/Core/src/org/sleuthkit/autopsy/filequery/DiscoveryUiUtils.java +++ b/Core/src/org/sleuthkit/autopsy/filequery/DiscoveryUiUtils.java @@ -95,8 +95,6 @@ final class DiscoveryUiUtils { return comp instanceof JComponent && point.x >= comp.getX() && point.x <= comp.getX() + ICON_SIZE && point.y >= comp.getY() && point.y <= comp.getY() + ICON_SIZE; } - - /** * Method to set the icon and tool tip text for a label to show deleted * status. diff --git a/Core/src/org/sleuthkit/autopsy/filequery/FileSearch.java b/Core/src/org/sleuthkit/autopsy/filequery/FileSearch.java index b0809492d4..a4df5adc70 100644 --- a/Core/src/org/sleuthkit/autopsy/filequery/FileSearch.java +++ b/Core/src/org/sleuthkit/autopsy/filequery/FileSearch.java @@ -247,6 +247,14 @@ class FileSearch { return page; } + /** + * Get a summary for the specified AbstractFile if no summarizers exist get + * the first bit of the file. + * + * @param file The AbstractFile to summarize. + * + * @return The summary or first bit of the specified file as a String. + */ @NbBundle.Messages({"FileSearch.documentSummary.noPreview=No preview available.", "FileSearch.documentSummary.noBytes=No bytes read for document, unable to display preview."}) static String summarize(AbstractFile file) { @@ -263,9 +271,11 @@ class FileSearch { } } if (localSummarizer == null) { + //no summarizer was found just grab the first bit of the file return getFirstLines(file); } else { try { + //a summary of length 40 seems to fit without vertical scroll bars return localSummarizer.summarize(file, 40); } catch (IOException ex) { return Bundle.FileSearch_documentSummary_noPreview(); @@ -274,6 +284,13 @@ class FileSearch { } + /** + * Get the first bit of text from the specified AbstractFile. + * + * @param file The AbstractFile to get text from. + * + * @return The first bit of text from the specified AbstractFile. + */ private static String getFirstLines(AbstractFile file) { try (Reader reader = TextExtractorFactory.getExtractor(file, null).getReader()) { char[] cbuf = new char[PREVIEW_SIZE]; @@ -286,6 +303,13 @@ class FileSearch { } } + /** + * Get the first summarizer found by a lookup of summarizers. + * + * @return The first summarizer found by a lookup of summarizers. + * + * @throws IOException + */ private static Summarizer getLocalSummarizer() throws IOException { Collection summarizers = Lookup.getDefault().lookupAll(Summarizer.class @@ -655,7 +679,6 @@ class FileSearch { int framePos = Integer.valueOf(FilenameUtils.getBaseName(fileName).substring(2)); framePositions[thumbnailNumber] = framePos; thumbnailNumber++; - } thumbnailWrapper.setThumbnails(videoThumbnails, framePositions); } @@ -673,7 +696,6 @@ class FileSearch { videoThumbnails.add(ImageUtils.getDefaultThumbnail()); videoThumbnails.add(ImageUtils.getDefaultThumbnail()); return videoThumbnails; - } private FileSearch() {