Ignore:
Timestamp:
2014-01-03T19:32:18+01:00 (10 years ago)
Author:
Don-vip
Message:

fix compilation warnings + minor code refactorization

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

Legend:

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

    r6248 r6615  
    77import java.awt.event.ActionEvent;
    88import java.io.File;
    9 import java.net.MalformedURLException;
    109import java.net.URL;
    1110import java.util.ArrayList;
     
    3231import org.openstreetmap.josm.tools.AudioUtil;
    3332import org.openstreetmap.josm.tools.ImageProvider;
     33import org.openstreetmap.josm.tools.Utils;
    3434
    3535/**
     
    125125     */
    126126    private void importAudio(File wavFile, MarkerLayer ml, double firstStartTime, Markers markers) {
    127         URL url = null;
     127        URL url = Utils.fileToURL(wavFile);
    128128        boolean hasTracks = layer.data.tracks != null && !layer.data.tracks.isEmpty();
    129129        boolean hasWaypoints = layer.data.waypoints != null && !layer.data.waypoints.isEmpty();
    130         try {
    131             url = wavFile.toURI().toURL();
    132         } catch (MalformedURLException e) {
    133             Main.error("Unable to convert filename " + wavFile.getAbsolutePath() + " to URL");
    134         }
    135130        Collection<WayPoint> waypoints = new ArrayList<WayPoint>();
    136131        boolean timedMarkersOmitted = false;
    137132        boolean untimedMarkersOmitted = false;
    138         double snapDistance = Main.pref.getDouble("marker.audiofromuntimedwaypoints.distance", 1.0e-3); /*
    139          * about
    140          * 25
    141          * m
    142          */
     133        double snapDistance = Main.pref.getDouble("marker.audiofromuntimedwaypoints.distance", 1.0e-3);
     134        // about 25 m
    143135        WayPoint wayPointFromTimeStamp = null;
    144136
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/Marker.java

    r6380 r6615  
    3939import org.openstreetmap.josm.gui.MapView;
    4040import org.openstreetmap.josm.tools.ImageProvider;
     41import org.openstreetmap.josm.tools.Utils;
    4142import org.openstreetmap.josm.tools.template_engine.ParseError;
    4243import org.openstreetmap.josm.tools.template_engine.TemplateEngineDataProvider;
     
    210211                        // Try a relative file:// url, if the link is not in an URL-compatible form
    211212                        if (relativePath != null) {
    212                             try {
    213                                 url = new File(relativePath.getParentFile(), uri).toURI().toURL();
    214                             } catch (MalformedURLException e1) {
    215                                 Main.warn("Unable to convert uri {0} to URL: {1}", uri, e1.getMessage());
    216                             }
     213                            url = Utils.fileToURL(new File(relativePath.getParentFile(), uri));
    217214                        }
    218215                    }
Note: See TracChangeset for help on using the changeset viewer.