Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.3
-
verified on Mac OSX and Ubuntu 12.04
Description
Notice that in the second if block, there is no check for null on the retrived datetime. I have hit this with a file which apparently has null for this value. Seems like the fix is trivial
public void handleDateTags(Directory directory, Metadata metadata)
throws MetadataException {
// Date/Time Original overrides value from ExifDirectory.TAG_DATETIME
Date original = null;
if (directory.containsTag(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL)) {
original = directory.getDate(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL);
// Unless we have GPS time we don't know the time zone so date must be set
// as ISO 8601 datetime without timezone suffix (no Z or +/-)
if (original != null)
}
if (directory.containsTag(ExifIFD0Directory.TAG_DATETIME)) {
Date datetime = directory.getDate(ExifIFD0Directory.TAG_DATETIME);
String datetimeNoTimeZone = DATE_UNSPECIFIED_TZ.format(datetime);
metadata.set(TikaCoreProperties.MODIFIED, datetimeNoTimeZone);
// If Date/Time Original does not exist this might be creation date
if (metadata.get(TikaCoreProperties.CREATED) == null)
}
}