From 206c70fc16523b072a96f1b7ae77eb77d77245b9 Mon Sep 17 00:00:00 2001 From: millmanorama Date: Tue, 14 Feb 2017 12:44:09 +0100 Subject: [PATCH] correctly record the length of the final chunk as having no window --- .../src/org/sleuthkit/autopsy/keywordsearch/Chunker.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Chunker.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Chunker.java index e3743e7def..06df441bf3 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Chunker.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Chunker.java @@ -167,6 +167,8 @@ class Chunker implements Iterator, Iterable { currentChunk.append(readBaseChunk()); baseChunkSizeChars = currentChunk.length(); //save the base chunk length currentWindow.append(readWindow()); + //add the window text to the current chunk. + currentChunk.append(currentWindow); if (endOfReaderReached) { /* if we have reached the end of the content,we won't make * another overlapping chunk, so the length of the base chunk @@ -181,8 +183,7 @@ class Chunker implements Iterator, Iterable { * and break any chunking loop in client code. */ ex = ioEx; } - //add the window text to the current chunk. - currentChunk.append(currentWindow); + //sanitize the text and return a Chunk object, that includes the base chunk length. return new Chunk(currentChunk, baseChunkSizeChars, chunkSizeBytes); }