Index: trunk/src/org/openstreetmap/josm/gui/MainApplet.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/MainApplet.java	(revision 6613)
+++ trunk/src/org/openstreetmap/josm/gui/MainApplet.java	(revision 6615)
@@ -32,4 +32,5 @@
 import org.openstreetmap.josm.tools.I18n;
 import org.openstreetmap.josm.tools.Shortcut;
+import org.openstreetmap.josm.tools.Utils;
 
 public class MainApplet extends JApplet {
@@ -180,10 +181,5 @@
             @Override
             public URL getCodeBase() {
-                try {
-                    return new File(".").toURI().toURL();
-                } catch (Exception e) {
-                    e.printStackTrace();
-                    return null;
-                }
+                return Utils.fileToURL(new File("."));
             }
 
Index: trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java	(revision 6613)
+++ trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java	(revision 6615)
@@ -7,5 +7,4 @@
 import java.awt.event.ActionEvent;
 import java.io.File;
-import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.ArrayList;
@@ -32,4 +31,5 @@
 import org.openstreetmap.josm.tools.AudioUtil;
 import org.openstreetmap.josm.tools.ImageProvider;
+import org.openstreetmap.josm.tools.Utils;
 
 /**
@@ -125,20 +125,12 @@
      */
     private void importAudio(File wavFile, MarkerLayer ml, double firstStartTime, Markers markers) {
-        URL url = null;
+        URL url = Utils.fileToURL(wavFile);
         boolean hasTracks = layer.data.tracks != null && !layer.data.tracks.isEmpty();
         boolean hasWaypoints = layer.data.waypoints != null && !layer.data.waypoints.isEmpty();
-        try {
-            url = wavFile.toURI().toURL();
-        } catch (MalformedURLException e) {
-            Main.error("Unable to convert filename " + wavFile.getAbsolutePath() + " to URL");
-        }
         Collection<WayPoint> waypoints = new ArrayList<WayPoint>();
         boolean timedMarkersOmitted = false;
         boolean untimedMarkersOmitted = false;
-        double snapDistance = Main.pref.getDouble("marker.audiofromuntimedwaypoints.distance", 1.0e-3); /*
-         * about
-         * 25
-         * m
-         */
+        double snapDistance = Main.pref.getDouble("marker.audiofromuntimedwaypoints.distance", 1.0e-3); 
+        // about 25 m
         WayPoint wayPointFromTimeStamp = null;
 
Index: trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/Marker.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/Marker.java	(revision 6613)
+++ trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/Marker.java	(revision 6615)
@@ -39,4 +39,5 @@
 import org.openstreetmap.josm.gui.MapView;
 import org.openstreetmap.josm.tools.ImageProvider;
+import org.openstreetmap.josm.tools.Utils;
 import org.openstreetmap.josm.tools.template_engine.ParseError;
 import org.openstreetmap.josm.tools.template_engine.TemplateEngineDataProvider;
@@ -210,9 +211,5 @@
                         // Try a relative file:// url, if the link is not in an URL-compatible form
                         if (relativePath != null) {
-                            try {
-                                url = new File(relativePath.getParentFile(), uri).toURI().toURL();
-                            } catch (MalformedURLException e1) {
-                                Main.warn("Unable to convert uri {0} to URL: {1}", uri, e1.getMessage());
-                            }
+                            url = Utils.fileToURL(new File(relativePath.getParentFile(), uri));
                         }
                     }
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java	(revision 6613)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java	(revision 6615)
@@ -471,9 +471,12 @@
             final String text = args[0];
             System.arraycopy(args, 1, args, 0, args.length - 1);
-            return org.openstreetmap.josm.tools.I18n.tr(text, args);
+            return org.openstreetmap.josm.tools.I18n.tr(text, (Object[])args);
         }
 
         /**
          * Returns the substring of {@code s} starting at index {@code begin} (inclusive, 0-indexed).
+         * @param s The base string
+         * @param begin The start index
+         * @return the substring
          * @see String#substring(int)
          */
@@ -485,4 +488,8 @@
          * Returns the substring of {@code s} starting at index {@code begin} (inclusive)
          * and ending at index {@code end}, (exclusive, 0-indexed).
+         * @param s The base string
+         * @param begin The start index
+         * @param end The end index
+         * @return the substring
          * @see String#substring(int, int)
          */
Index: trunk/src/org/openstreetmap/josm/plugins/Plugin.java
===================================================================
--- trunk/src/org/openstreetmap/josm/plugins/Plugin.java	(revision 6613)
+++ trunk/src/org/openstreetmap/josm/plugins/Plugin.java	(revision 6615)
@@ -144,5 +144,5 @@
         File pluginDir = Main.pref.getPluginsDirectory();
         File pluginJar = new File(pluginDir, info.name + ".jar");
-        final URL pluginJarUrl = PluginInformation.fileToURL(pluginJar);
+        final URL pluginJarUrl = Utils.fileToURL(pluginJar);
         return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
               public ClassLoader run() {
Index: trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java	(revision 6613)
+++ trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java	(revision 6615)
@@ -527,5 +527,5 @@
             File pluginJar = new File(pluginDir, info.name + ".jar");
             I18n.addTexts(pluginJar);
-            URL pluginJarUrl = PluginInformation.fileToURL(pluginJar);
+            URL pluginJarUrl = Utils.fileToURL(pluginJar);
             allPluginLibraries.add(pluginJarUrl);
         }
Index: trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java
===================================================================
--- trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java	(revision 6613)
+++ trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java	(revision 6615)
@@ -99,5 +99,5 @@
                 throw new PluginException(name, tr("The plugin file ''{0}'' does not include a Manifest.", file.toString()));
             scanManifest(manifest, false);
-            libraries.add(0, fileToURL(file));
+            libraries.add(0, Utils.fileToURL(file));
         } catch (IOException e) {
             throw new PluginException(name, e);
@@ -206,6 +206,5 @@
             }
         } else {
-            //noinspection NullArgumentToVariableArgMethod
-            s = MessageFormat.format(s, null);
+            s = MessageFormat.format(s, (Object[]) null);
         }
         description = s;
@@ -263,5 +262,5 @@
                 }
 
-                libraries.add(fileToURL(entryFile));
+                libraries.add(Utils.fileToURL(entryFile));
             }
         }
@@ -333,11 +332,5 @@
     }
 
-    public static URL fileToURL(File f) {
-        try {
-            return f.toURI().toURL();
-        } catch (MalformedURLException ex) {
-            return null;
-        }
-    }
+
 
     /**
@@ -395,4 +388,8 @@
     }
 
+    /**
+     * Returns all possible plugin locations.
+     * @return all possible plugin locations.
+     */
     public static Collection<String> getPluginLocations() {
         Collection<String> locations = Main.pref.getAllPossiblePreferenceDirs();
@@ -462,5 +459,6 @@
 
     /**
-     * Replies the name of the plugin
+     * Replies the name of the plugin.
+     * @return The plugin name
      */
     public String getName() {
Index: trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/ImageProvider.java	(revision 6613)
+++ trunk/src/org/openstreetmap/josm/tools/ImageProvider.java	(revision 6615)
@@ -517,5 +517,5 @@
             switch (type) {
             case SVG:
-                URI uri = getSvgUniverse().loadSVG(is, is.getFile().toURI().toURL().toString());
+                URI uri = getSvgUniverse().loadSVG(is, Utils.fileToURL(is.getFile()).toString());
                 SVGDiagram svg = getSvgUniverse().getDiagram(uri);
                 return svg == null ? null : new ImageResource(svg);
@@ -523,5 +523,5 @@
                 BufferedImage img = null;
                 try {
-                    img = ImageIO.read(is.getFile().toURI().toURL());
+                    img = ImageIO.read(Utils.fileToURL(is.getFile()));
                 } catch (IOException e) {
                     Main.warn("IOException while reading HTTP image: "+e.getMessage());
@@ -654,11 +654,7 @@
             }
         } else {
-            try {
-                File f = new File(path, name);
-                if ((path != null || f.isAbsolute()) && f.exists())
-                    return f.toURI().toURL();
-            } catch (MalformedURLException e) {
-                Main.warn(e);
-            }
+            File f = new File(path, name);
+            if ((path != null || f.isAbsolute()) && f.exists())
+                return Utils.fileToURL(f);
         }
         return null;
Index: trunk/src/org/openstreetmap/josm/tools/Utils.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 6613)
+++ trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 6615)
@@ -24,4 +24,5 @@
 import java.io.OutputStream;
 import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLConnection;
@@ -373,4 +374,21 @@
         }
     }
+    
+    /**
+     * Converts the given file to its URL.
+     * @param f The file to get URL from
+     * @return The URL of the given file, or {@code null} if not possible.
+     * @since 6615
+     */
+    public static URL fileToURL(File f) {
+        if (f != null) {
+            try {
+                return f.toURI().toURL();
+            } catch (MalformedURLException ex) {
+                Main.error("Unable to convert filename " + f.getAbsolutePath() + " to URL");
+            }
+        }
+        return null;
+    }
 
     private final static double EPSILON = 1e-11;
