Index: /trunk/src/org/json/JSONArray.java
===================================================================
--- /trunk/src/org/json/JSONArray.java	(revision 6614)
+++ /trunk/src/org/json/JSONArray.java	(revision 6615)
@@ -83,5 +83,5 @@
      * The arrayList where the JSONArray's properties are kept.
      */
-    private final ArrayList myArrayList;
+    private final ArrayList<Object> myArrayList;
 
     /**
@@ -89,5 +89,5 @@
      */
     public JSONArray() {
-        this.myArrayList = new ArrayList();
+        this.myArrayList = new ArrayList<Object>();
     }
 
@@ -151,8 +151,8 @@
      *            A Collection.
      */
-    public JSONArray(Collection collection) {
-        this.myArrayList = new ArrayList();
+    public JSONArray(Collection<?> collection) {
+        this.myArrayList = new ArrayList<Object>();
         if (collection != null) {
-            Iterator iter = collection.iterator();
+            Iterator<?> iter = collection.iterator();
             while (iter.hasNext()) {
                 this.myArrayList.add(JSONObject.wrap(iter.next()));
@@ -594,5 +594,5 @@
      * @return this.
      */
-    public JSONArray put(Collection value) {
+    public JSONArray put(Collection<?> value) {
         this.put(new JSONArray(value));
         return this;
@@ -647,5 +647,5 @@
      * @return this.
      */
-    public JSONArray put(Map value) {
+    public JSONArray put(Map<?, ?> value) {
         this.put(new JSONObject(value));
         return this;
@@ -696,5 +696,5 @@
      *             If the index is negative or if the value is not finite.
      */
-    public JSONArray put(int index, Collection value) throws JSONException {
+    public JSONArray put(int index, Collection<?> value) throws JSONException {
         this.put(index, new JSONArray(value));
         return this;
@@ -768,5 +768,5 @@
      *             number.
      */
-    public JSONArray put(int index, Map value) throws JSONException {
+    public JSONArray put(int index, Map<?, ?> value) throws JSONException {
         this.put(index, new JSONObject(value));
         return this;
Index: /trunk/src/org/json/JSONObject.java
===================================================================
--- /trunk/src/org/json/JSONObject.java	(revision 6614)
+++ /trunk/src/org/json/JSONObject.java	(revision 6615)
@@ -37,4 +37,5 @@
 import java.util.Locale;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.ResourceBundle;
 import java.util.Set;
@@ -136,5 +137,5 @@
      * The map where the JSONObject's properties are kept.
      */
-    private final Map map;
+    private final Map<String, Object> map;
 
     /**
@@ -150,5 +151,5 @@
      */
     public JSONObject() {
-        this.map = new HashMap();
+        this.map = new HashMap<String, Object>();
     }
 
@@ -240,10 +241,10 @@
      * @throws JSONException
      */
-    public JSONObject(Map map) {
-        this.map = new HashMap();
+    public JSONObject(Map<String, Object> map) {
+        this.map = new HashMap<String, Object>();
         if (map != null) {
-            Iterator i = map.entrySet().iterator();
+            Iterator<Entry<String, Object>> i = map.entrySet().iterator();
             while (i.hasNext()) {
-                Map.Entry e = (Map.Entry) i.next();
+                Entry<String, Object> e = i.next();
                 Object value = e.getValue();
                 if (value != null) {
@@ -296,5 +297,5 @@
     public JSONObject(Object object, String names[]) {
         this();
-        Class c = object.getClass();
+        Class<? extends Object> c = object.getClass();
         for (int i = 0; i < names.length; i += 1) {
             String name = names[i];
@@ -339,5 +340,5 @@
 // Iterate through the keys in the bundle.
 
-        Enumeration keys = bundle.getKeys();
+        Enumeration<?> keys = bundle.getKeys();
         while (keys.hasMoreElements()) {
             Object key = keys.nextElement();
@@ -610,5 +611,5 @@
             return null;
         }
-        Iterator iterator = jo.keys();
+        Iterator<String> iterator = jo.keys();
         String[] names = new String[length];
         int i = 0;
@@ -629,5 +630,5 @@
             return null;
         }
-        Class klass = object.getClass();
+        Class<? extends Object> klass = object.getClass();
         Field[] fields = klass.getFields();
         int length = fields.length;
@@ -718,5 +719,5 @@
      * @return An iterator of the keys.
      */
-    public Iterator keys() {
+    public Iterator<String> keys() {
         return this.keySet().iterator();
     }
@@ -727,5 +728,5 @@
      * @return A keySet.
      */
-    public Set keySet() {
+    public Set<String> keySet() {
         return this.map.keySet();
     }
@@ -749,5 +750,5 @@
     public JSONArray names() {
         JSONArray ja = new JSONArray();
-        Iterator keys = this.keys();
+        Iterator<String> keys = this.keys();
         while (keys.hasNext()) {
             ja.put(keys.next());
@@ -979,5 +980,5 @@
 
     private void populateMap(Object bean) {
-        Class klass = bean.getClass();
+        Class<? extends Object> klass = bean.getClass();
 
 // If klass is a System class then set includeSuperClass to false.
@@ -1051,5 +1052,5 @@
      * @throws JSONException
      */
-    public JSONObject put(String key, Collection value) throws JSONException {
+    public JSONObject put(String key, Collection<?> value) throws JSONException {
         this.put(key, new JSONArray(value));
         return this;
@@ -1115,5 +1116,5 @@
      * @throws JSONException
      */
-    public JSONObject put(String key, Map value) throws JSONException {
+    public JSONObject put(String key, Map<String, Object> value) throws JSONException {
         this.put(key, new JSONObject(value));
         return this;
@@ -1446,4 +1447,5 @@
      *             If the value is or contains an invalid number.
      */
+    @SuppressWarnings("unchecked")
     public static String valueToString(Object value) throws JSONException {
         if (value == null || value.equals(null)) {
@@ -1470,8 +1472,8 @@
         }
         if (value instanceof Map) {
-            return new JSONObject((Map) value).toString();
+            return new JSONObject((Map<String, Object>) value).toString();
         }
         if (value instanceof Collection) {
-            return new JSONArray((Collection) value).toString();
+            return new JSONArray((Collection<?>) value).toString();
         }
         if (value.getClass().isArray()) {
@@ -1493,4 +1495,5 @@
      * @return The wrapped value
      */
+    @SuppressWarnings("unchecked")
     public static Object wrap(Object object) {
         try {
@@ -1509,5 +1512,5 @@
 
             if (object instanceof Collection) {
-                return new JSONArray((Collection) object);
+                return new JSONArray((Collection<?>) object);
             }
             if (object.getClass().isArray()) {
@@ -1515,5 +1518,5 @@
             }
             if (object instanceof Map) {
-                return new JSONObject((Map) object);
+                return new JSONObject((Map<String, Object>) object);
             }
             Package objectPackage = object.getClass().getPackage();
@@ -1544,4 +1547,5 @@
     }
 
+    @SuppressWarnings("unchecked")
     static final Writer writeValue(Writer writer, Object value,
             int indentFactor, int indent) throws JSONException, IOException {
@@ -1553,7 +1557,7 @@
             ((JSONArray) value).write(writer, indentFactor, indent);
         } else if (value instanceof Map) {
-            new JSONObject((Map) value).write(writer, indentFactor, indent);
+            new JSONObject((Map<String, Object>) value).write(writer, indentFactor, indent);
         } else if (value instanceof Collection) {
-            new JSONArray((Collection) value).write(writer, indentFactor,
+            new JSONArray((Collection<?>) value).write(writer, indentFactor,
                     indent);
         } else if (value.getClass().isArray()) {
@@ -1597,5 +1601,5 @@
             boolean commanate = false;
             final int length = this.length();
-            Iterator keys = this.keys();
+            Iterator<String> keys = this.keys();
             writer.write('{');
 
Index: /trunk/src/org/openstreetmap/josm/gui/MainApplet.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/MainApplet.java	(revision 6614)
+++ /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 6614)
+++ /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 6614)
+++ /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 6614)
+++ /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 6614)
+++ /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 6614)
+++ /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 6614)
+++ /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 6614)
+++ /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 6614)
+++ /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;
