Index: /trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java	(revision 7118)
+++ /trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java	(revision 7119)
@@ -36,7 +36,7 @@
 import org.openstreetmap.josm.data.osm.history.HistoryWay;
 import org.openstreetmap.josm.gui.tagging.TaggingPreset;
+import org.openstreetmap.josm.gui.tagging.TaggingPresetNameTemplateList;
 import org.openstreetmap.josm.tools.AlphanumComparator;
 import org.openstreetmap.josm.tools.I18n;
-import org.openstreetmap.josm.tools.TaggingPresetNameTemplateList;
 import org.openstreetmap.josm.tools.Utils;
 import org.openstreetmap.josm.tools.Utils.Function;
Index: /trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java	(revision 7118)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java	(revision 7119)
@@ -67,5 +67,4 @@
 import org.openstreetmap.josm.io.imagery.WMSRequest;
 
-
 /**
  * This is a layer that grabs the current screen from an WMS server. The data
@@ -156,4 +155,7 @@
     private boolean isInvalidUrlConfirmed = false;
 
+    /**
+     * Constructs a new {@code WMSLayer}.
+     */
     public WMSLayer() {
         this(new ImageryInfo(tr("Blank Layer")));
@@ -338,5 +340,4 @@
 
         attribution.paintAttribution(g, mv.getWidth(), mv.getHeight(), null, null, 0, this);
-
     }
 
@@ -453,10 +454,8 @@
                 GeorefImage img = images[modulo(x,dax)][modulo(y,day)];
                 if (!img.paint(g, mv, x, y, leftEdge, bottomEdge)) {
-                    WMSRequest request = new WMSRequest(x, y, info.getPixelPerDegree(), real, true);
-                    addRequest(request);
+                    addRequest(new WMSRequest(x, y, info.getPixelPerDegree(), real, true));
                     areaToCache.add(new ProjectionBounds(getEastNorth(x, y), getEastNorth(x + 1, y + 1)));
                 } else if (img.getState() == State.PARTLY_IN_CACHE && autoDownloadEnabled) {
-                    WMSRequest request = new WMSRequest(x, y, info.getPixelPerDegree(), real, false);
-                    addRequest(request);
+                    addRequest(new WMSRequest(x, y, info.getPixelPerDegree(), real, false));
                     areaToCache.add(new ProjectionBounds(getEastNorth(x, y), getEastNorth(x + 1, y + 1)));
                 }
@@ -658,4 +657,7 @@
 
     public class DownloadAction extends AbstractAction {
+        /**
+         * Constructs a new {@code DownloadAction}.
+         */
         public DownloadAction() {
             super(tr("Download visible tiles"));
@@ -776,4 +778,7 @@
 
     public class ReloadErrorTilesAction extends AbstractAction {
+        /**
+         * Constructs a new {@code ReloadErrorTilesAction}.
+         */
         public ReloadErrorTilesAction() {
             super(tr("Reload erroneous tiles"));
@@ -797,4 +802,7 @@
 
     public class ToggleAlphaAction extends AbstractAction implements LayerAction {
+        /**
+         * Constructs a new {@code ToggleAlphaAction}.
+         */
         public ToggleAlphaAction() {
             super(tr("Alpha channel"));
@@ -815,4 +823,5 @@
             Main.map.mapView.repaint();
         }
+
         @Override
         public Component createMenuComponent() {
@@ -821,4 +830,5 @@
             return item;
         }
+
         @Override
         public boolean supportLayers(List<Layer> layers) {
@@ -827,6 +837,9 @@
     }
 
-
     public class ToggleAutoResolutionAction extends AbstractAction implements LayerAction {
+
+        /**
+         * Constructs a new {@code ToggleAutoResolutionAction}.
+         */
         public ToggleAutoResolutionAction() {
             super(tr("Automatically change resolution"));
@@ -858,4 +871,7 @@
      */
     public class BookmarkWmsAction extends AbstractAction {
+        /**
+         * Constructs a new {@code BookmarkWmsAction}.
+         */
         public BookmarkWmsAction() {
             super(tr("Set WMS Bookmark"));
Index: /trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetMenu.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetMenu.java	(revision 7118)
+++ /trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetMenu.java	(revision 7119)
@@ -8,6 +8,8 @@
 import java.awt.Point;
 import java.awt.event.ActionEvent;
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 
@@ -19,9 +21,21 @@
 
 import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.tools.PresetTextComparator;
+import org.openstreetmap.josm.tools.AlphanumComparator;
 
 public class TaggingPresetMenu extends TaggingPreset {
-    public JMenu menu = null; // set by TaggingPresetPreferences
-    
+    public JMenu menu = null; // set by TaggingPresets
+
+    private static class PresetTextComparator implements Comparator<JMenuItem>, Serializable {
+        @Override
+        public int compare(JMenuItem o1, JMenuItem o2) {
+            if (Main.main.menu.presetSearchAction.equals(o1.getAction()))
+                return -1;
+            else if (Main.main.menu.presetSearchAction.equals(o2.getAction()))
+                return 1;
+            else
+                return AlphanumComparator.getInstance().compare(o1.getText(), o2.getText());
+        }
+    }
+
     @Override
     public void setDisplayName() {
@@ -67,5 +81,5 @@
         }
     }
-    
+
     /**
      * Sorts the menu items using the translated item text
Index: /trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetNameTemplateList.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetNameTemplateList.java	(revision 7119)
+++ /trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetNameTemplateList.java	(revision 7119)
@@ -0,0 +1,78 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.gui.tagging;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
+
+/**
+ * List of tagging presets with name templates, allows to find appropriate template based on existing primitive
+ */
+public final class TaggingPresetNameTemplateList implements TaggingPresetListener {
+
+    private static TaggingPresetNameTemplateList instance;
+
+    /**
+     * Replies the unique instance.
+     * @return the unique instance
+     */
+    public static TaggingPresetNameTemplateList getInstance() {
+        if (instance == null) {
+            instance = new TaggingPresetNameTemplateList();
+            TaggingPresets.addListener(instance);
+        }
+        return instance;
+    }
+
+    private final List<TaggingPreset> presetsWithPattern = new LinkedList<>();
+
+    private TaggingPresetNameTemplateList() {
+        buildPresetsWithPattern();
+    }
+
+    private void buildPresetsWithPattern() {
+        synchronized(this) {
+            Main.debug("Building list of presets with name template");
+            presetsWithPattern.clear();
+            for (TaggingPreset tp : TaggingPresets.getTaggingPresets()) {
+                if (tp.nameTemplate != null) {
+                    presetsWithPattern.add(tp);
+                }
+            }
+        }
+    }
+
+    /**
+     * Finds and returns the first occurence of preset with template name matching the given primitive
+     * @param primitive The primitive to match
+     * @return the first occurence of preset with template name matching the primitive
+     */
+    public TaggingPreset findPresetTemplate(OsmPrimitive primitive) {
+        synchronized(this) {
+            for (TaggingPreset t : presetsWithPattern) {
+                Collection<TaggingPresetType> type = Collections.singleton(TaggingPresetType.forPrimitive(primitive));
+                if (t.typeMatches(type)) {
+                    if (t.nameTemplateFilter != null) {
+                        if (t.nameTemplateFilter.match(primitive))
+                            return t;
+                        else {
+                            continue;
+                        }
+                    } else if (t.matches(type, primitive.getKeys(), false)) {
+                        return t;
+                    }
+                }
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public void taggingPresetsModified() {
+        buildPresetsWithPattern();
+    }
+}
Index: /trunk/src/org/openstreetmap/josm/io/Compression.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/Compression.java	(revision 7118)
+++ /trunk/src/org/openstreetmap/josm/io/Compression.java	(revision 7119)
@@ -60,9 +60,9 @@
         switch (this) {
             case BZIP2:
-                return FileImporter.getBZip2InputStream(in);
+                return Utils.getBZip2InputStream(in);
             case GZIP:
-                return FileImporter.getGZipInputStream(in);
+                return Utils.getGZipInputStream(in);
             case ZIP:
-                return FileImporter.getZipInputStream(in);
+                return Utils.getZipInputStream(in);
             case NONE:
             default:
Index: /trunk/src/org/openstreetmap/josm/io/FileImporter.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/FileImporter.java	(revision 7118)
+++ /trunk/src/org/openstreetmap/josm/io/FileImporter.java	(revision 7119)
@@ -4,17 +4,10 @@
 import static org.openstreetmap.josm.tools.I18n.tr;
 
-import java.io.BufferedInputStream;
 import java.io.File;
 import java.io.IOException;
-import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
 import java.util.List;
-import java.util.zip.GZIPInputStream;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
 
 import javax.swing.JOptionPane;
 
-import org.apache.tools.bzip2.CBZip2InputStream;
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.ExtensionFileFilter;
@@ -138,38 +131,4 @@
     }
 
-    public static CBZip2InputStream getBZip2InputStream(InputStream in) throws IOException {
-        if (in == null) {
-            return null;
-        }
-        BufferedInputStream bis = new BufferedInputStream(in);
-        int b = bis.read();
-        if (b != 'B')
-            throw new IOException(tr("Invalid bz2 file."));
-        b = bis.read();
-        if (b != 'Z')
-            throw new IOException(tr("Invalid bz2 file."));
-        return new CBZip2InputStream(bis, /* see #9537 */ true);
-    }
-
-    public static GZIPInputStream getGZipInputStream(InputStream in) throws IOException {
-        if (in == null) {
-            return null;
-        }
-        return new GZIPInputStream(in);
-    }
-
-    public static ZipInputStream getZipInputStream(InputStream in) throws IOException {
-        if (in == null) {
-            return null;
-        }
-        ZipInputStream zis = new ZipInputStream(in, StandardCharsets.UTF_8);
-        // Positions the stream at the beginning of first entry
-        ZipEntry ze = zis.getNextEntry();
-        if (ze != null && Main.isDebugEnabled()) {
-            Main.debug("Zip entry: "+ze.getName());
-        }
-        return zis;
-    }
-
     /**
      * Returns the enabled state of this {@code FileImporter}. When enabled, it is listed and usable in "File-&gt;Open" dialog.
Index: unk/src/org/openstreetmap/josm/tools/PresetTextComparator.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/PresetTextComparator.java	(revision 7118)
+++ 	(revision )
@@ -1,28 +1,0 @@
-// License: GPL. For details, see LICENSE file.
-package org.openstreetmap.josm.tools;
-
-import java.io.Serializable;
-import java.util.Comparator;
-
-import javax.swing.JMenuItem;
-
-import org.openstreetmap.josm.Main;
-
-public class PresetTextComparator implements Comparator<JMenuItem>, Serializable {
-    @Override
-    public int compare(JMenuItem arg0, JMenuItem arg1) {
-        if (Main.main.menu.presetSearchAction.equals(arg0.getAction()))
-            return -1;
-        else if (Main.main.menu.presetSearchAction.equals(arg0.getAction()))
-            return 1;
-        else if (arg0.getText() == arg1.getText())
-            return 0;
-        else if (arg0.getText() == null)
-            return -1;
-        else if (arg1.getText() == null)
-            return 1;
-        else
-            return arg0.getText().compareTo(arg1.getText());
-    }
-
-}
Index: unk/src/org/openstreetmap/josm/tools/TaggingPresetNameTemplateList.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/TaggingPresetNameTemplateList.java	(revision 7118)
+++ 	(revision )
@@ -1,82 +1,0 @@
-// License: GPL. For details, see LICENSE file.
-package org.openstreetmap.josm.tools;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.gui.tagging.TaggingPreset;
-import org.openstreetmap.josm.gui.tagging.TaggingPresetListener;
-import org.openstreetmap.josm.gui.tagging.TaggingPresetType;
-import org.openstreetmap.josm.gui.tagging.TaggingPresets;
-
-/**
- * List of tagging presets with name templates, allows to find appropriate template based on existing primitive
- */
-public final class TaggingPresetNameTemplateList implements TaggingPresetListener {
-
-    private static TaggingPresetNameTemplateList instance;
-
-    /**
-     * Replies the unique instance.
-     * @return the unique instance
-     */
-    public static TaggingPresetNameTemplateList getInstance() {
-        if (instance == null) {
-            instance = new TaggingPresetNameTemplateList();
-            TaggingPresets.addListener(instance);
-        }
-        return instance;
-    }
-
-    private final List<TaggingPreset> presetsWithPattern = new LinkedList<>();
-
-    private TaggingPresetNameTemplateList() {
-        buildPresetsWithPattern();
-    }
-
-    private void buildPresetsWithPattern() {
-        synchronized(this) {
-            Main.debug("Building list of presets with name template");
-            presetsWithPattern.clear();
-            for (TaggingPreset tp : TaggingPresets.getTaggingPresets()) {
-                if (tp.nameTemplate != null) {
-                    presetsWithPattern.add(tp);
-                }
-            }
-        }
-    }
-
-    /**
-     * Finds and returns the first occurence of preset with template name matching the given primitive
-     * @param primitive The primitive to match
-     * @return the first occurence of preset with template name matching the primitive
-     */
-    public TaggingPreset findPresetTemplate(OsmPrimitive primitive) {
-        synchronized(this) {
-            for (TaggingPreset t : presetsWithPattern) {
-                Collection<TaggingPresetType> type = Collections.singleton(TaggingPresetType.forPrimitive(primitive));
-                if (t.typeMatches(type)) {
-                    if (t.nameTemplateFilter != null) {
-                        if (t.nameTemplateFilter.match(primitive))
-                            return t;
-                        else {
-                            continue;
-                        }
-                    } else if (t.matches(type, primitive.getKeys(), false)) {
-                        return t;
-                    }
-                }
-            }
-        }
-        return null;
-    }
-
-    @Override
-    public void taggingPresetsModified() {
-        buildPresetsWithPattern();
-    }
-}
Index: /trunk/src/org/openstreetmap/josm/tools/Utils.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 7118)
+++ /trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 7119)
@@ -45,10 +45,11 @@
 import java.util.regex.Pattern;
 import java.util.zip.GZIPInputStream;
+import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
+import java.util.zip.ZipInputStream;
 
 import org.apache.tools.bzip2.CBZip2InputStream;
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.Version;
-import org.openstreetmap.josm.io.FileImporter;
 
 /**
@@ -665,11 +666,71 @@
     public static InputStream openURLAndDecompress(final URL url, final boolean decompress) throws IOException {
         final URLConnection connection = setupURLConnection(url.openConnection());
-        if (decompress && "application/x-gzip".equals(connection.getHeaderField("Content-Type"))) {
-            return new GZIPInputStream(connection.getInputStream());
-        } else if (decompress && "application/x-bzip2".equals(connection.getHeaderField("Content-Type"))) {
-            return FileImporter.getBZip2InputStream(new BufferedInputStream(connection.getInputStream()));
-        } else {
-            return connection.getInputStream();
-        }
+        final InputStream in = connection.getInputStream();
+        if (decompress) {
+            switch (connection.getHeaderField("Content-Type")) {
+            case "application/zip":
+                return getZipInputStream(in);
+            case "application/x-gzip":
+                return getGZipInputStream(in);
+            case "application/x-bzip2":
+                return getBZip2InputStream(in);
+            }
+        }
+        return in;
+    }
+
+    /**
+     * Returns a Bzip2 input stream wrapping given input stream.
+     * @param in The raw input stream
+     * @return a Bzip2 input stream wrapping given input stream, or {@code null} if {@code in} is {@code null}
+     * @throws IOException if the given input stream does not contain valid BZ2 header
+     * @since 7119
+     */
+    public static CBZip2InputStream getBZip2InputStream(InputStream in) throws IOException {
+        if (in == null) {
+            return null;
+        }
+        BufferedInputStream bis = new BufferedInputStream(in);
+        int b = bis.read();
+        if (b != 'B')
+            throw new IOException(tr("Invalid bz2 file."));
+        b = bis.read();
+        if (b != 'Z')
+            throw new IOException(tr("Invalid bz2 file."));
+        return new CBZip2InputStream(bis, /* see #9537 */ true);
+    }
+
+    /**
+     * Returns a Gzip input stream wrapping given input stream.
+     * @param in The raw input stream
+     * @return a Gzip input stream wrapping given input stream, or {@code null} if {@code in} is {@code null}
+     * @throws IOException if an I/O error has occurred
+     * @since 7119
+     */
+    public static GZIPInputStream getGZipInputStream(InputStream in) throws IOException {
+        if (in == null) {
+            return null;
+        }
+        return new GZIPInputStream(in);
+    }
+
+    /**
+     * Returns a Zip input stream wrapping given input stream.
+     * @param in The raw input stream
+     * @return a Zip input stream wrapping given input stream, or {@code null} if {@code in} is {@code null}
+     * @throws IOException if an I/O error has occurred
+     * @since 7119
+     */
+    public static ZipInputStream getZipInputStream(InputStream in) throws IOException {
+        if (in == null) {
+            return null;
+        }
+        ZipInputStream zis = new ZipInputStream(in, StandardCharsets.UTF_8);
+        // Positions the stream at the beginning of first entry
+        ZipEntry ze = zis.getNextEntry();
+        if (ze != null && Main.isDebugEnabled()) {
+            Main.debug("Zip entry: "+ze.getName());
+        }
+        return zis;
     }
 
