Changeset 12617 in josm


Ignore:
Timestamp:
2017-08-20T19:39:19+02:00 (23 months ago)
Author:
bastiK
Message:

see #15168 - catch exceptions caused by malformatted data; dump limited number of errors to the command line

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/nmea/NmeaReader.java

    r12435 r12617  
    2323import org.openstreetmap.josm.data.gpx.WayPoint;
    2424import org.openstreetmap.josm.io.IllegalDataException;
    25 import org.openstreetmap.josm.tools.JosmRuntimeException;
    2625import org.openstreetmap.josm.tools.date.DateUtils;
    2726
     
    135134    private final SimpleDateFormat rmcTimeFmtStd = new SimpleDateFormat("ddMMyyHHmmss", Locale.ENGLISH);
    136135
    137     private Date readTime(String p) {
     136    private Date readTime(String p) throws IllegalDataException {
    138137        Date d = Optional.ofNullable(rmcTimeFmt.parse(p, new ParsePosition(0)))
    139138                .orElseGet(() -> rmcTimeFmtStd.parse(p, new ParsePosition(0)));
    140139        if (d == null)
    141             throw new JosmRuntimeException("Date is malformed");
     140            throw new IllegalDataException("Date is malformed: '" + p + "'");
    142141        return d;
    143142    }
     
    480479
    481480        } catch (IllegalArgumentException | IndexOutOfBoundsException | IllegalDataException ex) {
    482             // out of bounds and such
    483             Main.debug(ex);
     481            if (ps.malformed < 5) {
     482                Main.warn(ex);
     483            } else {
     484                Main.debug(ex);
     485            }
    484486            ps.malformed++;
    485487            ps.pWp = null;
Note: See TracChangeset for help on using the changeset viewer.