Autopsy  4.17.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
MiniTimelineWorker.java
Go to the documentation of this file.
1 /*
2  * Autopsy
3  *
4  * Copyright 2020 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.discovery.ui;
20 
22 import java.util.ArrayList;
23 import java.util.List;
24 import java.util.concurrent.CancellationException;
25 import java.util.concurrent.ExecutionException;
26 import java.util.logging.Level;
27 import javax.swing.SwingWorker;
28 import org.apache.commons.lang3.StringUtils;
34 
38 class MiniTimelineWorker extends SwingWorker<Void, Void> {
39 
40  private final static Logger logger = Logger.getLogger(MiniTimelineWorker.class.getName());
41  private final String domain;
42 
49  MiniTimelineWorker(String domain) {
50  this.domain = domain;
51  }
52 
53  @Override
54  protected Void doInBackground() throws Exception {
55  List<MiniTimelineResult> results = new ArrayList<>();
56  if (!StringUtils.isBlank(domain)) {
57  DomainSearch domainSearch = new DomainSearch();
58  try {
59  results.addAll(domainSearch.getAllArtifactsForDomain(Case.getCurrentCase().getSleuthkitCase(), domain));
60  DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.MiniTimelineResultEvent(results, domain));
61  } catch (DiscoveryException ex) {
62  if (ex.getCause() instanceof InterruptedException) {
63  this.cancel(true);
64  //ignore the exception as it was cancelled while the cache was performing its get and we support cancellation
65  } else {
66  throw ex;
67  }
68  }
69  }
70  return null;
71  }
72 
73  @Override
74  protected void done() {
75  if (!isCancelled()) {
76  try {
77  get();
78  } catch (InterruptedException | ExecutionException ex) {
79  logger.log(Level.SEVERE, "Exception while trying to get list of artifacts for Domain details for mini timeline view for domain: " + domain, ex);
80  } catch (CancellationException ignored) {
81  //Worker was cancelled after previously finishing its background work, exception ignored to cut down on non-helpful logging
82  }
83  }
84  }
85 }

Copyright © 2012-2021 Basis Technology. Generated on: Tue Jan 19 2021
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.