Skip to content

Commit 703cb9f

Browse files
author
William Schaefer
committed
3522 fix location of real path conversion to before any file access
1 parent ef74c1f commit 703cb9f

File tree

1 file changed

+26
-20
lines changed

1 file changed

+26
-20
lines changed

Core/src/org/sleuthkit/autopsy/casemodule/CaseBrowser.java

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -209,28 +209,34 @@ private List<CaseMetadata> getCases() throws CoordinationService.CoordinationSer
209209
List<String> nodeList = CoordinationService.getInstance().getNodeList(CoordinationService.CategoryNode.CASES);
210210

211211
for (String node : nodeList) {
212-
Path casePath = Paths.get(node);
213-
File caseFolder = casePath.toFile();
214-
if (caseFolder.exists()) {
215-
/*
216-
* Search for '*.aut' files.
217-
*/
218-
File[] fileArray = caseFolder.listFiles();
219-
if (fileArray == null) {
220-
continue;
221-
}
222-
String autFilePath = null;
223-
for (File file : fileArray) {
224-
String name = file.getName().toLowerCase();
225-
if (autFilePath == null && name.endsWith(".aut")) {
226-
try {
227-
caseList.add(new CaseMetadata(Paths.get(file.getAbsolutePath()).toRealPath(LinkOption.NOFOLLOW_LINKS)));
228-
} catch (CaseMetadata.CaseMetadataException | IOException ex) {
229-
LOGGER.log(Level.SEVERE, String.format("Error reading case metadata file '%s'.", autFilePath), ex);
230-
}
231-
break;
212+
Path casePath;
213+
try {
214+
casePath = Paths.get(node).toRealPath(LinkOption.NOFOLLOW_LINKS);
215+
216+
File caseFolder = casePath.toFile();
217+
if (caseFolder.exists()) {
218+
/*
219+
* Search for '*.aut' files.
220+
*/
221+
File[] fileArray = caseFolder.listFiles();
222+
if (fileArray == null) {
223+
continue;
224+
}
225+
String autFilePath = null;
226+
for (File file : fileArray) {
227+
String name = file.getName().toLowerCase();
228+
if (autFilePath == null && name.endsWith(".aut")) {
229+
try {
230+
caseList.add(new CaseMetadata(Paths.get(file.getAbsolutePath())));
231+
} catch (CaseMetadata.CaseMetadataException ex) {
232+
LOGGER.log(Level.SEVERE, String.format("Error reading case metadata file '%s'.", autFilePath), ex);
233+
}
234+
break;
235+
}
232236
}
233237
}
238+
} catch (IOException ignore) {
239+
//if a path could not be resolved to a real path do add it to the caseList
234240
}
235241
}
236242
return caseList;

0 commit comments

Comments
 (0)