Changeset 11484 in josm for trunk


Ignore:
Timestamp:
2017-01-19T23:34:17+01:00 (8 years ago)
Author:
Don-vip
Message:

fix #14209 - prefer TAG_DATETIME_ORIGINAL (patch by holgermappt, regression from r9499) + add non-regression unit test

Location:
trunk
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/ExifReader.java

    r11288 r11484  
    5656                    if (tag.getTagType() == ExifIFD0Directory.TAG_DATETIME /* 0x0132 */ ||
    5757                        tag.getTagType() == ExifSubIFDDirectory.TAG_DATETIME_DIGITIZED /* 0x9004 */) {
    58                         if (dateStr != null) {
     58                        if (dateStr == null) {
    5959                            // prefer TAG_DATETIME_ORIGINAL
    6060                            dateStr = tag.getDescription();
  • trunk/test/unit/org/openstreetmap/josm/tools/ExifReaderTest.java

    r11035 r11484  
    119119        assertEquals("2015-11-08T15:33:27.500", dateStr);
    120120    }
     121
     122    /**
     123     * Non-regression test for ticket <a href="https://josm.openstreetmap.de/ticket/14209">#14209</a>
     124     * @throws IOException if an error occurs during reading
     125     */
     126    @Test
     127    public void testTicket14209() throws IOException {
     128        File file = new File(TestUtils.getRegressionDataFile(14209, "0MbEfj1S--.1.jpg"));
     129        String dateStr = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").format(ExifReader.readTime(file));
     130        assertEquals("2017-01-16T18:27:00.000", dateStr);
     131    }
    121132}
Note: See TracChangeset for help on using the changeset viewer.