Index: applications/editors/josm/plugins/wmsplugin/build.xml
===================================================================
--- applications/editors/josm/plugins/wmsplugin/build.xml	(revision 17391)
+++ applications/editors/josm/plugins/wmsplugin/build.xml	(revision 17397)
@@ -32,5 +32,5 @@
     <property name="ant.build.javac.target" value="1.5"/>
 	<property name="commit.message"         value="fixing JOSM issue #3186" />
-	<property name="josm.reference.release" value="2012" />
+	<property name="josm.reference.release" value="2020" />
 	
     <target name="init">
Index: applications/editors/josm/plugins/wmsplugin/src/wmsplugin/GeorefImage.java
===================================================================
--- applications/editors/josm/plugins/wmsplugin/src/wmsplugin/GeorefImage.java	(revision 17391)
+++ applications/editors/josm/plugins/wmsplugin/src/wmsplugin/GeorefImage.java	(revision 17397)
@@ -144,5 +144,11 @@
         max = (EastNorth) in.readObject();
         min = (EastNorth) in.readObject();
-        image = (BufferedImage) ImageIO.read(ImageIO.createImageInputStream(in));
+        boolean hasImage = in.readBoolean();
+        if (hasImage)
+        	image = (BufferedImage) ImageIO.read(ImageIO.createImageInputStream(in));
+        else {
+        	in.readObject(); // read null from input stream
+        	image = null;
+        }
     }
 
@@ -150,8 +156,11 @@
         out.writeObject(max);
         out.writeObject(min);
-        if(image == null)
+        if(image == null) {
+        	out.writeBoolean(false);
             out.writeObject(null);
-        else
+        } else {
+        	out.writeBoolean(true);
             ImageIO.write(image, "png", ImageIO.createImageOutputStream(out));
+        }
     }
 
Index: applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSLayer.java
===================================================================
--- applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSLayer.java	(revision 17391)
+++ applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSLayer.java	(revision 17397)
@@ -1,5 +1,4 @@
 package wmsplugin;
 
-import org.openstreetmap.josm.io.CacheFiles;
 import static org.openstreetmap.josm.tools.I18n.tr;
 
@@ -35,4 +34,5 @@
 import org.openstreetmap.josm.gui.dialogs.LayerListPopup;
 import org.openstreetmap.josm.gui.layer.Layer;
+import org.openstreetmap.josm.io.CacheFiles;
 import org.openstreetmap.josm.tools.ImageProvider;
 
@@ -61,5 +61,5 @@
 	protected String baseURL;
 	protected String cookies;
-	protected final int serializeFormatVersion = 4;
+	protected final int serializeFormatVersion = 5;
 
 	private ExecutorService executor = null;
@@ -212,7 +212,7 @@
 				startstop,
 				alphaChannel,
-				new JMenuItem(new changeResolutionAction()),
-				new JMenuItem(new reloadErrorTilesAction()),
-				new JMenuItem(new downloadAction()),
+				new JMenuItem(new ChangeResolutionAction()),
+				new JMenuItem(new ReloadErrorTilesAction()),
+				new JMenuItem(new DownloadAction()),
 				new JSeparator(),
 				new JMenuItem(new LayerListPopup.InfoAction(this))
@@ -230,6 +230,6 @@
 	}
 
-	public class downloadAction extends AbstractAction {
-		public downloadAction() {
+	public class DownloadAction extends AbstractAction {
+		public DownloadAction() {
 			super(tr("Download visible tiles"));
 		}
@@ -239,6 +239,6 @@
 	}
 
-	public class changeResolutionAction extends AbstractAction {
-		public changeResolutionAction() {
+	public class ChangeResolutionAction extends AbstractAction {
+		public ChangeResolutionAction() {
 			super(tr("Change resolution"));
 		}
@@ -251,6 +251,6 @@
 	}
 
-	public class reloadErrorTilesAction extends AbstractAction {
-		public reloadErrorTilesAction() {
+	public class ReloadErrorTilesAction extends AbstractAction {
+		public ReloadErrorTilesAction() {
 			super(tr("Reload erroneous tiles"));
 		}
@@ -294,5 +294,5 @@
 		}
 	}
-
+	
 	public class SaveWmsAction extends AbstractAction {
 		public SaveWmsAction() {
@@ -302,20 +302,20 @@
 			File f = SaveActionBase.createAndOpenSaveFileChooser(
 					tr("Save WMS layer"), ".wms");
-			try
-			{
-				FileOutputStream fos = new FileOutputStream(f);
-				ObjectOutputStream oos = new ObjectOutputStream(fos);
-				oos.writeInt(serializeFormatVersion);
-				oos.writeInt(dax);
-				oos.writeInt(day);
-				oos.writeInt(ImageSize);
-				oos.writeDouble(pixelPerDegree);
-				oos.writeObject(getName());
-				oos.writeObject(baseURL);
-				oos.writeObject(images);
-				oos.close();
-				fos.close();
-			}
-			catch (Exception ex) {
+			try {
+				if (f != null) {
+					ObjectOutputStream oos = new ObjectOutputStream(
+							new FileOutputStream(f)
+					);
+					oos.writeInt(serializeFormatVersion);
+					oos.writeInt(dax);
+					oos.writeInt(day);
+					oos.writeInt(ImageSize);
+					oos.writeDouble(pixelPerDegree);
+					oos.writeObject(getName());
+					oos.writeObject(baseURL);
+					oos.writeObject(images);
+					oos.close();
+				}
+			} catch (Exception ex) {
 				ex.printStackTrace(System.out);
 			}
@@ -329,5 +329,5 @@
 		public void actionPerformed(ActionEvent ev) {
 			JFileChooser fc = DiskAccessAction.createAndOpenFileChooser(true,
-					false, tr("Load WMS layer"));
+					false, tr("Load WMS layer"), "wms");
 			if(fc == null) return;
 			File f = fc.getSelectedFile();
Index: applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPlugin.java
===================================================================
--- applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPlugin.java	(revision 17391)
+++ applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPlugin.java	(revision 17397)
@@ -24,4 +24,5 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.actions.ExtensionFileFilter;
 import org.openstreetmap.josm.actions.JosmAction;
 import org.openstreetmap.josm.data.ProjectionBounds;
@@ -35,4 +36,7 @@
 import org.openstreetmap.josm.plugins.Plugin;
 
+import wmsplugin.io.WMSLayerExporter;
+import wmsplugin.io.WMSLayerImporter;
+
 public class WMSPlugin extends Plugin {
     static CacheFiles cache = new CacheFiles("wmsplugin");
@@ -46,4 +50,9 @@
     // remember state of menu item to restore on changed preferences
     static private boolean menuEnabled = false;
+    
+    protected void initExporterAndImporter() {
+    	ExtensionFileFilter.exporters.add(new WMSLayerExporter());
+    	ExtensionFileFilter.importers.add(new WMSLayerImporter());
+    }
 
     public WMSPlugin() {
@@ -51,4 +60,5 @@
         cache.setExpire(CacheFiles.EXPIRE_MONTHLY, false);
         cache.setMaxSize(70, false);
+        initExporterAndImporter();
     }
 
Index: applications/editors/josm/plugins/wmsplugin/src/wmsplugin/io/WMSLayerExporter.java
===================================================================
--- applications/editors/josm/plugins/wmsplugin/src/wmsplugin/io/WMSLayerExporter.java	(revision 17397)
+++ applications/editors/josm/plugins/wmsplugin/src/wmsplugin/io/WMSLayerExporter.java	(revision 17397)
@@ -0,0 +1,13 @@
+package wmsplugin.io;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+import org.openstreetmap.josm.actions.ExtensionFileFilter;
+import org.openstreetmap.josm.io.FileExporter;
+
+public class WMSLayerExporter extends FileExporter{
+	
+	public WMSLayerExporter() {
+		super(new ExtensionFileFilter("wms", "wms", tr("WMS Files (*.wms)")));
+	}
+}
Index: applications/editors/josm/plugins/wmsplugin/src/wmsplugin/io/WMSLayerImporter.java
===================================================================
--- applications/editors/josm/plugins/wmsplugin/src/wmsplugin/io/WMSLayerImporter.java	(revision 17397)
+++ applications/editors/josm/plugins/wmsplugin/src/wmsplugin/io/WMSLayerImporter.java	(revision 17397)
@@ -0,0 +1,13 @@
+package wmsplugin.io;
+
+import org.openstreetmap.josm.actions.ExtensionFileFilter;
+import org.openstreetmap.josm.io.FileImporter;
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+public class WMSLayerImporter extends FileImporter{
+
+	public WMSLayerImporter() {
+		super(new ExtensionFileFilter("wms", "wms", tr("WMS Files (*.wms)")));
+	}
+	
+}
