diff --git a/bindings/java/jni/auto_db_java.cpp b/bindings/java/jni/auto_db_java.cpp index 8fb5b158e85594874ad7067366e0ddc1b24ed80d..09bc0400a6ef6ac2f6c0a687745f9c213daff2d8 100644 --- a/bindings/java/jni/auto_db_java.cpp +++ b/bindings/java/jni/auto_db_java.cpp @@ -391,7 +391,7 @@ TskAutoDbJava::addFsInfo(const TSK_FS_INFO* fs_info, int64_t parObjId, return TSK_ERR; } - // Save the file system info for created unallocated blocks later + // Save the file system info for creating unallocated blocks later TSK_DB_FS_INFO fs_info_db; fs_info_db.objId = objId; fs_info_db.imgOffset = fs_info->offset; @@ -625,7 +625,7 @@ TskAutoDbJava::addFile(TSK_FS_FILE* fs_file, fs_file->name->type, meta_type, fs_file->name->flags, meta_flags, size, (unsigned long long)crtime, (unsigned long long)ctime, (unsigned long long) atime, (unsigned long long) mtime, - meta_mode, gid, uid, // md5TextPtr, known, + meta_mode, gid, uid, pathj, extj); objId = (int64_t)objIdj; diff --git a/bindings/java/jni/dataModel_SleuthkitJNI.cpp b/bindings/java/jni/dataModel_SleuthkitJNI.cpp index 990f7608be08114575e83cb5c9bfcb69dc0789da..5ce1cfc3988c070464c5dc552f54242a00f46c23 100644 --- a/bindings/java/jni/dataModel_SleuthkitJNI.cpp +++ b/bindings/java/jni/dataModel_SleuthkitJNI.cpp @@ -1107,8 +1107,6 @@ JNIEXPORT void JNICALL uint8_t ret = 0; if ( (ret = tskAuto->startAddImage((int) numImgs, imagepaths8, TSK_IMG_TYPE_DETECT, 0, device_id)) != 0) { - printf("runOpenAndAddImgNat - startAddImage finished with errors\n"); - fflush(stdout); stringstream msgss; msgss << "Errors occurred while ingesting image " << std::endl; vector<TskAuto::error_record> errors = tskAuto->getErrorList(); diff --git a/bindings/java/src/org/sleuthkit/datamodel/JniDbHelper.java b/bindings/java/src/org/sleuthkit/datamodel/JniDbHelper.java index ae102db9806432d0b29e9b38f34dd0e67841d9c1..9efb3f0589c6ce37f326ed9f21ebe9357624eb01 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/JniDbHelper.java +++ b/bindings/java/src/org/sleuthkit/datamodel/JniDbHelper.java @@ -392,8 +392,7 @@ long addUnallocFsBlockFilesParent(long fsObjId, String name) { logger.log(Level.SEVERE, "Error - root directory for file system ID {0} not found", fsObjId); return -1; } - VirtualDirectory dir = caseDb.addVirtualDirectoryJNI(fsIdToRootDir.get(fsObjId), name, trans); - return dir.getId(); + return caseDb.addVirtualDirectoryJNI(fsIdToRootDir.get(fsObjId), name, trans); } catch (TskCoreException ex) { logger.log(Level.SEVERE, "Error creating virtual directory " + name + " under file system ID " + fsObjId, ex); return -1; diff --git a/bindings/java/src/org/sleuthkit/datamodel/SleuthkitCase.java b/bindings/java/src/org/sleuthkit/datamodel/SleuthkitCase.java index 1f8f94bdee3e966abccb1f583433808153724802..d9b56ecdc3c854746f8129155c4e7c89e528c1fe 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/SleuthkitCase.java +++ b/bindings/java/src/org/sleuthkit/datamodel/SleuthkitCase.java @@ -11295,25 +11295,18 @@ void addLayoutFileRangeJNI(long objId, long byteStart, long byteLen, /** * Adds a virtual directory to the database and returns a VirtualDirectory * object representing it. - * - * Make sure the connection in transaction is used for all database - * interactions called by this method + * For use with the JNI callbacks associated with the add image process. * * @param parentId the ID of the parent, or 0 if NULL * @param directoryName the name of the virtual directory to create * @param transaction the transaction in the scope of which the operation * is to be performed, managed by the caller * - * @return a VirtualDirectory object representing the one added to the - * database. - * + * @return The object ID of the new virtual directory + * * @throws TskCoreException */ - public VirtualDirectory addVirtualDirectoryJNI(long parentId, String directoryName, CaseDbTransaction transaction) throws TskCoreException { - if (transaction == null) { - throw new TskCoreException("Passed null CaseDbTransaction"); - } - + long addVirtualDirectoryJNI(long parentId, String directoryName, CaseDbTransaction transaction) throws TskCoreException { acquireSingleUserCaseWriteLock(); ResultSet resultSet = null; try { @@ -11404,10 +11397,8 @@ public VirtualDirectory addVirtualDirectoryJNI(long parentId, String directoryNa //extension, since this is not really file we just set it to null statement.setString(20, null); connection.executeUpdate(statement); - - return new VirtualDirectory(this, newObjId, dataSourceObjectId, directoryName, dirType, - metaType, dirFlag, metaFlags, null, FileKnown.UNKNOWN, - parentPath); + + return newObjId; } catch (SQLException e) { throw new TskCoreException("Error creating virtual directory '" + directoryName + "'", e); } finally {