Changeset 4772 in josm
- Timestamp:
- 2012-01-08T17:14:32+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/ExifReader.java
r4241 r4772 22 22 23 23 @SuppressWarnings("unchecked") public static Date readTime(File filename) throws ParseException { 24 Date date = null;25 24 try { 26 25 Metadata metadata = JpegMetadataReader.readMetadata(filename); 26 String dateStr = null; 27 OUTER: 27 28 for (Iterator<Directory> dirIt = metadata.getDirectoryIterator(); dirIt.hasNext();) { 28 29 for (Iterator<Tag> tagIt = dirIt.next().getTagIterator(); tagIt.hasNext();) { 29 30 Tag tag = tagIt.next(); 30 if (tag.getTagType() == 0x9003) 31 return DateParser.parse(tag.getDescription()); 32 if (tag.getTagType() == 0x132 || tag.getTagType() == 0x9004) 33 date = DateParser.parse(tag.getDescription()); 31 if (tag.getTagType() == ExifDirectory.TAG_DATETIME_ORIGINAL /* 0x9003 */) { 32 dateStr = tag.getDescription(); 33 break OUTER; // prefer this tag 34 } 35 if (tag.getTagType() == ExifDirectory.TAG_DATETIME /* 0x0132 */ || 36 tag.getTagType() == ExifDirectory.TAG_DATETIME_DIGITIZED /* 0x9004 */) { 37 dateStr = tag.getDescription(); 38 } 34 39 } 35 40 } 41 dateStr = dateStr.replace('/', ':'); // workaround for HTC Sensation bug, see #7228 42 return DateParser.parse(dateStr); 36 43 } catch (ParseException e) { 37 44 throw e; … … 39 46 e.printStackTrace(); 40 47 } 41 return date;48 return null; 42 49 } 43 50
Note:
See TracChangeset
for help on using the changeset viewer.