mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
parser flexibility
This commit is contained in:
parent
dcba8e9e19
commit
83c30d5640
@ -221,6 +221,13 @@ public final class LeappFileProcessor {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a key trimmed and case-insensitive that can be used for a
|
||||||
|
* case-insensitive lookup in a map.
|
||||||
|
*
|
||||||
|
* @param origKey The original key.
|
||||||
|
* @return The normalized key.
|
||||||
|
*/
|
||||||
private static String normalizeKey(String origKey) {
|
private static String normalizeKey(String origKey) {
|
||||||
return StringUtils.defaultString(origKey).trim().toLowerCase();
|
return StringUtils.defaultString(origKey).trim().toLowerCase();
|
||||||
}
|
}
|
||||||
@ -909,12 +916,13 @@ public final class LeappFileProcessor {
|
|||||||
if (MapUtils.isEmpty(columnIndexes) || CollectionUtils.isEmpty(lineValues)
|
if (MapUtils.isEmpty(columnIndexes) || CollectionUtils.isEmpty(lineValues)
|
||||||
|| (lineValues.size() == 1 && StringUtils.isEmpty(lineValues.get(0)))) {
|
|| (lineValues.size() == 1 && StringUtils.isEmpty(lineValues.get(0)))) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
} else if (lineValues.size() != columnIndexes.size()) {
|
}
|
||||||
logger.log(Level.WARNING, String.format(
|
// else if (lineValues.size() < columnIndexes.size()) {
|
||||||
"Row at line number %d in file %s has %d columns when %d were expected based on the header row.",
|
// logger.log(Level.WARNING, String.format(
|
||||||
lineNum, fileName, lineValues.size(), columnIndexes.size()));
|
// "Row at line number %d in file %s has %d columns when %d were expected based on the header row.",
|
||||||
return Collections.emptyList();
|
// lineNum, fileName, lineValues.size(), columnIndexes.size()));
|
||||||
}
|
// return Collections.emptyList();
|
||||||
|
// }
|
||||||
|
|
||||||
List<BlackboardAttribute> attrsToRet = new ArrayList<>();
|
List<BlackboardAttribute> attrsToRet = new ArrayList<>();
|
||||||
for (TsvColumn colAttr : attrList) {
|
for (TsvColumn colAttr : attrList) {
|
||||||
@ -938,11 +946,12 @@ public final class LeappFileProcessor {
|
|||||||
String formattedValue = formatValueBasedOnAttrType(colAttr, value);
|
String formattedValue = formatValueBasedOnAttrType(colAttr, value);
|
||||||
|
|
||||||
BlackboardAttribute attr = getAttribute(colAttr.getAttributeType(), formattedValue, fileName);
|
BlackboardAttribute attr = getAttribute(colAttr.getAttributeType(), formattedValue, fileName);
|
||||||
if (attr == null) {
|
if (attr != null) {
|
||||||
|
attrsToRet.add(attr);
|
||||||
|
} else if (colAttr.isRequired()) {
|
||||||
logger.log(Level.WARNING, String.format("Blackboard attribute could not be parsed column %s at line %d in file %s. Omitting row.", colAttr.getColumnName(), lineNum, fileName));
|
logger.log(Level.WARNING, String.format("Blackboard attribute could not be parsed column %s at line %d in file %s. Omitting row.", colAttr.getColumnName(), lineNum, fileName));
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
attrsToRet.add(attr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tsvFileArtifactComments.containsKey(normalizeKey(fileName))) {
|
if (tsvFileArtifactComments.containsKey(normalizeKey(fileName))) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user