Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Autopsy
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
Autopsy
Commits
d1dabed8
Commit
d1dabed8
authored
4 years ago
by
apriestman
Browse files
Options
Downloads
Patches
Plain Diff
Refactor DrawableFile NPE fix
parent
a962ab34
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java
+9
-20
9 additions, 20 deletions
...leuthkit/autopsy/imagegallery/datamodel/DrawableFile.java
with
9 additions
and
20 deletions
ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java
+
9
−
20
View file @
d1dabed8
...
...
@@ -100,20 +100,9 @@ public static DrawableFile create(Long fileID, boolean analyzed) throws TskCoreE
private
String
model
;
private
final
CategoryManager
categoryManager
;
protected
DrawableFile
(
AbstractFile
file
,
Boolean
analyzed
)
{
this
.
analyzed
=
new
SimpleBooleanProperty
(
analyzed
);
this
.
file
=
file
;
ImageGalleryController
controllerForCase
=
ImageGalleryController
.
getController
(
Case
.
getCurrentCase
());
if
(
controllerForCase
!=
null
)
{
categoryManager
=
ImageGalleryController
.
getController
(
Case
.
getCurrentCase
()).
getCategoryManager
();
}
else
{
// If getting the controller fails it means the case is currently closing. No need to
// print an error.
categoryManager
=
null
;
}
}
public
abstract
boolean
isVideo
();
...
...
@@ -252,19 +241,19 @@ public SimpleObjectProperty<TagName> categoryProperty() {
/**
* Update the category property.
*/
private
void
updateCategory
()
{
// This only happens when a DrawableFile is created while the case is closing. No need
// to display the error message.
if
(
categoryManager
==
null
)
{
return
;
}
private
void
updateCategory
()
{
try
{
ImageGalleryController
controllerForCase
=
ImageGalleryController
.
getController
(
Case
.
getCurrentCaseThrows
());
if
(
controllerForCase
==
null
)
{
// This can only happen during case closing, so return without generating an error.
return
;
}
List
<
ContentTag
>
contentTags
=
getContentTags
();
TagName
tag
=
null
;
for
(
ContentTag
ct
:
contentTags
)
{
TagName
tagName
=
ct
.
getName
();
if
(
categoryManager
.
isCategoryTagName
(
tagName
))
{
if
(
c
ontrollerForCase
.
getC
ategoryManager
()
.
isCategoryTagName
(
tagName
))
{
tag
=
tagName
;
break
;
}
...
...
@@ -272,7 +261,7 @@ private void updateCategory() {
categoryTagName
.
set
(
tag
);
}
catch
(
TskCoreException
ex
)
{
LOGGER
.
log
(
Level
.
WARNING
,
"problem looking up category for "
+
this
.
getContentPathSafe
(),
ex
);
//NON-NLS
}
catch
(
IllegalStateException
ex
)
{
}
catch
(
IllegalStateException
|
NoCurrentCaseException
ex
)
{
// We get here many times if the case is closed during ingest, so don't print out a ton of warnings.
}
}
...
...
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