RA: fix chrome null ptr exception when extracting bookmarks

This commit is contained in:
adam-m 2012-12-20 11:14:12 -05:00
parent 6b25b4c34b
commit 6ee69fc881

View File

@ -188,9 +188,33 @@ public class Chrome extends Extract implements IngestModuleImage {
for (JsonElement result : jBookmarkArray) {
try {
JsonObject address = result.getAsJsonObject();
String url = address.get("url").getAsString();
String name = address.get("name").getAsString();
Long date = address.get("date_added").getAsLong();
if (address == null) {
continue;
}
JsonElement urlEl = address.get("url");
String url = null;
if (urlEl != null) {
url = urlEl.getAsString();
}
else {
url = "";
}
String name = null;
JsonElement nameEl = address.get("name");
if (nameEl != null) {
name = nameEl.getAsString();
}
else {
name = "";
}
Long date = null;
JsonElement dateEl = address.get("date_added");
if (dateEl != null) {
date = dateEl.getAsLong();
}
else {
date = Long.valueOf(0);
}
String domain = Util.extractDomain(url);
BlackboardArtifact bbart = bookmarkFiles.get(j).newArtifact(ARTIFACT_TYPE.TSK_WEB_BOOKMARK);
Collection<BlackboardAttribute> bbattributes = new ArrayList<BlackboardAttribute>();