From 5d9df5433ae8450eb4dae71c94673c386d026f3e Mon Sep 17 00:00:00 2001 From: Ann Priestman <apriestman@basistech.com> Date: Thu, 3 Nov 2016 14:05:40 -0400 Subject: [PATCH] Cleanup --- .../org/sleuthkit/datamodel/Bundle.properties | 1 + .../org/sleuthkit/datamodel/SlackFile.java | 128 ++---------------- .../sleuthkit/datamodel/SleuthkitCase.java | 2 +- tsk/auto/db_sqlite.cpp | 1 - tsk/auto/tsk_case_db.h | 4 - 5 files changed, 12 insertions(+), 124 deletions(-) diff --git a/bindings/java/src/org/sleuthkit/datamodel/Bundle.properties b/bindings/java/src/org/sleuthkit/datamodel/Bundle.properties index 3d4fd0bf5..9932fde8c 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/Bundle.properties +++ b/bindings/java/src/org/sleuthkit/datamodel/Bundle.properties @@ -162,6 +162,7 @@ Image.verifyImageSize.errStr1.text=\nPossible Incomplete Image\: Error reading v Image.verifyImageSize.errStr2.text=\nPossible Incomplete Image\: Error reading volume at offset {0} Image.verifyImageSize.errStr3.text=\nPossible Incomplete Image\: Error reading file system at offset {0} Image.verifyImageSize.errStr4.text=\nPossible Incomplete Image\: Error reading file system at offset {0} +SlackFile.readInt.err.msg.text=Image file does not exist or is inaccessible. SleuthkitCase.isFileFromSource.exception.msg.text=Error, data source should be parent-less (images, file-sets), got\: {0} SleuthkitCase.isFileFromSource.exception.msg2.text=Error, data source should be Image or VirtualDirectory, got\: {0} SleuthkitCase.SchemaVersionMismatch=Schema version does not match diff --git a/bindings/java/src/org/sleuthkit/datamodel/SlackFile.java b/bindings/java/src/org/sleuthkit/datamodel/SlackFile.java index 2c0ef4dd3..76d5cfadc 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/SlackFile.java +++ b/bindings/java/src/org/sleuthkit/datamodel/SlackFile.java @@ -19,6 +19,7 @@ package org.sleuthkit.datamodel; import java.util.List; +import java.util.ResourceBundle; import org.sleuthkit.datamodel.TskData.FileKnown; import org.sleuthkit.datamodel.TskData.TSK_FS_ATTR_TYPE_ENUM; import org.sleuthkit.datamodel.TskData.TSK_FS_META_TYPE_ENUM; @@ -29,6 +30,8 @@ * A representation of a slack file that has been added to a case. */ public class SlackFile extends FsContent { + private static final ResourceBundle bundle = ResourceBundle.getBundle("org.sleuthkit.datamodel.Bundle"); + private final SleuthkitCase tskCase; /** * Constructs a representation of the slack space from a file system file that has been added to @@ -90,6 +93,7 @@ public class SlackFile extends FsContent { short modes, int uid, int gid, String md5Hash, FileKnown knownState, String parentPath, String mimeType) { super(db, objId, dataSourceObjectId, fsObjId, attrType, attrId, name, TskData.TSK_DB_FILES_TYPE_ENUM.SLACK, metaAddr, metaSeq, dirType, metaType, dirFlag, metaFlags, size, ctime, crtime, atime, mtime, modes, uid, gid, md5Hash, knownState, parentPath, mimeType); + this.tskCase = db; } /** @@ -120,8 +124,9 @@ protected int readInt(byte[] buf, long offset, long len) throws TskCoreException Image image = (Image) dataSource; if (!image.imageFileExists()) { // FIX THIS LATER - //tskCase.submitError(SleuthkitCase.ErrorObserver.Context.IMAGE_READ_ERROR.getContextString(), - // bundle.getString("FsContent.readInt.err.msg.text")); + + tskCase.submitError(SleuthkitCase.ErrorObserver.Context.IMAGE_READ_ERROR.getContextString(), + bundle.getString("SlackFile.readInt.err.msg.text")); } } throw ex; @@ -158,7 +163,7 @@ public List<Long> getChildrenIds() throws TskCoreException { /** * Accepts a content visitor (Visitor design pattern). * - * @param visitor A ContentVisitor supplying an algorithm to run using this + * @param v A ContentVisitor supplying an algorithm to run using this * file as input. * * @return The output of the algorithm. @@ -171,7 +176,7 @@ public <T> T accept(SleuthkitItemVisitor<T> v) { /** * Accepts a Sleuthkit item visitor (Visitor design pattern). * - * @param visitor A SleuthkitItemVisitor supplying an algorithm to run using + * @param v A SleuthkitItemVisitor supplying an algorithm to run using * this file as input. * * @return The output of the algorithm. @@ -192,119 +197,6 @@ public <T> T accept(ContentVisitor<T> v) { */ @Override public String toString(boolean preserveState) { - return super.toString(preserveState) + "File [\t" + "]\t"; //NON-NLS - } - - /** - * Constructs a representation of a file system file that has been added to - * the case. - * - * @param db The case database to which the file has been added. - * @param objId The object id of the file in the case database. - * @param fsObjId The object id of the file system to which this file - * belongs. - * @param attrType The type attribute given to the file by the file - * system. - * @param attrId The type id given to the file by the file system. - * @param name The name of the file. - * @param metaAddr The meta address of the file. - * @param metaSeq The meta sequence number of the file. - * @param dirType The type of the file, usually as reported in the name - * structure of the file system. May be set to - * TSK_FS_NAME_TYPE_ENUM.UNDEF. - * @param metaType The type of the file, usually as reported in the - * metadata structure of the file system. May be set to - * TSK_FS_META_TYPE_ENUM.TSK_FS_META_TYPE_UNDEF. - * @param dirFlag The allocated status of the file, usually as reported - * in the name structure of the file system. - * @param metaFlags The allocated status of the file, usually as reported - * in the metadata structure of the file system. - * @param size The size of the file. - * @param ctime The changed time of the file. - * @param crtime The created time of the file. - * @param atime The accessed time of the file. - * @param mtime The modified time of the file. - * @param modes The modes for the file. - * @param uid The UID for the file. - * @param gid The GID for the file. - * @param md5Hash The MD5 hash of the file, null if not yet calculated. - * @param knownState The known state of the file from a hash database - * lookup, null if not yet looked up. - * @param parentPath The path of the parent of the file. - * - * @deprecated Do not make subclasses outside of this package. - */ - @Deprecated - @SuppressWarnings("deprecation") - protected SlackFile(SleuthkitCase db, - long objId, - long fsObjId, - TSK_FS_ATTR_TYPE_ENUM attrType, short attrId, - String name, - long metaAddr, int metaSeq, - TSK_FS_NAME_TYPE_ENUM dirType, TSK_FS_META_TYPE_ENUM metaType, - TSK_FS_NAME_FLAG_ENUM dirFlag, short metaFlags, - long size, - long ctime, long crtime, long atime, long mtime, - short modes, int uid, int gid, - String md5Hash, FileKnown knownState, String parentPath) { - this(db, objId, db.getDataSourceObjectId(objId), fsObjId, attrType, attrId, name, metaAddr, metaSeq, dirType, metaType, dirFlag, metaFlags, size, ctime, crtime, atime, mtime, modes, uid, gid, md5Hash, knownState, parentPath, null); - } - - /** - * Constructs a representation of a file system file that has been added to - * the case. This deprecated version has attrId filed defined as a short - * which has since been changed to an int. - * - * @param db The case database to which the file has been - * added. - * @param objId The object id of the file in the case database. - * @param dataSourceObjectId The object id of the data source for the file. - * @param fsObjId The object id of the file system to which this - * file belongs. - * @param attrType The type attribute given to the file by the - * file system. - * @param attrId The type id given to the file by the file - * system. - * @param name The name of the file. - * @param metaAddr The meta address of the file. - * @param metaSeq The meta sequence number of the file. - * @param dirType The type of the file, usually as reported in - * the name structure of the file system. May be - * set to TSK_FS_NAME_TYPE_ENUM.UNDEF. - * @param metaType The type of the file, usually as reported in - * the metadata structure of the file system. May - * be set to - * TSK_FS_META_TYPE_ENUM.TSK_FS_META_TYPE_UNDEF. - * @param dirFlag The allocated status of the file, usually as - * reported in the name structure of the file - * system. - * @param metaFlags The allocated status of the file, usually as - * reported in the metadata structure of the file - * system. - * @param size The size of the file. - * @param ctime The changed time of the file. - * @param crtime The created time of the file. - * @param atime The accessed time of the file. - * @param mtime The modified time of the file. - * @param modes The modes for the file. - * @param uid The UID for the file. - * @param gid The GID for the file. - * @param md5Hash The MD5 hash of the file, null if not yet - * calculated. - * @param knownState The known state of the file from a hash - * database lookup, null if not yet looked up. - * @param parentPath The path of the parent of the file. - * @param mimeType The MIME type of the file, null if it has not - * yet been determined. - * @deprecated Do not make subclasses outside of this package. - */ - @Deprecated - @SuppressWarnings("deprecation") - SlackFile(SleuthkitCase db, long objId, long dataSourceObjectId, long fsObjId, TSK_FS_ATTR_TYPE_ENUM attrType, short attrId, - String name, long metaAddr, int metaSeq, TSK_FS_NAME_TYPE_ENUM dirType, TSK_FS_META_TYPE_ENUM metaType, - TSK_FS_NAME_FLAG_ENUM dirFlag, short metaFlags, long size, long ctime, long crtime, long atime, long mtime, - short modes, int uid, int gid, String md5Hash, FileKnown knownState, String parentPath, String mimeType) { - this(db, objId, dataSourceObjectId, fsObjId, attrType, (int) attrId, name, metaAddr, metaSeq, dirType, metaType, dirFlag, metaFlags, size, ctime, crtime, atime, mtime, modes, uid, gid, md5Hash, knownState, parentPath, mimeType); + return super.toString(preserveState) + "SlackFile [\t" + "]\t"; //NON-NLS } } diff --git a/bindings/java/src/org/sleuthkit/datamodel/SleuthkitCase.java b/bindings/java/src/org/sleuthkit/datamodel/SleuthkitCase.java index 7854d4ca9..da4cd0400 100755 --- a/bindings/java/src/org/sleuthkit/datamodel/SleuthkitCase.java +++ b/bindings/java/src/org/sleuthkit/datamodel/SleuthkitCase.java @@ -5376,7 +5376,7 @@ LocalFile localFile(ResultSet rs, CaseDbConnection connection, long parentId) th * @param rs the result set * @param fs parent file system * - * @return a newly create Slack File + * @return a newly created Slack File * * @throws SQLException */ diff --git a/tsk/auto/db_sqlite.cpp b/tsk/auto/db_sqlite.cpp index 8f4ed1b0e..d6694b2b5 100755 --- a/tsk/auto/db_sqlite.cpp +++ b/tsk/auto/db_sqlite.cpp @@ -816,7 +816,6 @@ int64_t TskDbSqlite::findParObjId(const TSK_FS_FILE * fs_file, const char *paren // Find the parent file id in the database using the parent metadata address // @@@ This should use sequence number when the new database supports it - printf("Trying to look up parent %s %s with metadata addr %x\n", parent_path, parent_name, fs_file->name->par_addr); if (attempt(sqlite3_bind_int64(m_selectFilePreparedStmt, 1, fs_file->name->par_addr), "TskDbSqlite::findParObjId: Error binding meta_addr to statment: %s (result code %d)\n") || attempt(sqlite3_bind_int64(m_selectFilePreparedStmt, 2, fsObjId), diff --git a/tsk/auto/tsk_case_db.h b/tsk/auto/tsk_case_db.h index d356f487d..f9c333fe0 100644 --- a/tsk/auto/tsk_case_db.h +++ b/tsk/auto/tsk_case_db.h @@ -160,10 +160,6 @@ class TskAutoDb:public TskAuto { const TSK_FS_ATTR *, const char *path, const unsigned char *const md5, const TSK_DB_FILES_KNOWN_ENUM known); - TSK_RETVAL_ENUM insertSlackFileData(TSK_FS_FILE * fs_file, - const TSK_FS_ATTR *, const char *path, - const unsigned char *const md5, - const TSK_DB_FILES_KNOWN_ENUM known); virtual TSK_RETVAL_ENUM processAttribute(TSK_FS_FILE *, const TSK_FS_ATTR * fs_attr, const char *path); static TSK_WALK_RET_ENUM md5HashCallback(TSK_FS_FILE * file, -- GitLab