Remove Java 8 code from ingest progress snapshots feature

This commit is contained in:
Richard Cordovano 2014-06-12 09:48:23 -04:00
parent ed61e5b1b2
commit 479ae2ec60
4 changed files with 40 additions and 27 deletions

View File

@ -75,7 +75,7 @@ final class DataSourceIngestPipeline {
for (DataSourceIngestModuleDecorator module : modules) { for (DataSourceIngestModuleDecorator module : modules) {
try { try {
module.startUp(context); module.startUp(context);
} catch (Exception ex) { } catch (Exception ex) { // Catch-all exception firewall
errors.add(new IngestModuleError(module.getDisplayName(), ex)); errors.add(new IngestModuleError(module.getDisplayName(), ex));
} }
} }
@ -92,7 +92,7 @@ final class DataSourceIngestPipeline {
module.getDisplayName(), dataSource.getName())); module.getDisplayName(), dataSource.getName()));
task.updateProgressStatus(module.getDisplayName(), null); task.updateProgressStatus(module.getDisplayName(), null);
module.process(dataSource, new DataSourceIngestModuleProgress(progress)); module.process(dataSource, new DataSourceIngestModuleProgress(progress));
} catch (Exception ex) { } catch (Exception ex) { // Catch-all exception firewall
errors.add(new IngestModuleError(module.getDisplayName(), ex)); errors.add(new IngestModuleError(module.getDisplayName(), ex));
} }
if (context.isJobCancelled()) { if (context.isJobCancelled()) {

View File

@ -77,7 +77,7 @@ final class FileIngestPipeline {
for (FileIngestModuleDecorator module : modules) { for (FileIngestModuleDecorator module : modules) {
try { try {
module.startUp(context); module.startUp(context);
} catch (Exception ex) { } catch (Exception ex) { // Catch-all exception firewall
errors.add(new IngestModuleError(module.getDisplayName(), ex)); errors.add(new IngestModuleError(module.getDisplayName(), ex));
} }
} }
@ -98,7 +98,7 @@ final class FileIngestPipeline {
try { try {
task.updateProgressStatus(module.getDisplayName(), file); task.updateProgressStatus(module.getDisplayName(), file);
module.process(file); module.process(file);
} catch (Exception ex) { } catch (Exception ex) { // Catch-all exception firewall
errors.add(new IngestModuleError(module.getDisplayName(), ex)); errors.add(new IngestModuleError(module.getDisplayName(), ex));
} }
if (context.isJobCancelled()) { if (context.isJobCancelled()) {

View File

@ -20,14 +20,13 @@ package org.sleuthkit.autopsy.ingest;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
import java.time.Duration; import java.util.Date;
import java.time.LocalTime;
import java.util.List; import java.util.List;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.table.AbstractTableModel; import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableColumn; import javax.swing.table.TableColumn;
import org.sleuthkit.datamodel.AbstractFile;
import org.apache.commons.lang3.time.DurationFormatUtils; import org.apache.commons.lang3.time.DurationFormatUtils;
import org.sleuthkit.datamodel.AbstractFile;
public class IngestProgressSnapshotPanel extends javax.swing.JPanel { public class IngestProgressSnapshotPanel extends javax.swing.JPanel {
@ -133,8 +132,12 @@ public class IngestProgressSnapshotPanel extends javax.swing.JPanel {
cellValue = snapshot.getStartTime(); cellValue = snapshot.getStartTime();
break; break;
case 5: case 5:
long elapsedTime = Duration.between(snapshot.getStartTime(), LocalTime.now()).toMillis(); Date now = new Date();
long elapsedTime = now.getTime() - snapshot.getStartTime().getTime();
cellValue = DurationFormatUtils.formatDurationHMS(elapsedTime); cellValue = DurationFormatUtils.formatDurationHMS(elapsedTime);
// TODO: Restore when we go to Java 8
// long elapsedTime = Duration.between(snapshot.getStartTime(), LocalTime.now()).toMillis();
// cellValue = DurationFormatUtils.formatDurationHMS(elapsedTime);
break; break;
default: default:
cellValue = null; cellValue = null;

View File

@ -18,8 +18,8 @@
*/ */
package org.sleuthkit.autopsy.ingest; package org.sleuthkit.autopsy.ingest;
import java.time.LocalTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.AbstractFile;
@ -49,18 +49,23 @@ class IngestTask {
} }
public static final class ProgressSnapshot { public static final class ProgressSnapshot {
private final long threadId; private final long threadId;
private final Content dataSource; private final Content dataSource;
private final String ingestModuleDisplayName; private final String ingestModuleDisplayName;
private final AbstractFile file; private final AbstractFile file;
private final LocalTime startTime; private final Date startTime;
// TODO: Restore when we go to Java 8
// private final LocalTime startTime;
private ProgressSnapshot(long threadId, Content dataSource, String ingestModuleDisplayName, AbstractFile file) { private ProgressSnapshot(long threadId, Content dataSource, String ingestModuleDisplayName, AbstractFile file) {
this.threadId = threadId; this.threadId = threadId;
this.dataSource = dataSource; this.dataSource = dataSource;
this.ingestModuleDisplayName = ingestModuleDisplayName; this.ingestModuleDisplayName = ingestModuleDisplayName;
this.file = file; this.file = file;
startTime = LocalTime.now(); startTime = new Date();
// TODO: Restore when we go to Java 8
// startTime = LocalTime.now();
} }
long getThreadId() { long getThreadId() {
@ -79,12 +84,17 @@ class IngestTask {
return file; return file;
} }
LocalTime getStartTime() { Date getStartTime() {
return startTime; return startTime;
} }
// TODO: Restore when we go to Java 8
// LocalTime getStartTime() {
// return startTime;
// }
} }
static final class ProgressSnapshots { static final class ProgressSnapshots {
private final ConcurrentHashMap<Long, IngestTask.ProgressSnapshot> snapshots = new ConcurrentHashMap<>(); // Maps ingest thread ids to progress snapshots. private final ConcurrentHashMap<Long, IngestTask.ProgressSnapshot> snapshots = new ConcurrentHashMap<>(); // Maps ingest thread ids to progress snapshots.
void update(ProgressSnapshot snapshot) { void update(ProgressSnapshot snapshot) {