Index: /trunk/src/org/openstreetmap/josm/gui/io/importexport/OsmExporter.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/io/importexport/OsmExporter.java	(revision 14981)
+++ /trunk/src/org/openstreetmap/josm/gui/io/importexport/OsmExporter.java	(revision 14982)
@@ -11,4 +11,5 @@
 import java.io.Writer;
 import java.nio.charset.StandardCharsets;
+import java.nio.file.AccessDeniedException;
 import java.nio.file.InvalidPathException;
 import java.text.MessageFormat;
@@ -86,4 +87,7 @@
         File tmpFile = null;
         try {
+            if (file.exists() && !file.canWrite()) {
+                throw new AccessDeniedException(file.toString());
+            }
 
             // use a tmp file because if something errors out in the process of writing the file,
