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
d77a53be
Unverified
Commit
d77a53be
authored
7 years ago
by
Richard Cordovano
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #1078 from dgrove727/3435_InvalidPathTSK
3435 invalid path tsk
parents
8eeb63a4
e51bd3d8
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
bindings/java/src/org/sleuthkit/datamodel/AbstractFile.java
+14
-14
14 additions, 14 deletions
bindings/java/src/org/sleuthkit/datamodel/AbstractFile.java
with
14 additions
and
14 deletions
bindings/java/src/org/sleuthkit/datamodel/AbstractFile.java
+
14
−
14
View file @
d77a53be
/*
/*
* SleuthKit Java Bindings
* SleuthKit Java Bindings
*
*
* Copyright 2011-201
7
Basis Technology Corp.
* Copyright 2011-201
8
Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
* Contact: carrier <at> sleuthkit <dot> org
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
...
@@ -82,8 +82,8 @@ public abstract class AbstractFile extends AbstractContent {
...
@@ -82,8 +82,8 @@ public abstract class AbstractFile extends AbstractContent {
private
boolean
md5HashDirty
=
false
;
private
boolean
md5HashDirty
=
false
;
private
String
mimeType
;
private
String
mimeType
;
private
boolean
mimeTypeDirty
=
false
;
private
boolean
mimeTypeDirty
=
false
;
private
static
final
Logger
logger
=
Logger
.
getLogger
(
AbstractFile
.
class
.
getName
());
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
AbstractFile
.
class
.
getName
());
private
static
final
ResourceBundle
bundle
=
ResourceBundle
.
getBundle
(
"org.sleuthkit.datamodel.Bundle"
);
private
static
final
ResourceBundle
BUNDLE
=
ResourceBundle
.
getBundle
(
"org.sleuthkit.datamodel.Bundle"
);
private
long
dataSourceObjectId
;
private
long
dataSourceObjectId
;
private
final
String
extension
;
private
final
String
extension
;
...
@@ -801,7 +801,7 @@ protected int readInt(byte[] buf, long offset, long len) throws TskCoreException
...
@@ -801,7 +801,7 @@ protected int readInt(byte[] buf, long offset, long len) throws TskCoreException
protected
final
int
readLocal
(
byte
[]
buf
,
long
offset
,
long
len
)
throws
TskCoreException
{
protected
final
int
readLocal
(
byte
[]
buf
,
long
offset
,
long
len
)
throws
TskCoreException
{
if
(!
localPathSet
)
{
if
(!
localPathSet
)
{
throw
new
TskCoreException
(
throw
new
TskCoreException
(
bundle
.
getString
(
"AbstractFile.readLocal.exception.msg1.text"
));
BUNDLE
.
getString
(
"AbstractFile.readLocal.exception.msg1.text"
));
}
}
if
(
isDir
())
{
if
(
isDir
())
{
...
@@ -811,11 +811,11 @@ protected final int readLocal(byte[] buf, long offset, long len) throws TskCoreE
...
@@ -811,11 +811,11 @@ protected final int readLocal(byte[] buf, long offset, long len) throws TskCoreE
loadLocalFile
();
loadLocalFile
();
if
(!
localFile
.
exists
())
{
if
(!
localFile
.
exists
())
{
throw
new
TskCoreException
(
throw
new
TskCoreException
(
MessageFormat
.
format
(
bundle
.
getString
(
"AbstractFile.readLocal.exception.msg2.text"
),
localAbsPath
));
MessageFormat
.
format
(
BUNDLE
.
getString
(
"AbstractFile.readLocal.exception.msg2.text"
),
localAbsPath
));
}
}
if
(!
localFile
.
canRead
())
{
if
(!
localFile
.
canRead
())
{
throw
new
TskCoreException
(
throw
new
TskCoreException
(
MessageFormat
.
format
(
bundle
.
getString
(
"AbstractFile.readLocal.exception.msg3.text"
),
localAbsPath
));
MessageFormat
.
format
(
BUNDLE
.
getString
(
"AbstractFile.readLocal.exception.msg3.text"
),
localAbsPath
));
}
}
int
bytesRead
=
0
;
int
bytesRead
=
0
;
...
@@ -826,10 +826,10 @@ protected final int readLocal(byte[] buf, long offset, long len) throws TskCoreE
...
@@ -826,10 +826,10 @@ protected final int readLocal(byte[] buf, long offset, long len) throws TskCoreE
try
{
try
{
localFileHandle
=
new
RandomAccessFile
(
localFile
,
"r"
);
localFileHandle
=
new
RandomAccessFile
(
localFile
,
"r"
);
}
catch
(
FileNotFoundException
ex
)
{
}
catch
(
FileNotFoundException
ex
)
{
final
String
msg
=
MessageFormat
.
format
(
bundle
.
getString
(
final
String
msg
=
MessageFormat
.
format
(
BUNDLE
.
getString
(
"AbstractFile.readLocal.exception.msg4.text"
),
"AbstractFile.readLocal.exception.msg4.text"
),
localAbsPath
);
localAbsPath
);
logger
.
log
(
Level
.
SEVERE
,
msg
,
ex
);
LOGGER
.
log
(
Level
.
SEVERE
,
msg
,
ex
);
//file could have been deleted or moved
//file could have been deleted or moved
throw
new
TskCoreException
(
msg
,
ex
);
throw
new
TskCoreException
(
msg
,
ex
);
}
}
...
@@ -863,8 +863,8 @@ protected final int readLocal(byte[] buf, long offset, long len) throws TskCoreE
...
@@ -863,8 +863,8 @@ protected final int readLocal(byte[] buf, long offset, long len) throws TskCoreE
return
localFileHandle
.
read
(
buf
,
0
,
(
int
)
len
);
return
localFileHandle
.
read
(
buf
,
0
,
(
int
)
len
);
}
}
}
catch
(
IOException
ex
)
{
}
catch
(
IOException
ex
)
{
final
String
msg
=
MessageFormat
.
format
(
bundle
.
getString
(
"AbstractFile.readLocal.exception.msg5.text"
),
localAbsPath
);
final
String
msg
=
MessageFormat
.
format
(
BUNDLE
.
getString
(
"AbstractFile.readLocal.exception.msg5.text"
),
localAbsPath
);
logger
.
log
(
Level
.
SEVERE
,
msg
,
ex
);
LOGGER
.
log
(
Level
.
SEVERE
,
msg
,
ex
);
//local file could have been deleted / moved
//local file could have been deleted / moved
throw
new
TskCoreException
(
msg
,
ex
);
throw
new
TskCoreException
(
msg
,
ex
);
}
}
...
@@ -937,7 +937,7 @@ public boolean exists() {
...
@@ -937,7 +937,7 @@ public boolean exists() {
loadLocalFile
();
loadLocalFile
();
return
localFile
.
exists
();
return
localFile
.
exists
();
}
catch
(
TskCoreException
ex
)
{
}
catch
(
TskCoreException
ex
)
{
logger
.
log
(
Level
.
SEVERE
,
ex
.
getMessage
());
LOGGER
.
log
(
Level
.
SEVERE
,
ex
.
getMessage
());
return
false
;
return
false
;
}
}
}
}
...
@@ -958,7 +958,7 @@ public boolean canRead() {
...
@@ -958,7 +958,7 @@ public boolean canRead() {
loadLocalFile
();
loadLocalFile
();
return
localFile
.
canRead
();
return
localFile
.
canRead
();
}
catch
(
TskCoreException
ex
)
{
}
catch
(
TskCoreException
ex
)
{
logger
.
log
(
Level
.
SEVERE
,
ex
.
getMessage
());
LOGGER
.
log
(
Level
.
SEVERE
,
ex
.
getMessage
());
return
false
;
return
false
;
}
}
}
}
...
@@ -973,7 +973,7 @@ public boolean canRead() {
...
@@ -973,7 +973,7 @@ public boolean canRead() {
private
void
loadLocalFile
()
throws
TskCoreException
{
private
void
loadLocalFile
()
throws
TskCoreException
{
if
(!
localPathSet
)
{
if
(!
localPathSet
)
{
throw
new
TskCoreException
(
throw
new
TskCoreException
(
bundle
.
getString
(
"AbstractFile.readLocal.exception.msg1.text"
));
BUNDLE
.
getString
(
"AbstractFile.readLocal.exception.msg1.text"
));
}
}
// already been set
// already been set
...
@@ -998,7 +998,7 @@ public void close() {
...
@@ -998,7 +998,7 @@ public void close() {
try
{
try
{
localFileHandle
.
close
();
localFileHandle
.
close
();
}
catch
(
IOException
ex
)
{
}
catch
(
IOException
ex
)
{
logger
.
log
(
Level
.
SEVERE
,
"Could not close file handle for file: "
+
getParentPath
()
+
"/"
+
getName
(),
ex
);
//NON-NLS
LOGGER
.
log
(
Level
.
SEVERE
,
"Could not close file handle for file: "
+
getParentPath
()
+
getName
(),
ex
);
//NON-NLS
}
}
localFileHandle
=
null
;
localFileHandle
=
null
;
}
}
...
...
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