Index: trunk/src/org/openstreetmap/josm/actions/GpxExportAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/GpxExportAction.java	(revision 14949)
+++ trunk/src/org/openstreetmap/josm/actions/GpxExportAction.java	(revision 14950)
@@ -10,4 +10,5 @@
 import java.io.File;
 import java.io.IOException;
+import java.nio.file.InvalidPathException;
 import java.text.MessageFormat;
 
@@ -21,5 +22,4 @@
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.tools.CheckParameterUtil;
-import org.openstreetmap.josm.tools.Logging;
 import org.openstreetmap.josm.tools.Shortcut;
 
@@ -108,6 +108,6 @@
                 try {
                     exporter.exportData(file, layer);
-                } catch (IOException e) {
-                    Logging.error(e);
+                } catch (IOException | InvalidPathException e) {
+                    SaveActionBase.showAndLogException(e);
                 }
             }
Index: trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java	(revision 14949)
+++ trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java	(revision 14950)
@@ -7,4 +7,5 @@
 import java.io.File;
 import java.io.IOException;
+import java.nio.file.InvalidPathException;
 import java.util.Collection;
 import java.util.LinkedList;
@@ -26,4 +27,5 @@
 import org.openstreetmap.josm.tools.Logging;
 import org.openstreetmap.josm.tools.Shortcut;
+import org.openstreetmap.josm.tools.Utils;
 
 /**
@@ -121,6 +123,6 @@
             }
             MainApplication.getMainFrame().repaint();
-        } catch (IOException e) {
-            Logging.error(e);
+        } catch (IOException | InvalidPathException e) {
+            showAndLogException(e);
             return false;
         }
@@ -240,3 +242,16 @@
         PreferencesUtils.putListBounded(Config.getPref(), "file-open.history", maxsize, history);
     }
+
+    static void showAndLogException(Exception e) {
+        GuiHelper.runInEDT(() ->
+        JOptionPane.showMessageDialog(
+                MainApplication.getMainFrame(),
+                tr("<html>An error occurred while saving.<br>Error is:<br>{0}</html>",
+                        Utils.escapeReservedCharactersHTML(e.getClass().getSimpleName() + " - " + e.getMessage())),
+                tr("Error"),
+                JOptionPane.ERROR_MESSAGE
+                ));
+
+        Logging.error(e);
+    }
 }
Index: trunk/src/org/openstreetmap/josm/gui/io/importexport/FileExporter.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/io/importexport/FileExporter.java	(revision 14949)
+++ trunk/src/org/openstreetmap/josm/gui/io/importexport/FileExporter.java	(revision 14950)
@@ -17,4 +17,5 @@
 public abstract class FileExporter implements ActiveLayerChangeListener {
 
+    /** the  ExtensionFileFilter filter used by this exporter */
     public final ExtensionFileFilter filter;
 
Index: trunk/src/org/openstreetmap/josm/gui/io/importexport/GpxExporter.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/io/importexport/GpxExporter.java	(revision 14949)
+++ trunk/src/org/openstreetmap/josm/gui/io/importexport/GpxExporter.java	(revision 14950)
@@ -11,5 +11,4 @@
 import java.io.IOException;
 import java.io.OutputStream;
-import java.nio.file.InvalidPathException;
 import java.text.MessageFormat;
 import java.time.Year;
@@ -39,5 +38,4 @@
 import org.openstreetmap.josm.tools.CheckParameterUtil;
 import org.openstreetmap.josm.tools.GBC;
-import org.openstreetmap.josm.tools.Logging;
 
 /**
@@ -206,11 +204,6 @@
         }
 
-        try (OutputStream fo = Compression.getCompressedFileOutputStream(file)) {
-            new GpxWriter(fo).write(gpxData);
-            fo.flush();
-        } catch (IOException | InvalidPathException ex) {
-            Logging.error(ex);
-            JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Error while exporting {0}:\n{1}", fn, ex.getMessage()),
-                    tr("Error"), JOptionPane.ERROR_MESSAGE);
+        try (OutputStream fo = Compression.getCompressedFileOutputStream(file); GpxWriter writer = new GpxWriter(fo)) {
+            writer.write(gpxData);
         }
     }
Index: trunk/src/org/openstreetmap/josm/gui/io/importexport/OsmExporter.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/io/importexport/OsmExporter.java	(revision 14949)
+++ trunk/src/org/openstreetmap/josm/gui/io/importexport/OsmExporter.java	(revision 14950)
@@ -67,7 +67,9 @@
      * @param noBackup if {@code true}, the potential backup file created if the output file already exists will be deleted
      *                 after a successful export
+     * @throws IOException in case of IO errors
+     * @throws InvalidPathException when file name cannot be converted into a Path
      * @throws IllegalArgumentException if {@code layer} is not an instance of {@code OsmDataLayer}
      */
-    public void exportData(File file, Layer layer, boolean noBackup) {
+    public void exportData(File file, Layer layer, boolean noBackup) throws IOException {
         if (!(layer instanceof OsmDataLayer)) {
             throw new IllegalArgumentException(
@@ -81,7 +83,8 @@
     }
 
-    private void save(File file, OsmDataLayer layer, boolean noBackup) {
+    private void save(File file, OsmDataLayer layer, boolean noBackup) throws IOException {
         File tmpFile = null;
         try {
+
             // use a tmp file because if something errors out in the process of writing the file,
             // we might just end up with a truncated file.  That can destroy lots of work.
@@ -98,11 +101,4 @@
         } catch (IOException | InvalidPathException e) {
             Logging.error(e);
-            JOptionPane.showMessageDialog(
-                    MainApplication.getMainFrame(),
-                    tr("<html>An error occurred while saving.<br>Error is:<br>{0}</html>",
-                            Utils.escapeReservedCharactersHTML(e.getClass().getSimpleName() + " - " + e.getMessage())),
-                    tr("Error"),
-                    JOptionPane.ERROR_MESSAGE
-            );
 
             try {
@@ -121,4 +117,6 @@
                 );
             }
+            // re-throw original error
+            throw e;
         }
     }
