Changeset 7049 in josm


Ignore:
Timestamp:
2014-05-02T02:54:23+02:00 (10 years ago)
Author:
Don-vip
Message:

sonar - Don't call static DateFormat

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

Legend:

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

    r7029 r7049  
    257257    }
    258258
    259     private static final DateFormat timeFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
    260     static {
    261          TimeZone tz = TimeZone.getTimeZone("UTC");
    262          timeFormatter.setTimeZone(tz);
    263     }
    264 
    265259    public static final String MARKER_OFFSET = "waypointOffset";
    266260    public static final String MARKER_FORMATTED_OFFSET = "formattedWaypointOffset";
     
    270264    public static final String LABEL_PATTERN_DESC = "{desc}";
    271265
     266    private final DateFormat timeFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
    272267    private final TemplateEngineDataProvider dataProvider;
    273268    private final String text;
     
    288283
    289284    public Marker(LatLon ll, TemplateEngineDataProvider dataProvider, String iconName, MarkerLayer parentLayer, double time, double offset) {
     285        this(ll, dataProvider, null, iconName, parentLayer, time, offset);
     286    }
     287
     288    public Marker(LatLon ll, String text, String iconName, MarkerLayer parentLayer, double time, double offset) {
     289        this(ll, null, text, iconName, parentLayer, time, offset);
     290    }
     291
     292    private Marker(LatLon ll, TemplateEngineDataProvider dataProvider, String text, String iconName, MarkerLayer parentLayer, double time, double offset) {
     293        timeFormatter.setTimeZone(TimeZone.getTimeZone("UTC"));
    290294        setCoor(ll);
    291295
     
    296300
    297301        this.dataProvider = dataProvider;
    298         this.text = null;
    299     }
    300 
    301     public Marker(LatLon ll, String text, String iconName, MarkerLayer parentLayer, double time, double offset) {
    302         setCoor(ll);
    303 
    304         this.offset = offset;
    305         this.time = time;
    306         this.symbol = iconName != null ? ImageProvider.getIfAvailable("markers",iconName) : null;
    307         this.parentLayer = parentLayer;
    308 
    309         this.dataProvider = null;
    310302        this.text = text;
    311303    }
  • trunk/src/org/openstreetmap/josm/io/NmeaReader.java

    r7037 r7049  
    2121
    2222/**
    23  * Read a nmea file. Based on information from
    24  * http://www.kowoma.de/gps/zusatzerklaerungen/NMEA.htm
     23 * Reads a NMEA file. Based on information from
     24 * <a href="http://www.kowoma.de/gps/zusatzerklaerungen/NMEA.htm">http://www.kowoma.de</a>
    2525 *
    2626 * @author cbrill
     
    132132    public GpxData data;
    133133
    134     //  private static final SimpleDateFormat GGATIMEFMT =
    135     //      new SimpleDateFormat("HHmmss.SSS");
    136     private static final SimpleDateFormat RMCTIMEFMT =
    137         new SimpleDateFormat("ddMMyyHHmmss.SSS");
    138     private static final SimpleDateFormat RMCTIMEFMTSTD =
    139         new SimpleDateFormat("ddMMyyHHmmss");
     134    private final SimpleDateFormat rmcTimeFmt = new SimpleDateFormat("ddMMyyHHmmss.SSS");
     135    private final SimpleDateFormat rmcTimeFmtStd = new SimpleDateFormat("ddMMyyHHmmss");
    140136
    141137    private Date readTime(String p) {
    142         Date d = RMCTIMEFMT.parse(p, new ParsePosition(0));
     138        Date d = rmcTimeFmt.parse(p, new ParsePosition(0));
    143139        if (d == null) {
    144             d = RMCTIMEFMTSTD.parse(p, new ParsePosition(0));
     140            d = rmcTimeFmtStd.parse(p, new ParsePosition(0));
    145141        }
    146142        if (d == null)
Note: See TracChangeset for help on using the changeset viewer.