Merge pull request #4808 from wschaeferB/5046-RecentActivityNPE

5046 recent activity npe
This commit is contained in:
Richard Cordovano 2019-05-29 09:17:22 -04:00 committed by GitHub
commit b16b27f23b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -410,6 +410,8 @@ class ExtractRegistry extends Extract {
if (timenodes.getLength() > 0) {
Element timenode = (Element) timenodes.item(0);
String etime = timenode.getTextContent();
//sometimes etime will be an empty string and therefore can not be parsed into a date
if (etime != null && !etime.isEmpty()) {
try {
mtime = new SimpleDateFormat("EEE MMM d HH:mm:ss yyyy").parse(etime).getTime();
String Tempdate = mtime.toString();
@ -418,6 +420,7 @@ class ExtractRegistry extends Extract {
logger.log(Level.WARNING, "Failed to parse epoch time when parsing the registry.", ex); //NON-NLS
}
}
}
NodeList artroots = tempnode.getElementsByTagName("artifacts"); //NON-NLS
if (artroots.getLength() == 0) {
@ -444,8 +447,14 @@ class ExtractRegistry extends Extract {
if (artchild.hasAttributes()) {
Element artnode = (Element) artchild;
String value = artnode.getTextContent().trim();
String value = artnode.getTextContent();
if (value != null) {
value = value.trim();
}
String name = artnode.getAttribute("name"); //NON-NLS
if (name == null) {
continue;
}
switch (name) {
case "ProductName": // NON-NLS
version = value;
@ -467,14 +476,15 @@ class ExtractRegistry extends Extract {
regOrg = value;
break;
case "InstallDate": //NON-NLS
if (value != null && !value.isEmpty()) {
try {
Long epochtime = new SimpleDateFormat("EEE MMM d HH:mm:ss yyyy").parse(value).getTime();
installtime = epochtime;
installtime = new SimpleDateFormat("EEE MMM d HH:mm:ss yyyy").parse(value).getTime();
String Tempdate = installtime.toString();
installtime = Long.valueOf(Tempdate) / MS_IN_SEC;
} catch (ParseException e) {
logger.log(Level.SEVERE, "RegRipper::Conversion on DateTime -> ", e); //NON-NLS
}
}
break;
default:
break;
@ -651,9 +661,11 @@ class ExtractRegistry extends Extract {
case "uninstall": //NON-NLS
Long itemMtime = null;
try {
Long epochtime = new SimpleDateFormat("EEE MMM d HH:mm:ss yyyy").parse(artnode.getAttribute("mtime")).getTime(); //NON-NLS
itemMtime = epochtime;
String mTimeAttr = artnode.getAttribute("mtime");
if (mTimeAttr != null && !mTimeAttr.isEmpty()) {
itemMtime = new SimpleDateFormat("EEE MMM d HH:mm:ss yyyy").parse(mTimeAttr).getTime(); //NON-NLS
itemMtime /= MS_IN_SEC;
}
} catch (ParseException e) {
logger.log(Level.WARNING, "Failed to parse epoch time for installed program artifact."); //NON-NLS
}