Update ExtractRegistry.java

Check length of Tokens after split, if they are not greater than 2 then skip trying to parse the token.
This commit is contained in:
Mark McKinnon 2021-05-30 10:12:21 -04:00
parent eece6bd2b4
commit ae0d95b089

View File

@ -1434,6 +1434,7 @@ class ExtractRegistry extends Extract {
&& !line.contains(("Recent File List"))) { && !line.contains(("Recent File List"))) {
// Split line on "> " which is the record delimiter between position and file // Split line on "> " which is the record delimiter between position and file
String tokens[] = line.split("> "); String tokens[] = line.split("> ");
if (tokens.length > 1) {
String fileName = tokens[1]; String fileName = tokens[1];
Collection<BlackboardAttribute> attributes = new ArrayList<>(); Collection<BlackboardAttribute> attributes = new ArrayList<>();
attributes.add(new BlackboardAttribute(TSK_PATH, getName(), fileName)); attributes.add(new BlackboardAttribute(TSK_PATH, getName(), fileName));
@ -1450,6 +1451,7 @@ class ExtractRegistry extends Extract {
} catch(TskCoreException ex) { } catch(TskCoreException ex) {
logger.log(Level.SEVERE, String.format("Failed to create TSK_RECENT_OBJECT artifact for file %d", regFile.getId()), ex); logger.log(Level.SEVERE, String.format("Failed to create TSK_RECENT_OBJECT artifact for file %d", regFile.getId()), ex);
} }
}
line = reader.readLine(); line = reader.readLine();
} }
line = line.trim(); line = line.trim();