Ignore:
Timestamp:
2023-06-13T22:36:12+02:00 (20 months ago)
Author:
taylor.smock
Message:

Fix #23001: ClassCastException in GpxDrawHelper#calculateColors

This occurs when a working GPX file with HDOP information is converted to an OSM
Data Layer and back to a GPX Data Layer. This is fixed by (a) converting casts
for get operations to Number instead of Float/Integer and (b) actually
putting the number in the attribute map instead of a string.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/OsmDataLayerTest.java

    r17763 r18753  
    245245        WayPoint p1 = it.next();
    246246        assertEquals(new LatLon(47.0, 9.0), p1.getCoor());
    247         assertEquals("123", p1.get(GpxConstants.PT_ELE));
     247        assertEquals(123, (double) p1.get(GpxConstants.PT_ELE));
    248248        assertEquals("2018-08-01T10:00:00Z", String.valueOf(p1.get(GpxConstants.PT_TIME)));
    249249        WayPoint p2 = it.next();
    250250        assertEquals(new LatLon(47.1, 9.1), p2.getCoor());
    251         assertEquals("456", p2.get(GpxConstants.PT_ELE));
     251        assertEquals(456, (double) p2.get(GpxConstants.PT_ELE));
    252252        assertEquals("2018-08-01T10:01:00Z", String.valueOf(p2.get(GpxConstants.PT_TIME)));
    253253        WayPoint p3 = it.next();
    254254        assertEquals(new LatLon(47.05, 9.05), p3.getCoor());
    255         assertEquals("789", p3.get(GpxConstants.PT_ELE));
     255        assertEquals(789, (double) p3.get(GpxConstants.PT_ELE));
    256256        assertEquals("2018-08-01T10:02:00Z", String.valueOf(p3.get(GpxConstants.PT_TIME)));
    257257    }
Note: See TracChangeset for help on using the changeset viewer.