Changeset 14159 in josm for trunk/src/org


Ignore:
Timestamp:
2018-08-16T20:07:05+02:00 (6 years ago)
Author:
Don-vip
Message:

fix #16633 - add robustness against invalid time entries in GPX files

Location:
trunk/src/org/openstreetmap/josm
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/gpx/WayPoint.java

    r14068 r14159  
    33
    44import java.awt.Color;
     5import java.time.DateTimeException;
    56import java.util.ArrayList;
    67import java.util.Date;
     
    166167                time = date.getTime() / 1000.;
    167168                return date;
    168             } catch (UncheckedParseException e) {
     169            } catch (UncheckedParseException | DateTimeException e) {
    169170                Logging.warn(e);
    170171                time = 0;
  • trunk/src/org/openstreetmap/josm/io/OsmServerUserInfoReader.java

    r12510 r14159  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
     6import java.time.DateTimeException;
    67import java.util.LinkedList;
    78import java.util.List;
     
    1617import org.openstreetmap.josm.data.osm.UserInfo;
    1718import org.openstreetmap.josm.gui.progress.ProgressMonitor;
     19import org.openstreetmap.josm.tools.UncheckedParseException;
    1820import org.openstreetmap.josm.tools.XmlParsingException;
    1921import org.openstreetmap.josm.tools.date.DateUtils;
     
    129131
    130132            return userInfo;
    131         } catch (XPathException e) {
     133        } catch (XPathException | UncheckedParseException | DateTimeException e) {
    132134            throw new XmlParsingException(e);
    133135        }
  • trunk/src/org/openstreetmap/josm/tools/ExifReader.java

    r12985 r14159  
    55import java.io.File;
    66import java.io.IOException;
     7import java.time.DateTimeException;
    78import java.util.Date;
    89import java.util.concurrent.TimeUnit;
     
    117118                return date;
    118119            }
    119         } catch (UncheckedParseException e) {
     120        } catch (UncheckedParseException | DateTimeException e) {
    120121            Logging.error(e);
    121122        }
  • trunk/src/org/openstreetmap/josm/tools/date/DateUtils.java

    r14079 r14159  
    55import java.text.ParsePosition;
    66import java.text.SimpleDateFormat;
     7import java.time.DateTimeException;
    78import java.time.Instant;
    89import java.time.ZoneId;
     
    6869     * @return The date
    6970     * @throws UncheckedParseException if the date does not match any of the supported date formats
     71     * @throws DateTimeException if the value of any field is out of range, or if the day-of-month is invalid for the month-year
    7072     */
    7173    public static synchronized Date fromString(String str) {
     
    7880     * @return The date in milliseconds since epoch
    7981     * @throws UncheckedParseException if the date does not match any of the supported date formats
     82     * @throws DateTimeException if the value of any field is out of range, or if the day-of-month is invalid for the month-year
    8083     */
    8184    public static synchronized long tsFromString(String str) {
Note: See TracChangeset for help on using the changeset viewer.