From 2127f6f7550d2dac2b7819ff6d12563025ec86c6 Mon Sep 17 00:00:00 2001 From: Raman Arora <raman@basistech.com> Date: Thu, 12 Mar 2020 14:55:37 -0400 Subject: [PATCH] 6128: Type match exception for TSK_COUNT attribute. --- .../blackboardutils/ArtifactHelperBase.java | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/bindings/java/src/org/sleuthkit/datamodel/blackboardutils/ArtifactHelperBase.java b/bindings/java/src/org/sleuthkit/datamodel/blackboardutils/ArtifactHelperBase.java index d8505ed53..426061af6 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/blackboardutils/ArtifactHelperBase.java +++ b/bindings/java/src/org/sleuthkit/datamodel/blackboardutils/ArtifactHelperBase.java @@ -1,7 +1,7 @@ /* * Sleuth Kit Data Model * - * Copyright 2019 Basis Technology Corp. + * Copyright 2019-2020 Basis Technology Corp. * Contact: carrier <at> sleuthkit <dot> org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -75,11 +75,11 @@ String getModuleName() { } /** - * Creates and adds an attribute of specified type to the given list, if the + * Creates and adds a string attribute of specified type to the given list, if the * attribute value is not empty or null. * * @param attributeType Attribute type. - * @param attrValue Attribute value. + * @param attrValue String attribute value. * @param attributes List of attributes to add to. * */ @@ -90,11 +90,11 @@ void addAttributeIfNotNull(BlackboardAttribute.ATTRIBUTE_TYPE attributeType, Str } /** - * Creates and adds an attribute of specified type to the given list, if the + * Creates and adds a long attribute of specified type to the given list, if the * attribute value is not 0. * * @param attributeType Attribute type. - * @param attrValue Attribute value. + * @param attrValue Long attribute value. * @param attributes List of attributes to add to. */ void addAttributeIfNotZero(BlackboardAttribute.ATTRIBUTE_TYPE attributeType, long attrValue, Collection<BlackboardAttribute> attributes) { @@ -102,4 +102,18 @@ void addAttributeIfNotZero(BlackboardAttribute.ATTRIBUTE_TYPE attributeType, lon attributes.add(new BlackboardAttribute(attributeType, getModuleName(), attrValue)); } } + + /** + * Creates and adds an integer attribute of specified type to the given list, if the + * attribute value is not 0. + * + * @param attributeType Attribute type. + * @param attrValue Integer attribute value. + * @param attributes List of attributes to add to. + */ + void addAttributeIfNotZero(BlackboardAttribute.ATTRIBUTE_TYPE attributeType, int attrValue, Collection<BlackboardAttribute> attributes) { + if (attrValue > 0) { + attributes.add(new BlackboardAttribute(attributeType, getModuleName(), attrValue)); + } + } } -- GitLab