Make FileTypeDetector.lookupFileType() more robust

This commit is contained in:
Richard Cordovano 2015-05-28 11:12:11 -04:00
parent 791a27aeb9
commit ffa0b3ae8a

View File

@ -153,10 +153,13 @@ public class FileTypeDetector {
ArrayList<BlackboardAttribute> attributes = file.getGenInfoAttributes(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_FILE_TYPE_SIG);
for (BlackboardAttribute attribute : attributes) {
/**
* There should be at most one TSK_FILE_TYPE_SIG attribute.
* There should be at most one TSK_FILE_TYPE_SIG attribute...
*/
fileType = attribute.getValueString();
break;
String postedFileType = attribute.getValueString();
if (null != postedFileType && !postedFileType.isEmpty()) {
fileType = postedFileType;
break;
}
}
return fileType;
}