mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-18 02:27:42 +00:00
Handle errors from unknown CR types better
This commit is contained in:
parent
5c169b73d9
commit
dcc41893e4
@ -108,14 +108,18 @@ final class CorrelationCaseChildNodeFactory extends ChildFactory<CorrelationCase
|
|||||||
*
|
*
|
||||||
* @throws CentralRepoException
|
* @throws CentralRepoException
|
||||||
*/
|
*/
|
||||||
private CorrelationAttributeInstance.Type getCorrelationType(Account.Type accountType) throws CentralRepoException {
|
private CorrelationAttributeInstance.Type getCorrelationType(Account.Type accountType) {
|
||||||
String accountTypeStr = accountType.getTypeName();
|
try {
|
||||||
if (Account.Type.DEVICE.getTypeName().equalsIgnoreCase(accountTypeStr) == false) {
|
String accountTypeStr = accountType.getTypeName();
|
||||||
CentralRepoAccount.CentralRepoAccountType crAccountType = CentralRepository.getInstance().getAccountTypeByName(accountTypeStr);
|
if (Account.Type.DEVICE.getTypeName().equalsIgnoreCase(accountTypeStr) == false) {
|
||||||
int corrTypeId = crAccountType.getCorrelationTypeId();
|
CentralRepoAccount.CentralRepoAccountType crAccountType = CentralRepository.getInstance().getAccountTypeByName(accountTypeStr);
|
||||||
return CentralRepository.getInstance().getCorrelationTypeById(corrTypeId);
|
int corrTypeId = crAccountType.getCorrelationTypeId();
|
||||||
|
return CentralRepository.getInstance().getCorrelationTypeById(corrTypeId);
|
||||||
|
}
|
||||||
|
} catch (CentralRepoException ex) {
|
||||||
|
// The excpetion most likely just means we didn't find a matching account
|
||||||
|
// type - no need to log it.
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ 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;
|
||||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoAccount;
|
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoAccount;
|
||||||
|
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException;
|
||||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
|
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
|
||||||
import org.sleuthkit.autopsy.centralrepository.datamodel.Persona;
|
import org.sleuthkit.autopsy.centralrepository.datamodel.Persona;
|
||||||
import org.sleuthkit.autopsy.centralrepository.datamodel.PersonaAccount;
|
import org.sleuthkit.autopsy.centralrepository.datamodel.PersonaAccount;
|
||||||
@ -74,12 +75,22 @@ class SummaryPanelWorker extends SwingWorker<SummaryPanelWorker.SummaryWorkerRes
|
|||||||
personaList.add(pAccount.getPersona());
|
personaList.add(pAccount.getPersona());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CentralRepoAccount.CentralRepoAccountType crAccountType;
|
||||||
try {
|
try {
|
||||||
crAccount = CentralRepository.getInstance().getAccount(CentralRepository.getInstance().getAccountTypeByName(account.getAccountType().getTypeName()), account.getTypeSpecificID());
|
crAccountType = CentralRepository.getInstance().getAccountTypeByName(account.getAccountType().getTypeName());
|
||||||
} catch (InvalidAccountIDException unused) {
|
} catch (CentralRepoException ex) {
|
||||||
// This was probably caused to a phone number not making
|
// The error most likely means that there is no corresponding account type in the central repo.
|
||||||
// threw the normalization.
|
crAccountType = null;
|
||||||
logger.log(Level.WARNING, String.format("Exception thrown from CR getAccount for account %s (%d)", account.getTypeSpecificID(), account.getAccountID()));
|
}
|
||||||
|
|
||||||
|
if (crAccountType != null) {
|
||||||
|
try {
|
||||||
|
crAccount = CentralRepository.getInstance().getAccount(crAccountType, account.getTypeSpecificID());
|
||||||
|
} catch (InvalidAccountIDException unused) {
|
||||||
|
// This was probably caused to a phone number not making
|
||||||
|
// threw the normalization.
|
||||||
|
logger.log(Level.WARNING, String.format("Exception thrown from CR getAccount for account %s (%d)", account.getTypeSpecificID(), account.getAccountID()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -631,10 +631,12 @@ public class ContactArtifactViewer extends javax.swing.JPanel implements Artifac
|
|||||||
// make a list of all unique accounts for this contact
|
// make a list of all unique accounts for this contact
|
||||||
if (!account.getAccountType().equals(Account.Type.DEVICE)) {
|
if (!account.getAccountType().equals(Account.Type.DEVICE)) {
|
||||||
CentralRepoAccount.CentralRepoAccountType crAccountType = CentralRepository.getInstance().getAccountTypeByName(account.getAccountType().getTypeName());
|
CentralRepoAccount.CentralRepoAccountType crAccountType = CentralRepository.getInstance().getAccountTypeByName(account.getAccountType().getTypeName());
|
||||||
CentralRepoAccount crAccount = CentralRepository.getInstance().getAccount(crAccountType, account.getTypeSpecificID());
|
if (crAccountType != null) {
|
||||||
|
CentralRepoAccount crAccount = CentralRepository.getInstance().getAccount(crAccountType, account.getTypeSpecificID());
|
||||||
|
|
||||||
if (crAccount != null && uniqueAccountsList.contains(crAccount) == false) {
|
if (crAccount != null && uniqueAccountsList.contains(crAccount) == false) {
|
||||||
uniqueAccountsList.add(crAccount);
|
uniqueAccountsList.add(crAccount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user