diff --git a/bindings/java/src/org/sleuthkit/datamodel/AbstractAttribute.java b/bindings/java/src/org/sleuthkit/datamodel/AbstractAttribute.java index 7cc17d6e0633fb6d129f758fd33e0ec7aaaebe46..23aca765888b608a6c996118a64b772ff0150c78 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/AbstractAttribute.java +++ b/bindings/java/src/org/sleuthkit/datamodel/AbstractAttribute.java @@ -22,14 +22,14 @@ import java.util.Objects; /** - * Attributes are a name-value pairs. Abstract Attribute provides the base - * functionality for a name value pair with type safety (analogous to a C union) + * An abstract base class for attributes as name-value pairs with type safety. + * The attribute type field indicates which one of the value fields is valid. */ public abstract class AbstractAttribute { private static final char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray(); - private BlackboardAttribute.Type attributeType; + private final BlackboardAttribute.Type attributeType; private final int valueInt; private final long valueLong; @@ -40,8 +40,7 @@ public abstract class AbstractAttribute { private SleuthkitCase sleuthkitCase; /** - * Constructs an attribute with an integer value. The attribute should be - * added to an appropriate artifact. + * Constructs an attribute with an integer value. * * @param attributeType The attribute type. * @param valueInt The attribute value. @@ -63,8 +62,7 @@ public AbstractAttribute(BlackboardAttribute.Type attributeType, int valueInt) { } /** - * Constructs an attribute with a long/datetime value. The attribute should - * be added to an appropriate artifact. + * Constructs an attribute with a long/datetime value. * * @param attributeType The attribute type. * @param valueLong The attribute value. @@ -89,8 +87,7 @@ public AbstractAttribute(BlackboardAttribute.Type attributeType, long valueLong) } /** - * Constructs an attribute with a double value. The attribute should be - * added to an appropriate artifact. + * Constructs an attribute with a double value. * * @param attributeType The attribute type. * @param valueDouble The attribute value. @@ -112,8 +109,7 @@ public AbstractAttribute(BlackboardAttribute.Type attributeType, double valueDou } /** - * Constructs an attribute with a string value. The attribute should be - * added to an appropriate artifact. + * Constructs an attribute with a string value. * * @param attributeType The attribute type. * @param valueString The attribute value. @@ -140,8 +136,7 @@ public AbstractAttribute(BlackboardAttribute.Type attributeType, String valueStr } /** - * Constructs an attribute with a byte array value. The attribute should be - * added to an appropriate artifact. + * Constructs an attribute with a byte array value. * * @param attributeType The attribute type. * @param valueBytes The attribute value. @@ -167,9 +162,7 @@ public AbstractAttribute(BlackboardAttribute.Type attributeType, byte[] valueByt } /** - * Constructs an artifact attribute. To be used when creating an attribute - * based on a query of the blackboard _attributes table in the case - * database. + * Constructs an attribute. * * @param attributeTypeID The attribute type id. * @param valueType The attribute value type. @@ -246,7 +239,7 @@ public BlackboardAttribute.Type getAttributeType() { } /** - * Gets the value type. + * Gets the value type of this attribute. * * @return The value type */ @@ -305,13 +298,19 @@ public byte[] getValueBytes() { return Arrays.copyOf(valueBytes, valueBytes.length); } + /** + * Gets the reference to the SleuthkitCase object that represents the case + * database where this attribute is stored. + * + * @return A reference to a SleuthkitCase object. + */ SleuthkitCase getCaseDatabase() { return this.sleuthkitCase; } /** * Sets the reference to the SleuthkitCase object that represents the case - * database. + * database where this attribute is stored. * * @param sleuthkitCase A reference to a SleuthkitCase object. */ @@ -344,18 +343,25 @@ static String bytesToHexString(byte[] bytes) { * * @return The output string. */ - final String replaceNulls(String text) { + static String replaceNulls(String text) { return text.replace((char) 0x00, (char) 0x1A); } - boolean isAttributeEquals(Object that) { + /** + * Checks whether all of the the value fields of this attribute are equal to + * that of another attribute. + * + * @param that Another attribute. + * + * @return True or false. + */ + boolean areValuesEqual(Object that) { if (that instanceof AbstractAttribute) { AbstractAttribute other = (AbstractAttribute) that; Object[] thisObject = new Object[]{this.getAttributeType(), this.getValueInt(), this.getValueLong(), this.getValueDouble(), this.getValueString(), this.getValueBytes()}; Object[] otherObject = new Object[]{other.getAttributeType(), other.getValueInt(), other.getValueLong(), other.getValueDouble(), other.getValueString(), other.getValueBytes()}; - return Objects.deepEquals(thisObject, otherObject); } else { return false; diff --git a/bindings/java/src/org/sleuthkit/datamodel/Attribute.java b/bindings/java/src/org/sleuthkit/datamodel/Attribute.java index 3d4d4c3fc01bd77fcf98427762411cda1aedd9da..829bdf5256f42db143852bcdb5c2e6aa6135bd1a 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/Attribute.java +++ b/bindings/java/src/org/sleuthkit/datamodel/Attribute.java @@ -192,7 +192,7 @@ public boolean equals(Object that) { if (this == that) { return true; } else if (that instanceof Attribute) { - return isAttributeEquals(that); + return areValuesEqual(that); } else { return false; } diff --git a/bindings/java/src/org/sleuthkit/datamodel/BlackboardAttribute.java b/bindings/java/src/org/sleuthkit/datamodel/BlackboardAttribute.java index 7f3ecbf56f5b12d8aa71745eb1f7a8e524c32c9f..4fa47ca93750237d5de63edc856e29d9368c3b11 100755 --- a/bindings/java/src/org/sleuthkit/datamodel/BlackboardAttribute.java +++ b/bindings/java/src/org/sleuthkit/datamodel/BlackboardAttribute.java @@ -327,7 +327,7 @@ public boolean equals(Object that) { BlackboardAttribute other = (BlackboardAttribute) that; Object[] thisObject = new Object[]{this.getSources(), this.getContext()}; Object[] otherObject = new Object[]{other.getSources(), other.getContext()}; - return isAttributeEquals(that) && Objects.deepEquals(thisObject, otherObject); + return areValuesEqual(that) && Objects.deepEquals(thisObject, otherObject); } else { return false; } diff --git a/tsk/fs/ext2fs.c b/tsk/fs/ext2fs.c index cc42ff5f51c61976053dad83a9fb5bfdaa321d37..d6abbd9f5a162c7d952c2a8d48aadf32ff02c364 100755 --- a/tsk/fs/ext2fs.c +++ b/tsk/fs/ext2fs.c @@ -650,7 +650,7 @@ ext4_load_attrs_inline(TSK_FS_FILE *fs_file, const uint8_t * ea_buf, size_t ea_b if (index + sizeof(ext2fs_ea_entry) + strlen("data") > ea_buf_len) { break; } - ext2fs_ea_entry *ea_entry = (ext2fs_ea_entry*) &(ea_buf[index]); + ea_entry = (ext2fs_ea_entry*) &(ea_buf[index]); } }