Merge pull request #4294 from raman-bt/1136-group-seen-error

1136: Intermittent error: "Error marking group as seen"
This commit is contained in:
Richard Cordovano
2018-11-21 09:57:03 -05:00
committed by GitHub
3 changed files with 7 additions and 44 deletions
@@ -599,10 +599,11 @@ public final class ImageGalleryController {
}
}
/**
* Abstract base class for tasks associated with a file in the database
* task that updates one file in database with results from ingest
*/
static abstract class FileTask extends BackgroundTask {
static class UpdateFileTask extends BackgroundTask {
private final AbstractFile file;
private final DrawableDB taskDB;
@@ -614,22 +615,12 @@ public final class ImageGalleryController {
public AbstractFile getFile() {
return file;
}
FileTask(AbstractFile f, DrawableDB taskDB) {
UpdateFileTask(AbstractFile f, DrawableDB taskDB) {
super();
this.file = f;
this.taskDB = taskDB;
}
}
/**
* task that updates one file in database with results from ingest
*/
static class UpdateFileTask extends FileTask {
UpdateFileTask(AbstractFile f, DrawableDB taskDB) {
super(f, taskDB);
}
/**
* Update a file in the database
@@ -645,27 +636,6 @@ public final class ImageGalleryController {
}
}
/**
* task that updates one file in database with results from ingest
*/
static class RemoveFileTask extends FileTask {
RemoveFileTask(AbstractFile f, DrawableDB taskDB) {
super(f, taskDB);
}
/**
* Update a file in the database
*/
@Override
public void run() {
try {
getTaskDB().removeFile(getFile().getId());
} catch (TskCoreException | SQLException ex) {
Logger.getLogger(RemoveFileTask.class.getName()).log(Level.SEVERE, "Error in remove file task", ex); //NON-NLS
}
}
}
/**
* Base abstract class for various methods of copying image files data, for
@@ -189,14 +189,7 @@ public class ImageGalleryModule {
if (isDrawableAndNotKnown(file)) {
con.queueDBTask(new ImageGalleryController.UpdateFileTask(file, controller.getDatabase()));
}
// Remove it from the DB if it is no longer relevant, but had the correct extension
else if (FileTypeUtils.getAllSupportedExtensions().contains(file.getNameExtension())) {
/* Doing this check results in fewer tasks queued
* up, and faster completion of db update. This file
* would have gotten scooped up in initial grab, but
* actually we don't need it */
con.queueDBTask(new ImageGalleryController.RemoveFileTask(file, controller.getDatabase()));
}
} catch (FileTypeDetector.FileTypeDetectorInitException ex) {
logger.log(Level.SEVERE, "Unable to determine if file is drawable and not known. Not making any changes to DB", ex); //NON-NLS
MessageNotifyUtil.Notify.error("Image Gallery Error",
@@ -279,7 +279,7 @@ public class GroupManager {
updateUnSeenGroups(group);
}
} catch (TskCoreException ex) {
logger.log(Level.SEVERE, "Error marking group as seen", ex); //NON-NLS
logger.log(Level.SEVERE, String.format("Error setting seen status for group: %s", group.getGroupKey().getValue().toString()), ex); //NON-NLS
}
});
}