Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Sleuthkit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IRT
Sleuthkit
Commits
b6789e21
Commit
b6789e21
authored
4 years ago
by
apriestman
Browse files
Options
Downloads
Patches
Plain Diff
Change success/error handling for addImageProcess
parent
752fb305
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bindings/java/src/org/sleuthkit/datamodel/Examples/Sample.java
+1
-1
1 addition, 1 deletion
...ngs/java/src/org/sleuthkit/datamodel/Examples/Sample.java
bindings/java/src/org/sleuthkit/datamodel/SleuthkitJNI.java
+41
-0
41 additions, 0 deletions
bindings/java/src/org/sleuthkit/datamodel/SleuthkitJNI.java
with
42 additions
and
1 deletion
bindings/java/src/org/sleuthkit/datamodel/Examples/Sample.java
+
1
−
1
View file @
b6789e21
...
...
@@ -50,7 +50,7 @@ public static void run(String imagePath) {
}
catch
(
TskDataException
ex
)
{
Logger
.
getLogger
(
Sample
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
}
process
.
commit
();
process
.
finishAddImageProcess
();
// print out all the images found, and their children
List
<
Image
>
images
=
sk
.
getImages
();
...
...
This diff is collapsed.
Click to expand it.
bindings/java/src/org/sleuthkit/datamodel/SleuthkitJNI.java
+
41
−
0
View file @
b6789e21
...
...
@@ -557,6 +557,7 @@ public void run(String deviceId, String[] imageFilePaths, int sectorSize,
}
if
(
imageHandle
!=
0
)
{
runAddImgNat
(
tskAutoDbPointer
,
deviceId
,
imageHandle
,
timeZone
,
imageWriterPath
);
dbHelper
.
finish
();
}
}
finally
{
releaseTSKReadLock
();
...
...
@@ -583,6 +584,42 @@ public synchronized void stop() throws TskCoreException {
releaseTSKReadLock
();
}
}
/**
* Call at the end of the add image process regardless of the error/canceled state.
*
* Note that the new image is no longer deleted on error/cancellation
*
* If the process was not canceled, will add the final batch of files to the database
* and submit for any further processing through the callback.
*
* @return The object ID of the newly added image
*
* @throws TskCoreException
*/
public
synchronized
long
finishAddImageProcess
()
throws
TskCoreException
{
getTSKReadLock
();
try
{
if
(
tskAutoDbPointer
==
0
)
{
throw
new
TskCoreException
(
"AddImgProcess::finishAddImageProcess: AutoDB pointer is NULL"
);
}
// If the process wasn't cancelled, finish up processing the
// remaining files.
if
(!
this
.
isCanceled
&&
dbHelper
!=
null
)
{
dbHelper
.
finish
();
}
// Free the auto DB pointer and get the image ID
long
id
=
finishAddImgNat
(
tskAutoDbPointer
);
tskAutoDbPointer
=
0
;
skCase
.
addDataSourceToHasChildrenMap
();
return
id
;
}
finally
{
releaseTSKReadLock
();
}
}
/**
* Rolls back the process of adding an image to the case database
...
...
@@ -590,7 +627,9 @@ public synchronized void stop() throws TskCoreException {
*
* @throws TskCoreException if a critical error occurs within the
* SleuthKit.
* @deprecated Use finishAddImageProcess() instead
*/
@Deprecated
public
synchronized
void
revert
()
throws
TskCoreException
{
getTSKReadLock
();
try
{
...
...
@@ -614,7 +653,9 @@ public synchronized void revert() throws TskCoreException {
*
* @throws TskCoreException if a critical error occurs within the
* SleuthKit.
* @deprecated Use finishAddImageProcess() instead
*/
@Deprecated
public
synchronized
long
commit
()
throws
TskCoreException
{
getTSKReadLock
();
try
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment