From 8a6d62083a5bf74e62ed6ecdfdc97568e01ba3d5 Mon Sep 17 00:00:00 2001 From: Greg DiCristofaro Date: Thu, 14 Jan 2021 09:15:22 -0500 Subject: [PATCH] handle decimals for integer and long value types --- .../autopsy/modules/leappanalyzers/LeappFileProcessor.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/leappanalyzers/LeappFileProcessor.java b/Core/src/org/sleuthkit/autopsy/modules/leappanalyzers/LeappFileProcessor.java index 2aab2f3a6b..df85f35ef3 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/leappanalyzers/LeappFileProcessor.java +++ b/Core/src/org/sleuthkit/autopsy/modules/leappanalyzers/LeappFileProcessor.java @@ -387,13 +387,15 @@ public final class LeappFileProcessor { bbattributes.add(new BlackboardAttribute(attributeType, moduleName, columnValue)); } else if (attrType.matches("INTEGER")) { try { - bbattributes.add(new BlackboardAttribute(attributeType, moduleName, Integer.valueOf(columnValue))); + // parse as double to handle values of format like '21.0' and then convert to int + bbattributes.add(new BlackboardAttribute(attributeType, moduleName, Double.valueOf(columnValue).intValue())); } catch (NumberFormatException ex) { logger.log(Level.WARNING, String.format("Unable to format %s as an integer.", columnValue), ex); } } else if (attrType.matches("LONG")) { try { - bbattributes.add(new BlackboardAttribute(attributeType, moduleName, Long.valueOf(columnValue))); + // parse as double to handle values of format like '21.0' and then convert to long + bbattributes.add(new BlackboardAttribute(attributeType, moduleName, Double.valueOf(columnValue).longValue())); } catch (NumberFormatException ex) { logger.log(Level.WARNING, String.format("Unable to format %s as an long.", columnValue), ex); }