Ignore:
Timestamp:
2009-02-08T11:58:57+01:00 (15 years ago)
Author:
stoecker
Message:

close #2147

File:
1 edited

Legend:

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

    r1169 r1381  
    136136    private final static SimpleDateFormat RMCTIMEFMT =
    137137        new SimpleDateFormat("ddMMyyHHmmss.SSS");
     138    private final static SimpleDateFormat RMCTIMEFMTSTD =
     139        new SimpleDateFormat("ddMMyyHHmmss");
     140
     141    private Date readTime(String p)
     142    {
     143        Date d = RMCTIMEFMT.parse(p, new ParsePosition(0));
     144        if (d == null)
     145            d = RMCTIMEFMTSTD.parse(p, new ParsePosition(0));
     146        if (d == null) throw(null); // malformed
     147        return d;
     148    }
    138149
    139150    // functons for reading the error stats
     
    258269                // time
    259270                accu = e[GPGGA.TIME.position];
    260                 Date d = RMCTIMEFMT.parse(currentDate+accu, new ParsePosition(0));
    261                 if (d == null) throw(null); // malformed
     271                Date d = readTime(currentDate+accu);
    262272
    263273                if((ps.p_Time==null) || (currentwp==null) || !ps.p_Time.equals(accu)) {
     
    376386                String time = e[GPRMC.TIME.position];
    377387
    378                 Date d = RMCTIMEFMT.parse(currentDate+time, new ParsePosition(0));
    379                 if (d == null) throw(null);
     388                Date d = readTime(currentDate+time);
    380389
    381390                if((ps.p_Time==null) || (currentwp==null) || !ps.p_Time.equals(time)) {
     
    426435        } catch(Exception x) {
    427436            // out of bounds and such
    428             //System.out.println("Malformed line: "+s.toString().trim());
     437            // System.out.println("Malformed line: "+s.toString().trim());
    429438            ps.malformed++;
    430439            ps.p_Wp=null;
Note: See TracChangeset for help on using the changeset viewer.