Changeset 14430 in josm


Ignore:
Timestamp:
2018-11-18T18:27:42+01:00 (5 years ago)
Author:
Don-vip
Message:

fix #17003 - catch UncheckedParseException when converting OSM data to GPX

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r14388 r14430  
    116116import org.openstreetmap.josm.tools.ImageProvider.ImageSizes;
    117117import org.openstreetmap.josm.tools.Logging;
     118import org.openstreetmap.josm.tools.UncheckedParseException;
    118119import org.openstreetmap.josm.tools.date.DateUtils;
    119120
     
    796797        addDoubleIfPresent(wpt, n, GpxConstants.PT_ELE);
    797798
    798         if (time > 0) {
    799             wpt.put(GpxConstants.PT_TIME, DateUtils.fromTimestamp(time));
    800             wpt.setTime(time);
    801         } else if (n.hasKey(GpxConstants.PT_TIME)) {
    802             wpt.put(GpxConstants.PT_TIME, DateUtils.fromString(n.get(GpxConstants.PT_TIME)));
    803             wpt.setTime();
    804         } else if (!n.isTimestampEmpty()) {
    805             wpt.put(GpxConstants.PT_TIME, DateUtils.fromTimestamp(n.getRawTimestamp()));
    806             wpt.setTime();
     799        try {
     800            if (time > 0) {
     801                wpt.put(GpxConstants.PT_TIME, DateUtils.fromTimestamp(time));
     802                wpt.setTime(time);
     803            } else if (n.hasKey(GpxConstants.PT_TIME)) {
     804                wpt.put(GpxConstants.PT_TIME, DateUtils.fromString(n.get(GpxConstants.PT_TIME)));
     805                wpt.setTime();
     806            } else if (!n.isTimestampEmpty()) {
     807                wpt.put(GpxConstants.PT_TIME, DateUtils.fromTimestamp(n.getRawTimestamp()));
     808                wpt.setTime();
     809            }
     810        } catch (UncheckedParseException e) {
     811            Logging.error(e);
    807812        }
    808813
Note: See TracChangeset for help on using the changeset viewer.