Ignore:
Timestamp:
2023-06-13T22:36:12+02:00 (3 years 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/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r18693 r18753  
    945945        if (value != null) {
    946946            try {
    947                 int i = Integer.parseInt(value);
     947                final int i = Integer.parseInt(value);
    948948                // Sanity checks
    949949                if ((!GpxConstants.PT_SAT.equals(gpxKey) || i >= 0) &&
    950950                        (!GpxConstants.PT_DGPSID.equals(gpxKey) || (0 <= i && i <= 1023))) {
    951                     wpt.put(gpxKey, value);
     951                    wpt.put(gpxKey, i);
    952952                }
    953953            } catch (NumberFormatException e) {
     
    964964        if (value != null) {
    965965            try {
    966                 double d = Double.parseDouble(value);
     966                final double d = Double.parseDouble(value);
    967967                // Sanity checks
    968968                if (!GpxConstants.PT_MAGVAR.equals(gpxKey) || (0.0 <= d && d < 360.0)) {
    969                     wpt.put(gpxKey, value);
     969                    wpt.put(gpxKey, d);
    970970                }
    971971            } catch (NumberFormatException e) {
Note: See TracChangeset for help on using the changeset viewer.