mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 01:07:42 +00:00
5657 prevent displaying of cancelled results
This commit is contained in:
parent
824e56be72
commit
2757d20083
@ -19,6 +19,7 @@
|
|||||||
package org.sleuthkit.autopsy.filequery;
|
package org.sleuthkit.autopsy.filequery;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import javax.swing.SwingWorker;
|
import javax.swing.SwingWorker;
|
||||||
import org.sleuthkit.autopsy.casemodule.Case;
|
import org.sleuthkit.autopsy.casemodule.Case;
|
||||||
@ -40,6 +41,7 @@ final class PageWorker extends SwingWorker<Void, Void> {
|
|||||||
private final int pageSize;
|
private final int pageSize;
|
||||||
private final FileSearchData.FileType resultType;
|
private final FileSearchData.FileType resultType;
|
||||||
private final EamDb centralRepo;
|
private final EamDb centralRepo;
|
||||||
|
private final List<ResultFile> results = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new PageWorker.
|
* Construct a new PageWorker.
|
||||||
@ -75,16 +77,24 @@ final class PageWorker extends SwingWorker<Void, Void> {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Run the search
|
// Run the search
|
||||||
List<ResultFile> results = FileSearch.getFilesInGroup(searchfilters,
|
results.addAll(FileSearch.getFilesInGroup(searchfilters,
|
||||||
groupingAttribute,
|
groupingAttribute,
|
||||||
groupSort,
|
groupSort,
|
||||||
fileSortMethod, groupName, startingEntry, pageSize,
|
fileSortMethod, groupName, startingEntry, pageSize,
|
||||||
Case.getCurrentCase().getSleuthkitCase(), centralRepo);
|
Case.getCurrentCase().getSleuthkitCase(), centralRepo));
|
||||||
int currentPage = startingEntry / pageSize; //integer division should round down to get page number correctly
|
|
||||||
DiscoveryEvents.getDiscoveryEventBus().post(new DiscoveryEvents.PageRetrievedEvent(resultType, currentPage, results));
|
|
||||||
} catch (FileSearchException ex) {
|
} catch (FileSearchException ex) {
|
||||||
logger.log(Level.SEVERE, "Error running file search test", ex);
|
logger.log(Level.SEVERE, "Error running file search test", ex);
|
||||||
|
cancel(true);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void done() {
|
||||||
|
if (!isCancelled()) {
|
||||||
|
int currentPage = startingEntry / pageSize; //integer division should round down to get page number correctly
|
||||||
|
DiscoveryEvents.getDiscoveryEventBus().post(new DiscoveryEvents.PageRetrievedEvent(resultType, currentPage, results));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ final class SearchWorker extends SwingWorker<Void, Void> {
|
|||||||
private final FileSorter.SortingMethod fileSort;
|
private final FileSorter.SortingMethod fileSort;
|
||||||
private final FileGroup.GroupSortingAlgorithm groupSortAlgorithm;
|
private final FileGroup.GroupSortingAlgorithm groupSortAlgorithm;
|
||||||
private final EamDb centralRepoDb;
|
private final EamDb centralRepoDb;
|
||||||
private boolean searchCompleted = false;
|
private final LinkedHashMap<String, Integer> results = new LinkedHashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a SwingWorker which performs a search
|
* Create a SwingWorker which performs a search
|
||||||
@ -60,23 +60,25 @@ final class SearchWorker extends SwingWorker<Void, Void> {
|
|||||||
protected Void doInBackground() throws Exception {
|
protected Void doInBackground() throws Exception {
|
||||||
try {
|
try {
|
||||||
// Run the search
|
// Run the search
|
||||||
LinkedHashMap<String, Integer> results = FileSearch.getGroupSizes(filters,
|
results.putAll(FileSearch.getGroupSizes(filters,
|
||||||
groupingAttr,
|
groupingAttr,
|
||||||
groupSortAlgorithm,
|
groupSortAlgorithm,
|
||||||
fileSort,
|
fileSort,
|
||||||
Case.getCurrentCase().getSleuthkitCase(), centralRepoDb);
|
Case.getCurrentCase().getSleuthkitCase(), centralRepoDb));
|
||||||
DiscoveryEvents.getDiscoveryEventBus().post(new DiscoveryEvents.SearchCompleteEvent(results, filters, groupingAttr, groupSortAlgorithm, fileSort));
|
|
||||||
searchCompleted = true;
|
|
||||||
} catch (FileSearchException ex) {
|
} catch (FileSearchException ex) {
|
||||||
logger.log(Level.SEVERE, "Error running file search test", ex);
|
logger.log(Level.SEVERE, "Error running file search test", ex);
|
||||||
|
cancel(true);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void done() {
|
protected void done() {
|
||||||
if (!searchCompleted) {
|
if (isCancelled()) {
|
||||||
DiscoveryEvents.getDiscoveryEventBus().post(new DiscoveryEvents.SearchCancelledEvent());
|
DiscoveryEvents.getDiscoveryEventBus().post(new DiscoveryEvents.SearchCancelledEvent());
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
DiscoveryEvents.getDiscoveryEventBus().post(new DiscoveryEvents.SearchCompleteEvent(results, filters, groupingAttr, groupSortAlgorithm, fileSort));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user