mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-13 08:26:15 +00:00
adding local files: handle case when listFiles() returns null
This commit is contained in:
parent
84e6791e02
commit
d929a6793b
@ -197,7 +197,8 @@ public class FileManager implements Closeable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for receiving notifications on folders being added via a callback
|
* Interface for receiving notifications on folders being added via a
|
||||||
|
* callback
|
||||||
*/
|
*/
|
||||||
public interface FileAddProgressUpdater {
|
public interface FileAddProgressUpdater {
|
||||||
|
|
||||||
@ -304,12 +305,18 @@ public class FileManager implements Closeable {
|
|||||||
if (isDir) {
|
if (isDir) {
|
||||||
//create virtual folder
|
//create virtual folder
|
||||||
final VirtualDirectory childVd = tskCase.addVirtualDirectory(parentVd.getId(), childLocalFile.getName());
|
final VirtualDirectory childVd = tskCase.addVirtualDirectory(parentVd.getId(), childLocalFile.getName());
|
||||||
if (childVd != null && addProgressUpdater != null ) {
|
if (childVd != null && addProgressUpdater != null) {
|
||||||
addProgressUpdater.fileAdded(childVd);
|
addProgressUpdater.fileAdded(childVd);
|
||||||
}
|
}
|
||||||
//add children recursively
|
//add children recursively
|
||||||
for (java.io.File childChild : childLocalFile.listFiles()) {
|
final java.io.File[] childrenFiles = childLocalFile.listFiles();
|
||||||
addLocalDirectoryRecInt(childVd, childChild, addProgressUpdater);
|
if (childrenFiles != null) {
|
||||||
|
for (java.io.File childChild : childrenFiles) {
|
||||||
|
addLocalDirectoryRecInt(childVd, childChild, addProgressUpdater);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//add leaf file, base case
|
||||||
|
this.addLocalFileSingle(childLocalFile.getAbsolutePath(), parentVd);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//add leaf file, base case
|
//add leaf file, base case
|
||||||
@ -428,7 +435,7 @@ public class FileManager implements Closeable {
|
|||||||
* closed
|
* closed
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private synchronized LocalFile addLocalFileSingle(String localAbsPath, AbstractFile parentFile ) throws TskCoreException {
|
private synchronized LocalFile addLocalFileSingle(String localAbsPath, AbstractFile parentFile) throws TskCoreException {
|
||||||
|
|
||||||
if (tskCase == null) {
|
if (tskCase == null) {
|
||||||
throw new TskCoreException("Attempted to use FileManager after it was closed.");
|
throw new TskCoreException("Attempted to use FileManager after it was closed.");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user