diff --git a/Core/src/org/sleuthkit/autopsy/allcasessearch/AllCasesSearchDialog.java b/Core/src/org/sleuthkit/autopsy/allcasessearch/AllCasesSearchDialog.java index 19784b535b..474eb54fb5 100755 --- a/Core/src/org/sleuthkit/autopsy/allcasessearch/AllCasesSearchDialog.java +++ b/Core/src/org/sleuthkit/autopsy/allcasessearch/AllCasesSearchDialog.java @@ -111,7 +111,7 @@ import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; } catch (CentralRepoException ex) { logger.log(Level.SEVERE, "Unable to connect to the Central Repository database.", ex); } catch (CorrelationAttributeNormalizationException ex) { - logger.log(Level.WARNING, "Unable to retrieve data from the Central Repository: ", ex.getMessage()); + logger.log(Level.WARNING, "Unable to retrieve data from the Central Repository.", ex); } } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/application/OtherOccurrences.java b/Core/src/org/sleuthkit/autopsy/centralrepository/application/OtherOccurrences.java index b46a618b54..ae35d971bf 100755 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/application/OtherOccurrences.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/application/OtherOccurrences.java @@ -139,7 +139,7 @@ public final class OtherOccurrences { } catch (CentralRepoException ex) { logger.log(Level.SEVERE, "Error getting artifact instances from database.", ex); // NON-NLS } catch (CorrelationAttributeNormalizationException ex) { - logger.log(Level.INFO, "Error getting artifact instances from database: " + ex.getMessage()); // NON-NLS + logger.log(Level.INFO, "Error getting artifact instances from database.", ex); // NON-NLS } catch (NoCurrentCaseException ex) { logger.log(Level.SEVERE, "Exception while getting open case.", ex); // NON-NLS } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrencesPanel.java b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrencesPanel.java index f8784aa1da..40dbb4d70c 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrencesPanel.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrencesPanel.java @@ -196,7 +196,7 @@ public final class OtherOccurrencesPanel extends javax.swing.JPanel { eamArtifact.getCorrelationType().getDisplayName(), eamArtifact.getCorrelationValue())); } catch (CorrelationAttributeNormalizationException ex) { - logger.log(Level.WARNING, String.format("Error getting commonality details for artifact with ID: %s: %s", eamArtifact.getID(), ex.getMessage())); + logger.log(Level.WARNING, String.format("Error getting commonality details for artifact with ID: %s.", eamArtifact.getID()), ex); } } this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoFileInstance.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoFileInstance.java index bd243f812a..f186eccfbd 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoFileInstance.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoFileInstance.java @@ -114,7 +114,7 @@ public class CentralRepoFileInstance { /** * @param MD5Hash the MD5Hash to set */ - public void setMD5Hash(String MD5Hash) throws CorrelationAttributeNormalizationException { + public void setMD5Hash(String MD5Hash) throws CorrelationAttributeNormalizationException, CentralRepoException { this.MD5Hash = CorrelationAttributeNormalizer.normalize(CorrelationAttributeInstance.FILES_TYPE_ID, MD5Hash); } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationAttributeNormalizer.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationAttributeNormalizer.java index 300f1019c2..9078bb83eb 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationAttributeNormalizer.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationAttributeNormalizer.java @@ -47,13 +47,13 @@ final public class CorrelationAttributeNormalizer { * * @return normalized data */ - public static String normalize(CorrelationAttributeInstance.Type attributeType, String data) throws CorrelationAttributeNormalizationException { + public static String normalize(CorrelationAttributeInstance.Type attributeType, String data) throws CorrelationAttributeNormalizationException, CentralRepoException { if (attributeType == null) { - throw new CorrelationAttributeNormalizationException("Attribute type was null."); + throw new CentralRepoException("Attribute type was null."); } if (data == null) { - throw new CorrelationAttributeNormalizationException("Correlation value was null."); + throw new CentralRepoException("Correlation value was null."); } String trimmedData = data.trim(); @@ -81,22 +81,18 @@ final public class CorrelationAttributeNormalizer { return normalizeIccid(trimmedData); default: - try { - // If the atttribute is not one of the above - // but is one of the other default correlation types, then let the data go as is - List defaultCorrelationTypes = CorrelationAttributeInstance.getDefaultCorrelationTypes(); - for (CorrelationAttributeInstance.Type defaultCorrelationType : defaultCorrelationTypes) { - if (defaultCorrelationType.getId() == attributeType.getId()) { - return trimmedData; - } + // If the atttribute is not one of the above + // but is one of the other default correlation types, then let the data go as is + List defaultCorrelationTypes = CorrelationAttributeInstance.getDefaultCorrelationTypes(); + for (CorrelationAttributeInstance.Type defaultCorrelationType : defaultCorrelationTypes) { + if (defaultCorrelationType.getId() == attributeType.getId()) { + return trimmedData; } - final String errorMessage = String.format( - "Validator function not found for attribute type: %s", - attributeType.getDisplayName()); - throw new CorrelationAttributeNormalizationException(errorMessage); - } catch (CentralRepoException ex) { - throw new CorrelationAttributeNormalizationException("Failed to get default correlation types.", ex); } + final String errorMessage = String.format( + "Validator function not found for attribute type: %s", + attributeType.getDisplayName()); + throw new CentralRepoException(errorMessage); } } @@ -109,19 +105,15 @@ final public class CorrelationAttributeNormalizer { * * @return normalized data */ - public static String normalize(int attributeTypeId, String data) throws CorrelationAttributeNormalizationException { - try { - List defaultTypes = CorrelationAttributeInstance.getDefaultCorrelationTypes(); - Optional typeOption = defaultTypes.stream().filter(attributeType -> attributeType.getId() == attributeTypeId).findAny(); + public static String normalize(int attributeTypeId, String data) throws CorrelationAttributeNormalizationException, CentralRepoException { + List defaultTypes = CorrelationAttributeInstance.getDefaultCorrelationTypes(); + Optional typeOption = defaultTypes.stream().filter(attributeType -> attributeType.getId() == attributeTypeId).findAny(); - if (typeOption.isPresent()) { - CorrelationAttributeInstance.Type type = typeOption.get(); - return CorrelationAttributeNormalizer.normalize(type, data); - } else { - throw new CorrelationAttributeNormalizationException(String.format("Given attributeTypeId did not correspond to any known Attribute: %s", attributeTypeId)); - } - } catch (CentralRepoException ex) { - throw new CorrelationAttributeNormalizationException(ex); + if (typeOption.isPresent()) { + CorrelationAttributeInstance.Type type = typeOption.get(); + return CorrelationAttributeNormalizer.normalize(type, data); + } else { + throw new CorrelationAttributeNormalizationException(String.format("Given attributeTypeId did not correspond to any known Attribute: %s", attributeTypeId)); } } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/RdbmsCentralRepo.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/RdbmsCentralRepo.java index d7fd79dd8e..ee017de842 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/RdbmsCentralRepo.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/RdbmsCentralRepo.java @@ -1276,7 +1276,7 @@ abstract class RdbmsCentralRepo implements CentralRepository { @Override public List getArtifactInstancesByTypeValue(CorrelationAttributeInstance.Type aType, String value) throws CentralRepoException, CorrelationAttributeNormalizationException { if (value == null) { - throw new CorrelationAttributeNormalizationException("Cannot get artifact instances for null value"); + throw new CentralRepoException("Cannot get artifact instances for null value"); } return getArtifactInstancesByTypeValues(aType, Arrays.asList(value)); } @@ -1284,10 +1284,10 @@ abstract class RdbmsCentralRepo implements CentralRepository { @Override public List getArtifactInstancesByTypeValues(CorrelationAttributeInstance.Type aType, List values) throws CentralRepoException, CorrelationAttributeNormalizationException { if (aType == null) { - throw new CorrelationAttributeNormalizationException("Cannot get artifact instances for null type"); + throw new CentralRepoException("Cannot get artifact instances for null type"); } if (values == null || values.isEmpty()) { - throw new CorrelationAttributeNormalizationException("Cannot get artifact instances without specified values"); + throw new CentralRepoException("Cannot get artifact instances without specified values"); } return getCorrAttrInstances(prepareGetInstancesSql(aType, values), aType); } @@ -1295,13 +1295,13 @@ abstract class RdbmsCentralRepo implements CentralRepository { @Override public List getArtifactInstancesByTypeValuesAndCases(CorrelationAttributeInstance.Type aType, List values, List caseIds) throws CentralRepoException, CorrelationAttributeNormalizationException { if (aType == null) { - throw new CorrelationAttributeNormalizationException("Cannot get artifact instances for null type"); + throw new CentralRepoException("Cannot get artifact instances for null type"); } if (values == null || values.isEmpty()) { - throw new CorrelationAttributeNormalizationException("Cannot get artifact instances without specified values"); + throw new CentralRepoException("Cannot get artifact instances without specified values"); } if (caseIds == null || caseIds.isEmpty()) { - throw new CorrelationAttributeNormalizationException("Cannot get artifact instances without specified cases"); + throw new CentralRepoException("Cannot get artifact instances without specified cases"); } String tableName = CentralRepoDbUtil.correlationTypeToInstanceTableName(aType); String sql @@ -1327,7 +1327,7 @@ abstract class RdbmsCentralRepo implements CentralRepository { * * @throws CorrelationAttributeNormalizationException */ - private String prepareGetInstancesSql(CorrelationAttributeInstance.Type aType, List values) throws CorrelationAttributeNormalizationException { + private String prepareGetInstancesSql(CorrelationAttributeInstance.Type aType, List values) throws CorrelationAttributeNormalizationException, CentralRepoException { String tableName = CentralRepoDbUtil.correlationTypeToInstanceTableName(aType); String sql = "SELECT " diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/ingestmodule/CentralRepoIngestModuleUtils.java b/Core/src/org/sleuthkit/autopsy/centralrepository/ingestmodule/CentralRepoIngestModuleUtils.java index ab74b8c9b1..676cb86ba3 100755 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/ingestmodule/CentralRepoIngestModuleUtils.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/ingestmodule/CentralRepoIngestModuleUtils.java @@ -81,7 +81,7 @@ class CentralRepoIngestModuleUtils { } } } catch (CorrelationAttributeNormalizationException ex) { - LOGGER.log(Level.WARNING, String.format("Error normalizing correlation attribute value for 's' (job ID=%d): %s", corrAttr, ingestJobId, ex.getMessage())); // NON-NLS + LOGGER.log(Level.WARNING, String.format("Error normalizing correlation attribute value for 's' (job ID=%d)", corrAttr, ingestJobId), ex); // NON-NLS } catch (CentralRepoException ex) { LOGGER.log(Level.SEVERE, String.format("Error getting previous occurences of correlation attribute 's' (job ID=%d)", corrAttr, ingestJobId), ex); // NON-NLS } diff --git a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeCaseSearchResults.java b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeCaseSearchResults.java index 01c599d1cc..6b1fe1ab72 100644 --- a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeCaseSearchResults.java +++ b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeCaseSearchResults.java @@ -240,7 +240,7 @@ final public class CommonAttributeCaseSearchResults { return true; } } catch (CorrelationAttributeNormalizationException ex) { - LOGGER.log(Level.WARNING, "Unable to determine frequency percentage attribute - frequency filter may not be accurate for these results: " + ex.getMessage()); + LOGGER.log(Level.WARNING, "Unable to determine frequency percentage attribute - frequency filter may not be accurate for these results.", ex); } } return false; diff --git a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeCountSearchResults.java b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeCountSearchResults.java index 8e5a1e2aa9..80a65b2835 100644 --- a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeCountSearchResults.java +++ b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeCountSearchResults.java @@ -162,7 +162,7 @@ final public class CommonAttributeCountSearchResults { } } } catch (CorrelationAttributeNormalizationException ex) { - LOGGER.log(Level.WARNING, "Unable to determine frequency percentage attribute - frequency filter may not be accurate for these results: " + ex.getMessage()); + LOGGER.log(Level.WARNING, "Unable to determine frequency percentage attribute - frequency filter may not be accurate for these results.", ex); } } } diff --git a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCaseSearchResultsProcessor.java b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCaseSearchResultsProcessor.java index 74f622d866..6d321f0340 100644 --- a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCaseSearchResultsProcessor.java +++ b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCaseSearchResultsProcessor.java @@ -308,7 +308,7 @@ final class InterCaseSearchResultsProcessor { } } } catch (SQLException | CentralRepoException | CorrelationAttributeNormalizationException ex) { - LOGGER.log(Level.WARNING, "Error getting artifact instances from database: " + ex.getMessage()); // NON-NLS + LOGGER.log(Level.WARNING, "Error getting artifact instances from database.", ex); // NON-NLS } } @@ -386,7 +386,7 @@ final class InterCaseSearchResultsProcessor { } } } catch (CentralRepoException | SQLException | CorrelationAttributeNormalizationException ex) { - LOGGER.log(Level.WARNING, "Error getting artifact instances from database: " + ex.getMessage()); // NON-NLS + LOGGER.log(Level.WARNING, "Error getting artifact instances from database.", ex); // NON-NLS } } @@ -424,7 +424,7 @@ final class InterCaseSearchResultsProcessor { InstanceTableCallback.getFilePath(resultSet)); } } catch (CorrelationAttributeNormalizationException ex) { - LOGGER.log(Level.INFO, "Unable to get CorrelationAttributeInstance: " + ex.getMessage()); // NON-NLS + LOGGER.log(Level.INFO, "Unable to get CorrelationAttributeInstance.", ex); // NON-NLS } } diff --git a/Core/src/org/sleuthkit/autopsy/communications/relationships/CorrelationCaseChildNodeFactory.java b/Core/src/org/sleuthkit/autopsy/communications/relationships/CorrelationCaseChildNodeFactory.java index 5d077e7d43..43be8d7f4b 100755 --- a/Core/src/org/sleuthkit/autopsy/communications/relationships/CorrelationCaseChildNodeFactory.java +++ b/Core/src/org/sleuthkit/autopsy/communications/relationships/CorrelationCaseChildNodeFactory.java @@ -90,7 +90,7 @@ final class CorrelationCaseChildNodeFactory extends ChildFactory extends A } catch (CentralRepoException ex) { logger.log(Level.SEVERE, "Error getting count of datasources with correlation attribute", ex); } catch (CorrelationAttributeNormalizationException ex) { - logger.log(Level.WARNING, "Unable to normalize data to get count of datasources with correlation attribute: " + ex.getMessage()); + logger.log(Level.WARNING, "Unable to normalize data to get count of datasources with correlation attribute", ex); } return Pair.of(count, description); } diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/BlackboardArtifactNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/BlackboardArtifactNode.java index 0e1a2c0e75..eb0a2e8838 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/BlackboardArtifactNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/BlackboardArtifactNode.java @@ -1232,7 +1232,7 @@ public class BlackboardArtifactNode extends AbstractContentNode